Skip to content

alexzhornyak/QtScxmlMonitor

Repository files navigation

SCXML Wiki Forum

This project is a set of header-only files that help you to monitor your SCXML state machine written in Qt. Monitor events could be watched in ScxmlEditor with pause-resume and breakpoints options.

Qt SCXML Debug Via SVG

It was an old dream to monitor state machine workflow without any external dependencies in Qt and finally it comes true. We prepared some native SCXML SVG monitors:

StopWatchDemo

Since ScxmlEditor 2.2.1 you can export SCXML to SVG, include only monitor headers in your app and create monitor instances any time.

NOTICE: While state machine pointer is not set, the monitor does nothing and can be left in Release.

Qt SCXML External Debugging Monitor

Native QtCreator's scxml designer does not allow user to debug SCXML statecharts and observe statemachine work flow, so we offer to use ScxmlEditor as an instrument for debugging complex SCXML state charts

Description

We implemented Qt SCXML monitor in a single header ScxmlExternMonitor2.h as UDPScxmlExternMonitor. It has public a property QScxmlStateMachine *scxmlStateMachine. While scxmlStateMachine is not assigned it does nothing and you may leave it even in a release versions of your applications. When you need to observe statemachine work flow, just assign a valid QScxmlStateMachine pointer to the property, and monitor will start send UDP debug packages to the ScxmlEditor. And you will be able to observe when state is entered and when is exited, etc.

example_debug

1. Usage in QML

1.1. Option 1. From inherited state machine object

opt1

1.2. Option 2. From QML object

Monitor registration

opt2

Usage in QML

opt2_2

2. Usage in C++ Qt Widgets

cppOpt

3. Import active states configuration

There is an option to export and import active states configuration. It may be useful when you are unable to use a remote debugger. You can export active states configuration to file and open it later with ScxmlEditor Import states configuration menu option.

Let's take a look at a simple example.

Suppose that your deployed application does not work properly on the remote device.

  • You can implement calling IScxmlExternMonitor method QStringList dumpAllActiveStates() into your application. And it will save active states configuration by demand. ImportStatesConfiguration_MenuDump

  • Later you can transfer dump file to your working place

  • Open the corresponding project with ScxmlEditor

  • Call menu Import states configuration ImportStatesConfiguration

  • Select dump file in dialog ImportStatesConfiguration_Dialog

  • Analyze active states ImportStatesConfiguration_Highlight

TOP SCXML Wiki Forum