mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-01 09:08:06 +00:00
32 lines
1002 B
Plaintext
32 lines
1002 B
Plaintext
|
|
Project title: "Annotation-based state machine definition for doubly nested switch-case implementations"
|
|
|
|
- goals: testability, documentation
|
|
- assumptions: fixed code stucture
|
|
- input: some code (.c)
|
|
- output: graphviz state machine ...
|
|
- documentation: BTstack Wiki page
|
|
- implementation: Python
|
|
- problems:
|
|
- implicit event like "can send packet now", =? deal with guards?
|
|
- "inverse handler" for "global" events
|
|
|
|
Example:
|
|
{
|
|
// @STATEMACHINE(multiplexer)
|
|
switch (multiplexer->state) { // detect state variable, count {
|
|
case W4_MULTIPLEXER: // implicit state
|
|
switch (event) { // events start here
|
|
case L2CAP_OPEN: // implicit event
|
|
// @ACTION(action description)
|
|
multiplexer->state = OTHER_STATE;
|
|
break; // break || return -> end case block
|
|
}
|
|
break;
|
|
case OTHER_STATE:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|