Commit a16bdca4 authored by Maxime Perrotin's avatar Maxime Perrotin

Fix internal state handling in sdl simulator

parent 3ae8389f
......@@ -30,6 +30,7 @@ LICENSE: LGPL - see LICENSE file
CHANGELOG:
1.8.3 - Proper handling of nested states in SDL simulation
1.8.2 - Proper handling of timers in SDL simulation
1.8.1 - Fixed minor regression in sdl simulation
1.8.0 - Refactor the UserWidgets, allowing easier customisation of TM/TC handling
......
......@@ -16,7 +16,7 @@
__author__ = "Maxime Perrotin"
__license__ = "LGPLv3"
__version__ = "1.8.2"
__version__ = "1.8.3"
__url__ = "https://taste.tools"
import sys
......
......@@ -130,7 +130,7 @@ class sdlHandler(QObject):
raise IOError('SDL Handler failed to initialize')
graph = opengeode.Statechart.create_dot_graph(self.proc, basic=True)
# Flatten the model to have the nested states names in process.mapping
opengeode.Helper.flatten(self.proc)
opengeode.Helper.flatten(self.proc, sep='.')
self.sdl_scene = opengeode.SDL_Scene('statechart')
self.sdl_view = opengeode.SDL_View(self.sdl_scene)
opengeode.Statechart.render_statechart(self.sdl_scene, graph)
......@@ -182,7 +182,7 @@ class sdlHandler(QObject):
def active_tc(self):
''' Yield list of TCs that can be sent (including timeouts) '''
# Find the list of allowed TC based on the current state
curr_state = self.current_sdl_state.replace(UNICODE_SEP, '_').lower()
curr_state = self.current_sdl_state.replace(UNICODE_SEP, '.').lower()
try:
inputs = self.proc.mapping[curr_state]
except KeyError:
......@@ -242,8 +242,9 @@ class sdlHandler(QObject):
# get the list of state aggregations
aggregates = opengeode.Helper.state_aggregations(context)
stnames = list(opengeode.Helper.statenames(context, sep=UNICODE_SEP))
stnames.extend(list(opengeode.Helper.rec_findstates(context)))
stnames = list(opengeode.Helper.statenames(context))
# model is flattened: no need to call rec_findstates
#stnames.extend(list(opengeode.Helper.rec_findstates(context)))
states = {'id': 'Current SDL state',
'type': 'ENUMERATED',
......@@ -479,7 +480,7 @@ class sdlHandler(QObject):
# Add the SDL state to the new global state, create a new hash, save it
state_row = self.tree_items['_states'].row()
new_sdl_state = self.asn1_editor.model.item(state_row, 3).text()
new_state.append(UnicodeName(new_sdl_state))
new_state.append(UnicodeName(new_sdl_state.upper()))
new_hash = hash(frozenset(new_state))
self.set_of_states[new_hash] = new_state
# Apply the change and create Undo command to restore previous state
......@@ -657,8 +658,8 @@ class sdlHandler(QObject):
break
self.click_tc(random_tc, arg)
# Send a message every 100 ms.. Should be configurable
QTimer().singleShot(100, self.random_step)
# Send a message every 500 ms.. Should be configurable
QTimer().singleShot(500, self.random_step)
def children_states(self):
''' Call all available interfaces with all possible values and yield
......
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