|
@@ -2,11 +2,7 @@ from sccd.runtime.statecharts_core import Event
|
|
|
import sccd.runtime.socket2event as socket2event
|
|
|
import modelverse_SCCD
|
|
|
import time
|
|
|
-
|
|
|
-controller = modelverse_SCCD.Controller()
|
|
|
-socket2event.boot_translation_service(controller)
|
|
|
-
|
|
|
-ID = 0
|
|
|
+import threading
|
|
|
|
|
|
# Exceptions
|
|
|
class ModelverseException(Exception):
|
|
@@ -77,6 +73,22 @@ def OUTPUT():
|
|
|
raise UnknownMetamodellingHierarchy()
|
|
|
|
|
|
def init(address_param="127.0.0.1:8001", timeout=20.0):
|
|
|
+ global controller
|
|
|
+ global ID
|
|
|
+ global responses
|
|
|
+
|
|
|
+ controller = modelverse_SCCD.Controller()
|
|
|
+ socket2event.boot_translation_service(controller)
|
|
|
+
|
|
|
+ ID = 0
|
|
|
+
|
|
|
+ thrd = threading.Thread(target=run_controller)
|
|
|
+ thrd.daemon = True
|
|
|
+ thrd.start()
|
|
|
+
|
|
|
+ responses = controller.addOutputListener("action_out")
|
|
|
+ controller.addOutputListener("ready").fetch(-1)
|
|
|
+
|
|
|
INPUT("init", None, [address_param, timeout])
|
|
|
return OUTPUT()
|
|
|
|
|
@@ -441,11 +453,3 @@ def process_execute(process_name, prefix, callbacks=None):
|
|
|
return None
|
|
|
|
|
|
# TODO monitor the new function and execute the correct callback
|
|
|
-
|
|
|
-import threading
|
|
|
-thrd = threading.Thread(target=run_controller)
|
|
|
-thrd.daemon = True
|
|
|
-thrd.start()
|
|
|
-
|
|
|
-responses = controller.addOutputListener("action_out")
|
|
|
-controller.addOutputListener("ready").fetch(-1)
|