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

Test strings

parent d096c46e
......@@ -405,7 +405,7 @@ class asn1Editor(QTreeView):
self.log.error('Missing enumerted or bug - please report')
elif asnType == 'STRING':
else: # What about octet string ? XXX CHECKME
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'):
elif asnType == 'STRING':
elif asnType == 'ENUMERATED':
value = ptr.Get()
intMappings =
......@@ -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:
print("ERROR - CHOICE index not found in")
self.log.error("CHOICE index not found in")
# 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
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