Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
asn1-value-editor
Commits
459b6b36
Commit
459b6b36
authored
Dec 20, 2014
by
Maxime Perrotin
Browse files
Print GSER representation of SDL internal variables
parent
3947f0f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
asn1_value_editor/resources.py
View file @
459b6b36
...
...
@@ -2,7 +2,7 @@
# Resource object code
#
# Created:
Fri
Dec
19 22:34
:24 2014
# Created:
Sat
Dec
20 14:16
:24 2014
# by: The Resource Compiler for PySide (Qt v4.8.6)
#
# WARNING! All changes made in this file will be lost!
...
...
asn1_value_editor/sdlHandler.py
View file @
459b6b36
...
...
@@ -96,15 +96,25 @@ class sdlHandler(object):
print
'Event!'
for
var
,
(
sort
,
_
)
in
self
.
proc
.
variables
.
viewitems
():
# get internal variables, translate them to swig, and print them
print
'Reading variable "{}" of type "{}"'
.
format
(
var
,
sort
.
ReferencedT
ype
N
ame
)
typename
=
sort
.
ReferencedTypeName
.
replace
(
'-'
,
'_'
)
print
'Reading variable "{}" of type "{}"'
.
format
(
var
,
t
ype
n
ame
)
get_size
=
getattr
(
self
.
dll
,
"{}_size"
.
format
(
var
))
get_size
.
restype
=
ctypes
.
c_long
get_value
=
getattr
(
self
.
dll
,
"{}_value"
.
format
(
var
))
get_value
.
restype
=
ctypes
.
c_char_p
size
=
get_size
()
print
"size= "
,
size
#value = get_value()
#as_bytes = ctypes.cast(value,
# ctypes.POINTER((ctypes.c_byte * size)))
value
=
get_value
()
# From the pointer to the value, copy the content in a byte array
# (this is needed to convert the value to SWIG)
as_bytes
=
ctypes
.
cast
(
value
,
ctypes
.
POINTER
((
ctypes
.
c_ubyte
*
size
)))
swig_ptr
=
ASN1
.
DV
.
new_byte_SWIG_PTR
(
size
)
for
idx
in
xrange
(
size
):
ASN1
.
DV
.
byte_SWIG_PTR_setitem
(
swig_ptr
,
idx
,
as_bytes
.
contents
[
idx
])
asn1_instance
=
getattr
(
ASN1
,
typename
)()
setter
=
getattr
(
ASN1
.
DV
,
"SetDataFor_{}"
.
format
(
typename
))
setter
(
asn1_instance
.
_ptr
,
swig_ptr
)
gser
=
asn1_instance
.
GSER
()
print
"GSER= '{}'"
.
format
(
gser
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment