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.
 
 
 
 

72 lines
1.7 KiB

// Copyright 2017 Mobvoi Inc. All Rights Reserved.
// Author: ljliu@mobvoi.com (Lijie Liu)
#ifndef SDK_PIPELINE_MOBVOI_MSG_H_
#define SDK_PIPELINE_MOBVOI_MSG_H_
#ifdef __cplusplus
extern "C" {
#endif
#define SYNC_TAG "MOBV"
//#define MAX_MSG_LEN 128
#define MAX_MSG_LEN 128
//events from host system.
enum {
EVENT_FROM_HOST_GET_WAKEUP_WORD = 0x81,
EVENT_FROM_HOST_GET_DOA_DIR = 0x82,
EVENT_FROM_HOST_GET_BF_DIR_LIST = 0x83,
EVENT_FROM_HOST_GET_BF_STATUS = 0x84,
EVENT_FROM_HOST_SET_BF_DIR = 0x85,
EVENT_FROM_HOST_ENABLE_BF = 0x86,
EVENT_FROM_HOST_DISABLE_BF = 0x87,
EVENT_FROM_HOST_INIT_DSP = 0x88,
EVENT_FROM_HOST_SET_LED = 0x89,
};
//events to host system.
enum {
EVENT_TO_HOST_WAKEUP = 0x01,
EVENT_TO_HOST_WAKEUP_WORDS = 0x02,
EVENT_TO_HOST_DOA_DIR = 0x03,
EVENT_TO_HOST_BF_DIR_LIST = 0x04,
EVENT_TO_HOST_BF_STATUS = 0x05,
};
typedef struct {
unsigned char sync_tag[4];
unsigned char event;
unsigned char check_bits:1;
unsigned char reserved:7;
unsigned short payload_len;
unsigned char payload_data[0];
} mob_gs_msg;
// Little-Endian functions
static inline int mob_bytes2int(const char* buf)
{
return (int)(buf[0] | buf[1] << 8 | buf[2] << 16 | buf[3] << 24);
}
static inline short mob_bytes2short(const char* buf)
{
return (short)(buf[0] | buf[1] << 8);
}
static inline void mob_int2bytes(int src, char* buf)
{
buf[0] = src & 0xFF;
buf[1] = (src >> 8) & 0xFF;
buf[2] = (src >> 16) & 0xFF;
buf[3] = (src >> 24) & 0xFF;
}
static inline void mob_short2bytes(short src, char* buf)
{
buf[0] = src & 0xFF;
buf[1] = (src >> 8) & 0xFF;
}
#ifdef __cplusplus
}
#endif
#endif // SDK_PIPELINE_MOBVOI_MSG_H_