#ifndef JSON_STRUCT_H #define JSON_STRUCT_H #include #include "smart_sound.h" #ifdef __cplusplus extern "C" { #endif #define MAX_MUSIC_UUID (256) #define MAX_MUSIC_URL (2048) typedef enum { //****************************************** // Player <--> Controller //****************************************** JSON_ENGINE_P2C = 0, JSON_ENGINE_C2P, //****************************************** // Configure Req & Rsp //****************************************** JSON_ENGINE_CFG_REQ, JSON_ENGINE_CFG_RSP, //****************************************** // Alarm Req & Rsp //****************************************** JSON_ENGINE_ASSISTANT_SYNC_RSP, JSON_ENGINE_ASSISTANT_NOTIFY, JSON_ENGINE_ASSISTANT_STATUS, JSON_ENGINE_ASSISTANT_RUNNING, //****************************************** // Work Day API Req & Rsp //****************************************** JSON_ENGINE_WORKDAY_REQ, //****************************************** // PING Cmd //****************************************** JSON_ENGINE_PING, //****************************************** // OTA Cmd //****************************************** JSON_ENGINE_OTA_REQ, JSON_ENGINE_OTA_RSP, //****************************************** // LOG System Configure Cmd //****************************************** JSON_ENGINE_LOG_CFG_CMD, //****************************************** // WIFI Status Changed Nofify Cmd //****************************************** JSON_WIFI_STATUS_NOTIFY, //****************************************** // mcu test Cmd //****************************************** JSON_MCU_GUIDE_TEST_CMD, JSON_MCU_MATRIX_TEST_CMD, JSON_MCU_TEST_GET_VER_CMD, JSON_ENGINE_MAX, } JSON_ENGINE_TYPE; typedef struct { uint32_t playerId; char musicUuid[MAX_MUSIC_UUID]; int plySt; uint32_t curPos; uint32_t duration; } PLAYER_TO_CTRL, *PPLAYER_TO_CTRL; typedef struct { uint32_t playerId; char src[MAX_MUSIC_URL]; char srcUuid[MAX_MUSIC_URL]; char ttsText[MAX_MUSIC_UUID * 2]; int skTime; int plyMode; int plyListType; char adSrcType; int duration; int volRestoreTime; char volBegin; float gain; char fifo[MAX_MUSIC_UUID]; char channel; char bytes; int sampleRate; char backGroundUrl[MAX_MUSIC_URL]; } CTRL_TO_PLAYER, *PCTRL_TO_PLAYER; typedef struct { char keyName[MAX_CFG_KEY_NAME]; char keyValue[MAX_CFG_KEY_VALUE]; int keyType; } CFG_API_REQ, *PCFG_API_REQ; typedef struct { int red; int green; int blue; } MCU_TEST_GUIDE_CMD, *PMCU_TEST_GUIDE_CMD; typedef struct { int level; } MCU_TEST_MATRIX_CMD, *PMCU_TEST_MATRIX_CMD; typedef struct { char McuVer[16]; } MCU_TEST_VER_CMD, *PMCU_TEST_VER_CMD; typedef struct { char keyName[MAX_CFG_KEY_NAME]; char keyValue[MAX_CFG_KEY_VALUE]; int keyType; int errNo; } CFG_API_RSP, *PCFG_API_RSP; typedef struct { double PING; int tmSec; int tmMSec; } PING_MSG, *PPING_MSG; void* Json2Struct(const char* pJsonStr, JSON_ENGINE_TYPE type, int enBase64, int* pErr); const char* Struct2Json(void* pStruct, JSON_ENGINE_TYPE type, int enBase64, int* pErr); #ifdef __cplusplus } #endif #endif