2023-08-21 14:22:41 +08:00
|
|
|
|
#ifndef _DMS_MQ_H_
|
|
|
|
|
|
#define _DMS_MQ_H_
|
|
|
|
|
|
|
2023-11-15 16:19:48 +08:00
|
|
|
|
#define MAX_MQBLK_NO 5
|
|
|
|
|
|
|
2023-11-21 13:39:28 +08:00
|
|
|
|
#include <cstdint>
|
|
|
|
|
|
|
2023-08-21 14:22:41 +08:00
|
|
|
|
enum{
|
|
|
|
|
|
MQERR_DISCONNECT = -1,
|
|
|
|
|
|
MQERR_FULL = -2,
|
|
|
|
|
|
MQERR_NOMSGID = -3,
|
|
|
|
|
|
MQERR_MSGCTL_FAILED = -4,
|
|
|
|
|
|
MQERR_BLOCKED = -5,
|
|
|
|
|
|
MQERR_LOSTMSG = -6,
|
|
|
|
|
|
MQERR_PACKERR = -7,
|
|
|
|
|
|
MQERR_THDERR = -8,
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2023-11-15 16:19:48 +08:00
|
|
|
|
//初始化DMS的MQ序列 with_debug = 0, 不启用MQ的Debug日志, 1 启用MQ的debug日志
|
|
|
|
|
|
int dmsmq_init( int with_debug );
|
2023-08-21 14:22:41 +08:00
|
|
|
|
|
|
|
|
|
|
//接收DMS的MQ序列,阻塞方式。
|
|
|
|
|
|
// srvid 服务ID
|
|
|
|
|
|
// actid 动作ID
|
|
|
|
|
|
// data 数据指针
|
|
|
|
|
|
// 返回值 >= 0 数据长度, < 0 异常信息
|
|
|
|
|
|
int dmsmq_recv( int *srvid, int *actid, uint8_t *data );
|
|
|
|
|
|
|
|
|
|
|
|
// 发送DMS的MQ序列,立即返回。
|
|
|
|
|
|
// srvid 服务ID
|
|
|
|
|
|
// actid 动作ID
|
|
|
|
|
|
// data 发送数据指针
|
|
|
|
|
|
// len 发送数据长度
|
|
|
|
|
|
// 返回值 0 成功,< 0 异常信息
|
|
|
|
|
|
int dmsmq_send( int srvid, int actid, uint8_t *data, int len );
|
2023-09-04 13:35:24 +08:00
|
|
|
|
int dmsmq_sendx( int srvid, int actid, uint8_t *data, int len );
|
2023-11-21 13:39:28 +08:00
|
|
|
|
#endif
|