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

Dynamic state machine + Controller #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

EdDev
Copy link
Owner

@EdDev EdDev commented Nov 16, 2014

No description provided.

A State Machine implementation with configurable state transitions.
It maintains state decoupling, allowing it to scale and support multiple setups.

Setup/Definition logic:
- Create a State Machine.
- Create states.
- Set the SM initial state.
- Set the SM default behavior: Action to take if no map is found.
  (NULL specifies to remain in the same state)
- Map State & Result to the next State. (state, result, nextState)
  Receiving an event wile in state, triggers a state operation, resulting in a StateResult.
  SM State is changed to the nextState based on the result.

Operation:
- Usually called from a controller that receives events in an asynchronous mode.
  Usage example:
  State *state = sm->getCurrentState();
  sm->execEvent(state->evExist());
  // At this stage sm->getCurrentState() will return a new state.
The controller is serving the cards (devices) by providing them means
to register to the controller with their SM and giving each a unique id for communication.

regCard() is used for card registration.
run() is used for running the controller, usually in it's own task in an endless loop,
blocking on recv messages.
An UML and a README file have been added.
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

Successfully merging this pull request may close these issues.

1 participant