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
cc73ff15
Commit
cc73ff15
authored
Jul 10, 2016
by
Maxime Perrotin
Browse files
Test strings
parent
d096c46e
Changes
1
Hide whitespace changes
Inline
Side-by-side
asn1_value_editor/asn1_value_editor.py
View file @
cc73ff15
...
...
@@ -405,7 +405,7 @@ class asn1Editor(QTreeView):
self
.
log
.
error
(
'Missing enumerted or bug - please report'
)
elif
asnType
==
'STRING'
:
dest
.
SetFromPyString
(
value
)
else
:
# What about octet string ? XXX CHECKME
else
:
self
.
log
.
error
(
'Unsupported type: please report bug'
)
def
getVariable
(
self
,
root
=
None
,
dest
=
None
):
...
...
@@ -456,7 +456,7 @@ class asn1Editor(QTreeView):
if
asnType
in
(
'INTEGER'
,
'REAL'
,
'BOOLEAN'
):
child
.
setText
(
str
(
ptr
.
Get
()))
elif
asnType
==
'STRING'
:
child
.
setText
(
ptr
.
Get
From
PyString
())
child
.
setText
(
ptr
.
GetPyString
())
elif
asnType
==
'ENUMERATED'
:
value
=
ptr
.
Get
()
intMappings
=
child
.
data
(
INTMAP
)
...
...
@@ -494,11 +494,12 @@ class asn1Editor(QTreeView):
def
updateVariable
(
self
,
root
=
None
,
asn1Var
=
None
):
''' Update the variable value (when loading a TC or receiving a TM) '''
root
=
root
or
self
.
treeItem
root
=
root
or
self
.
treeItem
asn1Instance
=
asn1Var
or
self
.
asn1Instance
row
=
root
.
row
()
name
=
root
.
text
()
asnType
=
self
.
model
.
item
(
row
,
1
).
text
()
row
=
root
.
row
()
#name = root.text()
asnType
=
self
.
model
.
item
(
row
,
1
).
text
()
if
asnType
==
'SEQOF'
:
# Set the number of items in column 3
nbElem
=
asn1Instance
.
GetLength
()
...
...
@@ -513,17 +514,19 @@ class asn1Editor(QTreeView):
if
num
==
kind
:
break
else
:
print
(
"ERROR -
CHOICE index not found in DV.py"
)
self
.
log
.
error
(
"
CHOICE index not found in DV.py"
)
# how to translate this kind number into the choice string? XXX
self
.
model
.
item
(
row
,
3
).
setText
(
enumerant
)
# decode the actual value
ptr
=
getattr
(
asn1Instance
,
enumerant
.
replace
(
'-'
,
'_'
))
self
.
updateModel
(
root
,
ptr
)
elif
asnType
in
(
'INTEGER'
,
'REAL'
,
'STRING'
,
'BOOLEAN'
):
value
=
asn1Instance
.
Get
()
if
asnType
==
'BOOLEAN'
:
value
=
'True'
if
value
else
'False'
self
.
model
.
item
(
row
,
3
).
setText
(
str
(
value
))
elif
asnType
in
(
'INTEGER'
,
'REAL'
):
self
.
model
.
item
(
row
,
3
).
setText
(
str
(
asn1Instance
.
Get
()))
elif
asnType
==
'BOOLEAN'
:
value
=
'True'
if
asn1Instance
.
Get
()
else
'False'
self
.
model
.
item
(
row
,
3
).
setText
(
value
)
elif
asnType
==
'STRING'
:
self
.
model
.
item
(
row
,
3
).
setText
(
asn1Instance
.
GetPyString
())
elif
asnType
==
'ENUMERATED'
:
value
=
asn1Instance
.
Get
()
# get the mapping to retrieve the integer value
...
...
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