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

Fix Scenario (sending side)

parent 8d7a65ae
......@@ -29,18 +29,24 @@ try:
except ImportError:
print 'ERROR importing PythonController'
TASTE_INST = os.popen('taste-config --prefix').readlines()[0].strip()
sys.path.append(TASTE_INST + '/share/asn1-editor')
from opengeode import Asn1scc as asn1scc
#TASTE_INST = os.popen('taste-config --prefix').readlines()[0].strip()
#sys.path.append(TASTE_INST + '/share/asn1-editor')
class Scenario(QThread, object):
#done = Signal(int)
''' Generic class handling the execution of an MSC scenario '''
def __init__(self, func):
QThread.__init__(self)
self.msg_q = Queue.Queue()
self.modules = {}
self.scenario = func
# Parse the dataview.asn to get the Python AST
dataView = asn1scc.parse_asn1(['dataview-uniq.asn'],
rename_policy=asn1scc.ASN1.RenameOnlyConflicting,
ast_version=asn1scc.ASN1.UniqueEnumeratedNames,
flags=[asn1scc.ASN1.AstOnly])
# Control the end of the scenario
self.stop_requested = False
# Load all TM and TC backends, once for all
......@@ -58,6 +64,8 @@ class Scenario(QThread, object):
.format(b=backend)))
continue
mod.setMsgQ()
# set the ASN.AST into the backend module, needed to convert VN
mod.ASN1_AST = dataView.types
self.modules[backend] = mod
def __call__(self, log, name='Scenario'):
......@@ -182,14 +190,13 @@ class PollerThread(QThread):
while True:
if self.stop_requested:
return 0
msg_received_type = RetrieveMessageFromQueue(
msg_q, buffer_size, p_data_from_mq)
msg_received_type = RetrieveMessageFromQueue(msg_q,
buffer_size,
p_data_from_mq)
if msg_received_type == -1:
time.sleep(0.01)
continue
else:
#print('Received message from TASTE message queue, id =',
# msg_received_type)
for slot in self.slots:
slot.put((msg_received_type, p_data_from_mq))
......
......@@ -656,10 +656,8 @@ class asn1Editor(QTreeView):
@property
def gser(self, use_dash=False):
''' Helper API function: return the GSER representation of the data '''
# data, = self.getVariable().values()
self.getVariable(dest=self.asn1Instance)
res = self.asn1Instance.GSER()
# raw = vn.toASN1ValueNotation(data).strip()
return res if use_dash else res.replace('-', '_')
def to_asn1scc_ctypes(self, root, dest, ASN1Mod, sort, ASN1_AST):
......
......@@ -176,6 +176,7 @@ def format_gser(gser):
def toASN1ValueNotation(val):
''' Create a GSER reprentation of the Python variable '''
# DEPRECATED. No more use of the Python variable
result = ''
if isinstance(val, dict):
if 'Choice' in val:
......
Markdown is supported
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