move dir
This commit is contained in:
50
mw/has_task_msg_manager/has_task_msg.h
Normal file
50
mw/has_task_msg_manager/has_task_msg.h
Normal file
@@ -0,0 +1,50 @@
|
||||
#ifndef HAS_TASK_MSG_H
|
||||
#define HAS_TASK_MSG_H
|
||||
|
||||
|
||||
/* 静态订阅表 */
|
||||
// TODO:后续可支持动态增加模块订阅,感觉目前没必要
|
||||
|
||||
typedef enum {
|
||||
INVALID_ID = 0,
|
||||
GUI,
|
||||
SENSOR,
|
||||
ACM,
|
||||
WIFI,
|
||||
VOICE,
|
||||
MODULE_MAX
|
||||
} has_module_ID_e;
|
||||
|
||||
/* 模块 订阅数量 订阅模块 */
|
||||
/* 模块 和 订阅数量一定要写,完全不加入表中的模块,或订阅数量为0的模块无法接收消息 */
|
||||
#define SUBSCIBE_INFO \
|
||||
{ \
|
||||
{GUI, 2, {ACM, VOICE}}, \
|
||||
{SENSOR, 1, {ACM}}, \
|
||||
{ACM, 1, {WIFI}}, \
|
||||
{WIFI, 0}, \
|
||||
{VOICE, 3, {ACM, VOICE, GUI}}, \
|
||||
}
|
||||
|
||||
/* 消息处理回调 */
|
||||
typedef int (*has_msg_handle_cb)(unsigned char module_id, const unsigned char *buf, unsigned int len);
|
||||
|
||||
/* 基础功能 */
|
||||
int has_msg_init(void);
|
||||
int has_msg_publish(has_module_ID_e module_id, void *buffer, unsigned int length);
|
||||
int has_msg_handle(has_module_ID_e module_id, has_msg_handle_cb cb);
|
||||
|
||||
unsigned int has_msg_is_message_empty(has_module_ID_e module_id);
|
||||
unsigned int has_msg_get_message_number(has_module_ID_e module_id);
|
||||
int has_msg_delete_all_message(has_module_ID_e module_id);
|
||||
|
||||
/* 扩展功能 */
|
||||
int has_msg_handle_by_module(has_module_ID_e module_id, has_msg_handle_cb cb, has_module_ID_e pub_module_id);
|
||||
int has_msg_handle_latest(has_module_ID_e module_id, has_msg_handle_cb cb);
|
||||
unsigned int has_msg_receive(has_module_ID_e module_id, unsigned char *pub_module_id, unsigned char *buf_out);
|
||||
unsigned int has_msg_receive_latest(has_module_ID_e module_id, unsigned char *pub_module_id, unsigned char *buf_out);
|
||||
int has_msg_printf_subscribe(has_module_ID_e module_id);
|
||||
// int has_msg_subscribe(has_module_ID_e module_id, has_module_ID_e sub_id);
|
||||
// int has_msg_unsubscribe(has_module_ID_e module_id, has_module_ID_e sub_id);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user