registering c++ functions into scxml ecmascript to be used from the state machine js code



  • Hi, I'm working on a project which makes use of scxml to represent a state machine and listens to mqtt channels to receive events which will change states. Is it somehow possible to register a function which listens to the mqtt channel into ecmascript like you can do with qtscript so I can use it from the state machine ? I searched through the examples but I couldn't find any examples of what I want to accomplish.

    Thanks for your time.



  • @nurettin what about using a QMqttClient instead of javascript? You can subscribe to topics and react to its messageReceived() signal. I guess that depending on the topic/message received you could go on and update the state machine accordingly



  • @Pablo-J.-Rogina That is a good idea, but I would like to upload any generic scxml + js pair to my program and run the logic without writing any additional c++ code except the pub/sub calls. I got a hint on stackoverflow that I may register QML functions into scxml ecmascript model, so the problem may be solved already.



  • @nurettin I see, gettting the scxml + js outside the application seems more versatile

    I got a hint on stackoverflow

    Could it be possible you provide a link to such Q&A for anybody interested? Thanks


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.