Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
asn1-value-editor
Commits
8ed31b01
Commit
8ed31b01
authored
Aug 20, 2016
by
Maxime Perrotin
Browse files
SDL simulator: handle continuous signals
parent
15cac722
Changes
1
Hide whitespace changes
Inline
Side-by-side
asn1_value_editor/sdlHandler.py
View file @
8ed31b01
...
...
@@ -816,6 +816,27 @@ class sdlHandler(QObject):
self
.
add_to_msc
(
'in'
,
tm_name
)
self
.
log_area
.
addItem
(
'Received event "{}"'
.
format
(
tm_name
))
def
check_queue
(
self
,
res
):
''' Callback function invoked by OG-generated code to check if there
is a pending message in the input queue of the state machine. Used
to let the user decide if continuous signals shall be processed '''
# res is of type ctypes.POINTER(c_int) -> res[0]=0 to set False,
# meaning that there is no message pending in the queue
question
=
QMessageBox
(
self
.
parent
,
'Evaluate Continuous States'
,
''
)
question
.
setText
(
'Do you want to send a new message'
' or evaluate continuous signals (default)?'
)
question
.
addButton
(
'Send message'
,
QMessageBox
.
AcceptRole
)
question
.
addButton
(
'Evaluate continuous signals'
,
QMessageBox
.
RejectRole
)
ans
=
question
.
exec_
()
if
ans
==
QMessageBox
.
AcceptRole
:
res
[
0
]
=
1
else
:
res
[
0
]
=
0
def
external_proc_handler
(
self
,
name
,
*
args
):
''' Callback function when an external procedure is invoked
Parameters: name is the name of the external procedure, and
...
...
@@ -832,7 +853,7 @@ class sdlHandler(QObject):
# Create native ASN.1 type
typename
=
spec
[
'type'
].
ReferencedTypeName
.
replace
(
'-'
,
'_'
)
asn1_instance
=
getattr
(
ASN1
,
typename
)(
ptr
=
val
)
# Input parameters: copy the content in the ASN.1
Swig typ
e
# Input parameters: copy the content in the ASN.1
instanc
e
if
spec
[
'direction'
]
==
'in'
:
interface
[
'in'
].
append
((
spec
,
asn1_instance
))
else
:
...
...
@@ -867,8 +888,7 @@ class sdlHandler(QObject):
for
_
,
_
,
asn1_instance
in
interface
[
'out'
]:
outp
.
append
(
asn1_instance
.
GSER
())
del
(
asn1_instance
)
call_str
=
u
'{}({})'
.
format
(
name
,
', '
.
join
(
chain
(
inp
,
outp
)))
call_str
=
u
'{}({})'
.
format
(
name
,
', '
.
join
(
chain
(
inp
,
outp
)))
self
.
add_to_msc
(
'procedure_call'
,
call_str
)
self
.
log_area
.
addItem
(
'Call to {}'
.
format
(
call_str
))
...
...
@@ -1010,7 +1030,11 @@ class sdlHandler(QObject):
register_func
=
getattr
(
self
.
dll
,
"register_{}"
.
format
(
each
.
inputString
))
register_func
(
self
.
proc_handlers
[
each
.
inputString
.
lower
()][
0
])
# Register the Check_Queue function
func
=
ctypes
.
CFUNCTYPE
(
None
,
ctypes
.
POINTER
(
ctypes
.
c_int
))
register_func
=
getattr
(
self
.
dll
,
"register_check_queue"
)
self
.
check_queue_callback
=
func
(
self
.
check_queue
)
register_func
(
self
.
check_queue_callback
)
def
init_timers
(
self
):
''' When loading the DLL, initialize timers/set callbacks, etc '''
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment