Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with output Exception and output with callback on statemachine #90

Open
Cheprod opened this issue Mar 7, 2018 · 0 comments
Open

Comments

@Cheprod
Copy link

Cheprod commented Mar 7, 2018

I’m actually working on library evaluation for state machine and I’m very interesting in what Automat do. To resume, I develop a module to manage small process like Bluetooth communication with a remote sensor.

Automat can help me, in the future, to manage the state machine associate with the process (for example, Remote sensor stopped, remote sensor ready to measure, remote sensor measuring, …)

However, I have some difficulties to find some support (forum or mailing list), it’s why I write an issue on GitHub..

My questions about Automat :

  1. Let’s imagine that :
  • The inputs are done by the user through a GUI (connect to the remote sensor, start remote sensor, start measurements, etc…)
  • We have an output class RemoteSensor to manage the communication with the remote sensor
  1. How is it plan to manage Exception ?
  • For example, the user trigger the input “Connect to the remote sensor”. The associate output method “connect” of RemoteSensor class does the job by opening the connection. If the establishment of the connection fails (ie. Exception throw), I don’t want to go in the next state which is “Remote sensor stopped”. Is there any way to do that ?
  1. Is it possible (and logical) to have an output class which does input too ?
  • For example, my RemoteSensor class manage the connection with the remote sensor. The user triggers the input “Start measurements” through the GUI , so the output method “startMeasurement” of RemoteSensor Class sends the order to the remote sensor to start measuring. The state machine goes into “Remote Sensor Measuring” state. Now, I had to wait until the measuring process finish. This information is gotten from the remote sensor by asking it each second. I want the RemoteSensor class manage this task. However, I don’t know if the design pattern is correct.
    • What I imagine : create a second output in the state machine call “waitForEndingMeasurements” which call a specific method of the RemoteSensor class with a call back to the state machine input
  1. Have you plan something to do automatic GUI (web based if possible) ?
  • I plug Automat with twisted http server and return JSON state machine description with possible states, current state and inputs available function of current state to product HTML5 GUI to :
    • Display information,
    • Allow the user to make inputs
  • In the future, maybe I will associate it with the graphviz svg export of the state machine.

I’m ready to contribute to the project if necessary.

Thanks a lot for your help.

Thibaud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant