Commits (2)
......@@ -33,4 +33,5 @@ Author: Maxime Perrotin
LICENSE: LGPL - see LICENSE file
CHANGELOG:
1.0.8 - various updates in SDL handler
1.0.7 - fixed bug in value notation parser
......@@ -16,7 +16,7 @@
__author__ = "Maxime Perrotin"
__license__ = "LGPLv3"
__version__ = "1.0.7"
__version__ = "1.0.8"
__url__ = "http://taste.tuxfamily.org"
import sys
......@@ -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"
......
......@@ -376,10 +376,14 @@ class sdlHandler(QObject):
statenames = get_statenames(context)
def rec_findstates(context, prefix=''):
for each in context.composite_states:
prefix += each.statename + '__'
for name in get_statenames(each):
yield prefix+name
for substate in rec_findstates(each, prefix):
#prefix += each.statename + '.'
if not isinstance(each, opengeode.ogAST.StateAggregation):
# Aggregations are just containers, not states
for name in get_statenames(each):
yield u'{}{}.{}'.format(prefix, each.statename, name)
for substate in rec_findstates(each,
prefix=u'{}{}.'.format(prefix,
each.statename)):
yield substate
statenames.extend(list(rec_findstates(context)))
......@@ -390,7 +394,7 @@ class sdlHandler(QObject):
if aggregates:
statenames.append('(not in state)')
# Add state variables for parelle states in aggregations
# Add state variables for parellel states in aggregations
for agg, substates in aggregates.viewitems():
for each in substates:
row += 1
......
......@@ -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
......