Commit b1f0cd80 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Fix Swig interface

parent 235b31f3
......@@ -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"
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment