50 lines
1.3 KiB
C++
50 lines
1.3 KiB
C++
#ifndef MESSAGE_QUEUE_H
|
|
#define MESSAGE_QUEUE_H
|
|
#include "SfTypeDefine.h"
|
|
constexpr int QUEUE_BUF_LENGTH = 256;
|
|
constexpr signed int CMD_SERIES_FIX = 0xFF00;
|
|
typedef struct sf_MESSAGE_Buf_S
|
|
{
|
|
long mtype;
|
|
SINT32 cmdId;
|
|
SINT32 s32Wait;
|
|
SINT32 paramLen;
|
|
SINT8 paramBuf[QUEUE_BUF_LENGTH];
|
|
} SF_MESSAGE_BUF_S;
|
|
typedef enum sf_MESSAGE_TYPE_E
|
|
{
|
|
CMD_KEY = 0x1A00,
|
|
CMD_SD = 0x1B00,
|
|
CMD_LED = 0x1C00,
|
|
CMD_FILE = 0x1D00,
|
|
CMD_POWEROFF = 0x1E00,
|
|
CMD_VENC = 0x1F00,
|
|
} SF_MESSAGE_TYPE_E;
|
|
typedef enum sf_MESSAGE_CMD_SD_e
|
|
{
|
|
// CMD_SD_MOUNT_SUCCESS = 0x01,
|
|
// CMD_SD_ERROR = 0x02,
|
|
// CMD_SD_OUT = 0x03,
|
|
// CMD_SD_FULL = 0x04,
|
|
// CMD_SD_MOUNT_FAILURE = 0x05,
|
|
CMD_SD_MOUNT_SUCCESS = 0x01 | CMD_SD,
|
|
CMD_SD_ERROR = 0x02 | CMD_SD,
|
|
CMD_SD_OUT = 0x03 | CMD_SD,
|
|
CMD_SD_FULL = 0x04 | CMD_SD,
|
|
CMD_SF_SD_FORMAT = 0x05 | CMD_SD,
|
|
} SF_MESSAGE_CMD_SD_E;
|
|
constexpr int PATH_NAME_LENGTH = 256;
|
|
class MessageQueue
|
|
{
|
|
public:
|
|
MessageQueue(const SF_CHAR *path);
|
|
virtual ~MessageQueue() = default;
|
|
SINT32 MessageQueueCreate(void);
|
|
SINT32 MessageQueueRecv(SF_MESSAGE_BUF_S *pMessageBuf);
|
|
SINT32 MessageQueueSend(SF_MESSAGE_BUF_S *pMessageBuf);
|
|
|
|
private:
|
|
SINT32 pMsgQueueId;
|
|
const SF_CHAR *pathname;
|
|
};
|
|
#endif // !MESSAGE_QUEUE_H
|