You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
943 B
44 lines
943 B
/*
|
|
* fsm.h
|
|
*
|
|
* Created on: 2025年7月14日
|
|
* Author: akeguo
|
|
*/
|
|
|
|
#ifndef FSM_INC_FSM_STATE_H_
|
|
#define FSM_INC_FSM_STATE_H_
|
|
#include "stdint.h"
|
|
#include <stddef.h>
|
|
|
|
|
|
struct _transition_t;
|
|
typedef struct _transition_t transition_t;
|
|
|
|
|
|
//抽象类,用于派生其他类 将事件处理方法包含在基类中
|
|
|
|
typedef struct _transition_state_t
|
|
{
|
|
|
|
void (*robotEnter)(transition_t* p_transition); //执行Enter 激活标志位
|
|
void (*robotRun)(transition_t* p_transition); //执行相关动作
|
|
void (*robotExit)(transition_t* p_transition); //执行Exit
|
|
int State; //状态
|
|
|
|
}transition_state_t;
|
|
|
|
|
|
|
|
typedef struct _transition_t {
|
|
transition_state_t* p_state;
|
|
}transition_t;
|
|
|
|
|
|
extern void fsm_state_set(transition_t* p_this, transition_state_t* p_new_state);
|
|
extern void fsm_state_run(transition_t* p_this);
|
|
|
|
extern void fsm_state_init(transition_t* p_this,transition_state_t* inti_state);
|
|
|
|
|
|
|
|
#endif /* FSM_INC_FSM_STATE_H_ */
|
|
|