1 Star 0 Fork 1

pengrui_2009/tdcmsg

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
message.hpp 5.01 KB
一键复制 编辑 原始数据 按行查看 历史
pengrui_2009 提交于 2018-12-06 19:09 +08:00 . 1.modify some feature.
#ifndef _MESSAGE_HPP_
#define _MESSAGE_HPP_
#include "list.h"
#include "base.hpp"
enum {
MSG_TIME, //time message
MSG_DSRC_RECV_DATA, //DSRC recv data message
MSG_DSRC_SEND_DATA, //DSRC send data message
MSG_RTK_GPS_DATA, //RTK GPS data message
MSG_RTK_DATA_FRAME, //RTK handle frame
MSG_ANTLET_RECV_DATA, //Antlet recv data message
MSG_ANTLET_SEND_DATA, //Anelet send data message
MSG_MICROMOVE_STATE, //micro move recv data message
MSG_MICROMOVE_DATA, //micro move send data message
MSG_GPS_DATA, //GPS data message
MSG_GPS_FIXED, //GPS fix position message
MSG_GPS_LOST, //GPS lose position message
MSG_GPS_POS, //GPS position message
MSG_SETTIME, //
MSG_KEY, //
MSG_SKEY, //
MSG_DIN, //
MSG_PULSE, //
MSG_PARA, //
MSG_POWER, //
MSG_IPC_STATE, //
MSG_IPC_DATA, //
MSG_DEVICE_DATA_NET, //network data message
MSG_DEVICE_STATE_NET, //network status message
MSG_DEVICE_DATA_GPRS, //GPRS
MSG_DEVICE_STATE_GPRS, //GPRS
MSG_DEVICE_SMSDATA_GPRS, //GPRS
MSG_DEVICE_SMSSTATE_GPRS, //GPRS
MSG_DEVICE_LINKDATA_GPRS, //GPRS
MSG_DEVICE_DATA_0, //0#
MSG_DEVICE_DATA_1, //1#
MSG_DEVICE_DATA_2, //2#
MSG_DEVICE_DATA_3, //3#
MSG_DEVICE_DATA_4, //4#
MSG_DEVICE_DATA_5, //5#
MSG_DEVICE_DATA_6, //6#
MSG_DEVICE_DATA_7, //7#
MSG_DEVICE_DATA_8, //8#
MSG_DEVICE_DATA_9, //8#
MSG_DEVICE_DATA_USBD, //USB device message
MSG_DEVICE_STATE_MCU, //MCU Read sate
MSG_DEVICE_STATE_FTP, //FTP update state message
MSG_DEVICE_CONNECT_FTP, //FTP connect state message
MSG_SIGNAL_LIGHT_DATA, //signal light data
MSG_FRAMEWORK_LAST //module message define begin
};
/*************************************************
structs define
*************************************************/
typedef struct
{
struct list_head list;
BASE *obj;
} sub_node_t;
/*************************************************
global static variable
*************************************************/
typedef struct
{
pthread_mutex_t mutex;
struct list_head list_busy; //message busy list·
struct list_head list_idle; //message idle list·
sub_node_t nodepool[CFG_MESSAGE_SUBSCRIBE_MAX];
} subinfo_st;
class message
{
public:
static subinfo_st subinfo[CFG_MESSAGE_TYPE_MAX];
// message();
// ~message();
/******************************************************************************
* Function: message_init
* Description: init message
* Param:
* Return: 0 - success
-ERR_SYS - message has been inited
-ERR_BUSY - module opend
* Comment: this muest be call in the frameworkinit func
******************************************************************************/
static int message_init (void);
/******************************************************************************
* Function: message_subscribe
* Description: subscribe message
* Param: obj - base object
type - message type
* Return: 0 - success
-ERR_SYS - system error
-ERR_INVAL - invalid param
-ERR_NOMEM - no memory
* Comment:
******************************************************************************/
static int message_subscribe (BASE *obj, u16 type);
/******************************************************************************
* Function: message_unsubscribe
* Description: unsubscribe message
* Param: obj - base object
type - message type
* Return: 0 - success
-ERR_SYS - system error
-ERR_INVAL - invald param
-ERR_NORECORD - no record
* Comment:
******************************************************************************/
static int message_unsubscribe (BASE *obj, u16 type);
/******************************************************************************
* Function: message_dispatch
* Description: publish message
* Param: msg - msg info
* Return: 0 - success
-ERR_SYS - system error
-ERR_INVAL - invalid param
-ERR_NOMEM - no memory
* Comment:
******************************************************************************/
static int message_dispatch (message_t *msg);
};
#endif/* _MESSAGE_HPP_ */
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/pengrui2009/tdcmsg.git
git@gitee.com:pengrui2009/tdcmsg.git
pengrui2009
tdcmsg
tdcmsg
master

搜索帮助