Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
asn1-value-editor
Commits
b1f0cd80
Commit
b1f0cd80
authored
Dec 23, 2015
by
Maxime Perrotin
Browse files
Fix Swig interface
parent
235b31f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
asn1_value_editor/asn1_value_editor.py
View file @
b1f0cd80
...
...
@@ -308,7 +308,8 @@ class asn1Editor(QTreeView):
for
i
in
range
(
nbRows
):
# for each child row
name
=
root
.
child
(
i
,
0
).
text
()
asnType
=
root
.
child
(
i
,
1
).
text
()
value
=
root
.
child
(
i
,
3
).
text
()
# Value appears with underscore in the GUI but keys use ASN.1
value
=
root
.
child
(
i
,
3
).
text
().
replace
(
'_'
,
'-'
)
if
asnType
in
(
'SEQUENCE'
,
'SET'
):
seqValue
=
self
.
parseModel
(
root
.
child
(
i
))
# parse recursively
resValue
[
name
]
=
seqValue
...
...
@@ -488,19 +489,24 @@ class asn1Editor(QTreeView):
self
.
pendingTM
=
None
def
ProcessUDPTM
(
self
,
uperMsg
):
''' Decode an uPER-encoded TM (e.g. received from UDP sockets) and update the model '''
''' Decode an uPER-encoded TM (e.g. received from UDP sockets)
and update the model '''
native_tm
=
self
.
backend
.
decode_uPER
(
uperMsg
)
pythonVar
=
self
.
backend
.
fromASN1ToPyside
(
native_tm
)
self
.
tmToEditor
(
pythonVar
)
def
saveTC
(
self
):
''' Encode the data using GSER (ASN.1 Value Notation) and save it to a file'''
''' Encode the data using GSER (ASN.1 Value Notation) and save it
to a file'''
data
=
self
.
getVariable
()
for
name
in
data
:
asnVN
=
vn
.
toASN1ValueNotation
(
data
[
name
]).
replace
(
'_'
,
'-'
)
self
.
log
.
debug
(
'Saving '
+
asnVN
)
#uPER_buffer = self.backend.encode_uPER(native_tc)
filename
=
QFileDialog
.
getSaveFileName
(
self
,
"Save TC"
,
"."
,
"ASN.1 Variable (*.tc)"
)[
0
]
filename
=
QFileDialog
.
getSaveFileName
(
self
,
"Save TC"
,
"."
,
"ASN.1 Variable (*.tc)"
)[
0
]
try
:
if
filename
.
split
(
'.'
)[
-
1
]
!=
'tc'
:
filename
+=
".tc"
...
...
asn1_value_editor/vn.py
View file @
b1f0cd80
...
...
@@ -273,11 +273,11 @@ def valueNotationToSwig(gser, dest, sort, ASN1Swig, ASN1_AST, var=None):
child_name
=
inp
[
'Choice'
]
ch_ty
=
sort
.
type
.
Children
[
child_name
.
replace
(
'_'
,
'-'
)]
enum_val
=
getattr
(
ASN1Swig
.
DV
,
ch_ty
.
EnumID
)
state
=
outp
.
GetState
()
outp
.
kind
.
Set
(
enum_val
)
rec
(
inp
[
child_name
],
getattr
(
outp
,
child_name
.
replace
(
'-'
,
'_'
)),
ch_ty
.
type
)
outp
.
Reset
(
state
)
reach
(
child_name
.
replace
(
'-'
,
'_'
),
outp
)
rec
(
inp
[
child_name
],
outp
,
ch_ty
.
type
)
else
:
# SEQUENCE
# get the path to the sequence
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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