This is API for Sate machine.
More...
Go to the source code of this file.
This is API for Sate machine.
Definition in file state_machine.h.
◆ state_event_info_t
◆ state_machine_info_t
◆ StateMachine
◆ StateMachineInfo
◆ state_machine_call_event()
int state_machine_call_event |
( |
StateMachineInfo |
this, |
|
|
int |
event, |
|
|
void * |
arg, |
|
|
int |
arglen, |
|
|
void(*)(int result) |
response |
|
) |
| |
call event trigger
- Parameters
-
[in] | this | StateMachineInfo class instance returned at state_machine_new |
[in] | event | event id related to this function |
[in] | arg | event argument |
[in] | arglen | event argument len |
[in] | response | response callback method. If you set is_multithread=true , you must set this response callback, |
- Return values
-
return_value | of method if you set by single thread mode |
STATE_MNG_SUCCESS | and result is in callback you set callback if you set by multi thread mode. |
Definition at line 413 of file state_machine.c.
◆ state_machine_free()
free StateMachine class
- Parameters
-
[in] | this | StateMachine class instance returned at state_machine_new |
- Returns
- none
Definition at line 438 of file state_machine.c.
◆ state_machine_get_current_state()
get state
- Parameters
-
[in] | this | StateMachineInfo class instance returned at state_machine_new |
- Returns
- state
Definition at line 402 of file state_machine.c.
◆ state_machine_new()
Create StateMachineInfo class.
- Parameters
-
[in] | event_num | event size |
[in] | event_infos | list of event state data |
[in] | threadpool | event threadpool instance by creating event_threadpool API if you want to use state machine in other threads |
- Return values
-
!=NULL | this class handle |
NULL | error |
Definition at line 313 of file state_machine.c.
◆ state_machine_set_state()
set state
- Parameters
-
[in] | this | StateMachineInfo class instance returned at state_machine_new |
[in] | state | update state, if there is no state in set list, state is changed to latest order. |
- Returns
- none
Definition at line 388 of file state_machine.c.
◆ state_machine_show()
set state
- Parameters
-
[in] | this | StateMachine class instance returned at state_machine_new |
- Returns
- none
Definition at line 425 of file state_machine.c.
◆ state_machine_update_machine()
update sate
- Parameters
-
[in] | this | StateMachineInfo class instance returned at state_machine_new |
[in] | event_info | update list of event state data. |
- Return values
-
STATE_MNG_SUCCESS | success |
other | failed |
Definition at line 360 of file state_machine.c.