#include "fsm.h"
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
Defines | |
#define | E(name) case EV_##name: return "EV_" #name; |
Functions | |
const char * | fsm_common_event_str (fsm_event ev) |
int | fsm_nop_state (struct robo_fsm *fsm) |
Non operative state, do nothing. | |
void | __fsm_timespec_add_ms (struct timespec *ts, struct timespec *now, long ms) |
Set timespec to some time from now. | |
void | __fsm_timespec_invalidate (struct timespec *ts) |
int | __fsm_timespec_cmp (struct timespec *ts1, struct timespec *ts2) |
void | __fsm_timer_stop (struct robo_fsm *fsm) |
bool | is_there_event_for_us (struct robo_fsm *fsm) |
void | fsm_main_loop (struct fsm_main_loop *loop) |
FSM main event loop. | |
void | fsm_main_loop_init (struct fsm_main_loop *loop) |
Initializes main loop. | |
void | fsm_init (struct robo_fsm *fsm, char *debug_name, struct fsm_main_loop *loop) |
FSM initialization. | |
int | fsm_start (struct fsm_main_loop *loop, pthread_attr_t *attr) |
Starts previously initialized FSM main loop in a separate thread. | |
void | fsm_exit (struct robo_fsm *fsm) |
Signals FSM to exit. | |
void | fsm_destroy (struct robo_fsm *fsm) |
Deallocates all resources allocated by fsm_init(). |
#define E | ( | name | ) | case EV_##name: return "EV_" #name; |
void __fsm_timer_stop | ( | struct robo_fsm * | fsm | ) |
void __fsm_timespec_add_ms | ( | struct timespec * | ts, | |
struct timespec * | now, | |||
long | ms | |||
) |
Set timespec to some time from now.
[out] | ts | Result |
[in] | now | Actual time or NULL. If NULL, actual time is determined by calling gettimeofday(). |
[in] | ms | number of milliseconds to be set |
int __fsm_timespec_cmp | ( | struct timespec * | ts1, | |
struct timespec * | ts2 | |||
) | [inline] |
void __fsm_timespec_invalidate | ( | struct timespec * | ts | ) | [inline] |
const char* fsm_common_event_str | ( | fsm_event | ev | ) |
void fsm_main_loop | ( | struct fsm_main_loop * | loop | ) |
FSM main event loop.
Dispatches FSM events and calls appropriate state functions.
loop | Specifies which FSMs are handled by this main loop. |
void fsm_main_loop_init | ( | struct fsm_main_loop * | loop | ) |
Initializes main loop.
loop |
int fsm_nop_state | ( | struct robo_fsm * | fsm | ) |
Non operative state, do nothing.
bool is_there_event_for_us | ( | struct robo_fsm * | fsm | ) |