Files
Cluster/clusterApp/include/Protocol/Cdu_TCP_App.h
2026-04-17 18:49:03 +08:00

571 lines
14 KiB
C

#ifndef CDU_TCP_APP_H_INCLUDED
#define CDU_TCP_APP_H_INCLUDED
#include <Protocol/Cdu_TCP.h>
#define MAX_NAV_REMAIN_DIST1_LENGTH 32
#define MAX_NAV_REMAIN_TIME1_LENGTH 40
#define MAX_NAV_CURR_ROAD_NAME_LENGTH 32
#define MAX_NAV_NEXT_ROAD_NAME_LENGTH 32
typedef struct Struct_JsonNav
{
Int08 RemainDis1[MAX_NAV_REMAIN_DIST1_LENGTH];
Int08 RemainTime1[MAX_NAV_REMAIN_TIME1_LENGTH];
Int08 CurrRoadName[MAX_NAV_CURR_ROAD_NAME_LENGTH];
Int08 NextRoadName[MAX_NAV_NEXT_ROAD_NAME_LENGTH];
UInt08 UpdRemainInfo1;
UInt08 UpdCurrRoadName;
UInt08 UpdNextRoadName;
UInt08 NavIcon;
UInt08 Enable;
UInt08 CameraType;
UInt08 CameraSpeed;
UInt08 LimitedSpeed;
Int32 RoadRemainDis;
} JsonNav;
#ifndef INIT_JsonNav
#define INIT_JsonNav(nav) do{\
(nav).RemainDis1[0] = 0;\
(nav).RemainTime1[0] = 0;\
(nav).CurrRoadName[0] = 0;\
(nav).NextRoadName[0] = 0;\
(nav).UpdRemainInfo1 = 0;\
(nav).UpdCurrRoadName = 0;\
(nav).UpdNextRoadName = 0;\
(nav).NavIcon = 0;\
(nav).Enable = 0;\
(nav).CameraType = 0;\
(nav).CameraSpeed = 0;\
(nav).LimitedSpeed = 0;\
(nav).RoadRemainDis = 0;\
}while(0)
#endif // INIT_JsonNav
#ifndef DEINIT_JsonNav
#define DEINIT_JsonNav(nav) do{\
(nav).RemainDis1[0] = 0;\
(nav).RemainTime1[0] = 0;\
(nav).CurrRoadName[0] = 0;\
(nav).NextRoadName[0] = 0;\
(nav).UpdRemainInfo1++;\
(nav).UpdCurrRoadName++;\
(nav).UpdNextRoadName++;\
(nav).NavIcon = 0;\
(nav).Enable = 0;\
(nav).CameraType = 0;\
(nav).CameraSpeed = 0;\
(nav).LimitedSpeed = 0;\
(nav).RoadRemainDis = 0;\
}while(0)
#endif // DEINIT_JsonNav
#define MAX_COVER_WIDTH 500
#define MAX_COVER_HEIGHT 500
#define MAX_SONG_NAME_LENGTH 100
#define MAX_ARTIST_NAME_LENGTH 100
#define MAX_COVER_BMP_SIZE (MAX_COVER_WIDTH*MAX_COVER_HEIGHT*4)
typedef struct Struct_JsonMusic
{
Int08 SongName[MAX_SONG_NAME_LENGTH];
Int08 ArtistName[MAX_ARTIST_NAME_LENGTH];
UInt08 PicBmp[MAX_COVER_BMP_SIZE];
Int32 PicWidth;
Int32 PicHeight;
Int32 picFmt;
UInt32 Duration;
UInt32 Progress;
UInt16 PicHashCode;
UInt08 Status;
UInt08 Type;
UInt08 HasCover;
UInt08 Enable;
UInt08 UpdMusic;
} JsonMusic;
#ifndef INIT_JsonMusic
#define INIT_JsonMusic(msc) do{\
(msc).SongName[0] = 0;\
(msc).ArtistName[0] = 0;\
(msc).PicWidth = 0;\
(msc).PicHeight = 0;\
(msc).picFmt = 0;\
(msc).Duration = 100;\
(msc).Progress = 0;\
(msc).PicHashCode = 0;\
(msc).Type = 0;\
(msc).Status = PlayStatus_Stop;\
(msc).HasCover = INS_FALSE;\
(msc).Enable = INS_FALSE;\
(msc).UpdMusic = 0;\
}while(0)
#endif // INIT_JsonMusic
#ifndef DEINIT_JsonMusic
#define DEINIT_JsonMusic(msc) do{\
(msc).SongName[0] = 0;\
(msc).ArtistName[0] = 0;\
(msc).PicWidth = 0;\
(msc).PicHeight = 0;\
(msc).picFmt = 0;\
(msc).Duration = 100;\
(msc).Progress = 0;\
(msc).PicHashCode = 0;\
(msc).Type = 0;\
(msc).Status = PlayStatus_Stop;\
(msc).HasCover = INS_FALSE;\
(msc).Enable = INS_FALSE;\
(msc).UpdMusic++;\
}while(0)
#endif // DEINIT_JsonMusic
#define MAX_RADIO_SYS_NAME_LENGTH 4
#define MAX_RADIO_FREQ_NAME_LENGTH 12
#define MAX_RADIO_NAME_LENGTH 60
typedef struct Struct_JsonRadio
{
Int08 System[MAX_RADIO_SYS_NAME_LENGTH];
Int08 Frequency[MAX_RADIO_FREQ_NAME_LENGTH];
Int08 Name[MAX_RADIO_NAME_LENGTH];
UInt08 PicBmp[MAX_COVER_BMP_SIZE];
Int32 PicWidth;
Int32 PicHeight;
UInt32 picFmt;
UInt16 PicHashCode;
UInt08 Status;
UInt08 HasCover;
UInt08 Enable;
UInt08 UpdRadio;
} JsonRadio;
#ifndef INIT_JsonRadio
#define INIT_JsonRadio(rd) do{\
(rd).System[0] = 0;\
(rd).Frequency[0] = 0;\
(rd).Name[0] = 0;\
(rd).PicWidth = 0;\
(rd).PicHeight = 0;\
(rd).picFmt = 0;\
(rd).PicHashCode = 0;\
(rd).Status = PlayStatus_Stop;\
(rd).HasCover = INS_FALSE;\
(rd).Enable = INS_FALSE;\
(rd).UpdRadio = 0;\
}while(0)
#endif // INIT_JsonRadio
#ifndef DEINIT_JsonRadio
#define DEINIT_JsonRadio(rd) do{\
(rd).System[0] = 0;\
(rd).Frequency[0] = 0;\
(rd).Name[0] = 0;\
(rd).PicWidth = 0;\
(rd).PicHeight = 0;\
(rd).picFmt = 0;\
(rd).PicHashCode = 0;\
(rd).Status = PlayStatus_Stop;\
(rd).HasCover = INS_FALSE;\
(rd).Enable = INS_FALSE;\
(rd).UpdRadio++;\
}while(0)
#endif // DEINIT_JsonRadio
#define MAX_WETH_CITY_NAME_LENGTH 60
#define MAX_WETH_DATE_NAME_LENGTH 24
#define MAX_WETH_STATUS_NAME_LENGTH 60
#define MAX_WETH_ENV_NAME_LENGTH 12
typedef struct Struct_JsonWeather
{
Int08 City[MAX_WETH_CITY_NAME_LENGTH];
Int08 Date[MAX_WETH_DATE_NAME_LENGTH];
Int08 Status[MAX_WETH_STATUS_NAME_LENGTH];
Int08 Enviroment[MAX_WETH_ENV_NAME_LENGTH];
Int08 StatusId;
UInt08 Enable;
Int08 Tmp;
Int08 DayTmp;
Int08 NightTmp;
UInt08 UpdWth;
} JsonWeather;
#ifndef INIT_JsonWeather
#define INIT_JsonWeather(wt) do{\
(wt).City[0] = 0;\
(wt).Date[0] = 0;\
(wt).Status[0] = 0;\
(wt).Enviroment[0] = 0;\
(wt).StatusId = 0;\
(wt).Enable = 0;\
(wt).Tmp = 0;\
(wt).DayTmp = 0;\
(wt).NightTmp = 0;\
(wt).UpdWth = 0;\
}while(0)
#endif // INIT_JsonWeather
#ifndef DEINIT_JsonWeather
#define DEINIT_JsonWeather(wt) do{\
(wt).City[0] = 0;\
(wt).Date[0] = 0;\
(wt).Status[0] = 0;\
(wt).Enviroment[0] = 0;\
(wt).StatusId = 0;\
(wt).Tmp = 0;\
(wt).Enable = 0;\
(wt).DayTmp = 0;\
(wt).NightTmp = 0;\
(wt).UpdWth++;\
}while(0)
#endif // DEINIT_JsonWeather
#define MAX_ACCOUNT_NAME_LENGTH 60
typedef struct Struct_JsonAccount
{
Int08 CurrUsrName[MAX_ACCOUNT_NAME_LENGTH];
UInt32 UpdAccount;
UInt08 Enable;
} JsonAccount;
#ifndef INIT_JsonAccount
#define INIT_JsonAccount(ac) do{\
(ac).CurrUsrName[0] = 0;\
(ac).UpdAccount = 0;\
(ac).Enable = 0;\
}while(0)
#endif // INIT_JsonAccount
#ifndef DEINIT_JsonAccount
#define DEINIT_JsonAccount(ac) do{\
(ac).CurrUsrName[0] = 0;\
(ac).UpdAccount++;\
(ac).Enable = 0;\
}while(0)
#endif // DEINIT_JsonAccount
#define MAX_NETRADIO_FREQ_NAME_LENGTH 60
#define MAX_NETRADIO_NAME_LENGTH 60
typedef struct Struct_JsonNetRadio
{
Int08 Frequency[MAX_NETRADIO_FREQ_NAME_LENGTH];
Int08 Name[MAX_NETRADIO_NAME_LENGTH];
UInt08 PicBmp[MAX_COVER_BMP_SIZE];
Int32 PicWidth;
Int32 PicHeight;
UInt32 picFmt;
UInt32 Duration;
UInt32 Progress;
UInt16 PicHashCode;
UInt08 UpdNetRadio;
UInt08 Enable;
UInt08 HasCover;
UInt08 Type;
} JsonNetRadio;
#ifndef INIT_JsonNetRadio
#define INIT_JsonNetRadio(nr) do{\
(nr).Frequency[0] = 0;\
(nr).Name[0] = 0;\
(nr).PicWidth = 0;\
(nr).PicHeight = 0;\
(nr).picFmt = 0;\
(nr).Duration = 0;\
(nr).Progress = 0;\
(nr).PicHashCode = 0;\
(nr).UpdNetRadio = 0;\
(nr).Enable = 0;\
(nr).HasCover = INS_FALSE;\
(nr).Type = NRADIO_TYPE_NET;\
}while(0)
#endif // INIT_JsonNetRadio
#ifndef DEINIT_JsonNetRadio
#define DEINIT_JsonNetRadio(nr) do{\
(nr).Frequency[0] = 0;\
(nr).Name[0] = 0;\
(nr).PicWidth = 0;\
(nr).PicHeight = 0;\
(nr).picFmt = 0;\
(nr).Duration = 100;\
(nr).Progress = 60;\
(nr).PicHashCode = 0;\
(nr).UpdNetRadio++;\
(nr).Enable = 0;\
(nr).HasCover = INS_FALSE;\
(nr).Type = NRADIO_TYPE_NET;\
}while(0)
#endif // DEINIT_JsonNetRadio//NRADIO_TYPE_NET;
typedef struct Struct_JsonUpgrade
{
Int08 *Sign;
Int08 *Md5;
UInt08 UpdUpgrade;
Int16 SignSize;
UInt32 FileSize;
UInt32 RecvSize;
} JsonUpgrade;
#ifndef INIT_JsonUpgrade
#define INIT_JsonUpgrade(ug) do{\
(ug).Sign = NULL;\
(ug).Md5 = NULL;\
(ug).SignSize = 0;\
(ug).UpdUpgrade = 0;\
(ug).FileSize = 0;\
(ug).RecvSize = 0;\
}while(0)
#endif // INIT_JsonUpgrade
#ifndef DEINIT_JsonUpgrade
#define DEINIT_JsonUpgrade(ug) do{\
if(NULL != (ug).Sign)\
{\
free((ug).Sign);\
(ug).Sign = NULL;\
}\
if(NULL != (ug).Md5)\
{\
free((ug).Md5);\
(ug).Md5 = NULL;\
}\
(ug).SignSize = 0;\
(ug).UpdUpgrade++;\
(ug).FileSize = 0;\
(ug).RecvSize = 0;\
}while(0)
#endif // DEINIT_JsonUpgrade
#define MAX_CONTACT_INFO_NAME_LENGTH 100
#define MAX_CONTACT_INFO_NUMBER_LENGTH 20
#define MAX_BLUETOOTH_CTI_LIST_SIZE 32
typedef struct Struct_ContactInfo
{
Int08 Name[MAX_CONTACT_INFO_NAME_LENGTH];
Int08 Number[MAX_CONTACT_INFO_NUMBER_LENGTH];
} ContactInfo;
typedef struct Struct_JsonBlueTooth
{
UInt08 PhoneStatus;
UInt08 MuteStatus;
Int08 CtiListSize;
UInt08 UpdCtiList;
UInt08 UpdSpeaker;
UInt32 ConnectDuration;
Int08 Name[MAX_CONTACT_INFO_NAME_LENGTH];
Int08 Number[MAX_CONTACT_INFO_NUMBER_LENGTH];
ContactInfo CtiList[MAX_BLUETOOTH_CTI_LIST_SIZE];
} JsonBlueTooth;
#ifndef INIT_JsonBlueTooth
#define INIT_JsonBlueTooth(blt) do{\
(blt).Name[0] = 0;\
(blt).Number[0] = 0;\
(blt).PhoneStatus = PHONE_Unavailable;\
(blt).MuteStatus = 0;\
(blt).CtiListSize = -1;\
Int32 i;\
for(i = 0; i < MAX_BLUETOOTH_CTI_LIST_SIZE; i++)\
{\
(blt).CtiList[i].Name[0] = 0;\
(blt).CtiList[i].Number[0] = 0;\
}\
(blt).UpdCtiList = 0;\
(blt).UpdSpeaker = 0;\
(blt).ConnectDuration = 0;\
}while(0)
#endif // INIT_JsonBlueTooth
#ifndef DEINIT_JsonBlueTooth
#define DEINIT_JsonBlueTooth(blt) do{\
(blt).Name[0] = 0;\
(blt).Number[0] = 0;\
Int32 i;\
for(i = 0; i < MAX_BLUETOOTH_CTI_LIST_SIZE; i++)\
{\
(blt).CtiList[i].Name[0] = 0;\
(blt).CtiList[i].Number[0] = 0;\
}\
(blt).PhoneStatus = PHONE_Unavailable;\
(blt).MuteStatus = 0;\
(blt).CtiListSize = -1;\
(blt).UpdCtiList++;\
(blt).UpdSpeaker++;\
(blt).ConnectDuration = 0;\
}while(0)
#endif // DEINIT_JsonBlueTooth ,PHONE_InCall,PHONE_OutCall,PHONE_Connect,PHONE_Cancel_InCall,PHONE_Cancel_OutCall,PHONE_List,
typedef struct Struct_ReqBlueTooth
{
Int08 Name[MAX_CONTACT_INFO_NAME_LENGTH];
Int08 Number[MAX_CONTACT_INFO_NUMBER_LENGTH];
Int08 Status;
Int08 Action;
} ReqBlueTooth;
#ifndef INIT_ReqBlueTooth
#define INIT_ReqBlueTooth(req) do{\
(req).Name[0] = 0;\
(req).Number[0] = 0;\
(req).Status = 0;\
(req).Action = 0;\
}while(0)
#endif // INIT_ReqBlueTooth
#ifndef DEINIT_ReqBlueTooth
#define DEINIT_ReqBlueTooth(req) do{\
(req).Name[0] = 0;\
(req).Number[0] = 0;\
(req).Status = 0;\
(req).Action = 0;\
}while(0)
#endif // DEINIT_ReqBlueTooth
enum
{
CduRecord_Listening = 1,
CduRecord_Recognizing = 2,
CduRecord_Speaking = 3,
CduRecord_Exit = 4,
CduRecord_WakeUp = 5,
CduRecord_Waiting = 6,
CduRecord_MAX = CduRecord_Waiting,
CduRecord_Default = CduRecord_Exit,
CduUsb_Disconnected = 0,
CduUsb_Connected = 1,
CduUsb_MAX = CduUsb_Connected,
CduUsb_Default = CduUsb_Disconnected,
BlutsMusic_Disconnected = 0,
BlutsMusic_Connected = 1,
BlutsMusic_MAX = BlutsMusic_Connected,
BlutsMusic_Default = BlutsMusic_Disconnected,
PlayStatus_Playing = 0,
PlayStatus_Pause = 1,
PlayStatus_Stop = 2,
PlayStatus_Search = 3,
PlayStatus_Default = PlayStatus_Stop,
Media_Src_Music = 0,
Media_Src_Radio = 1,
Media_Src_NetRadio = 2,
Media_Src_None = 3,
Media_Src_Default = Media_Src_None,
CduWeather_Invalid = 0,
CduWeather_Valid = 1,
CduNavigation_Invalid = 0,
CduNavigation_Valid = 1,
};
enum
{
NAV_ICON_TURN_LEFT = 1,
NAV_ICON_TURN_RIGHT = 2,
NAV_ICON_LEFT_FRONT = 3,
NAV_ICON_RIGHT_FRONT = 4,
NAV_ICON_LEFT_BACK = 5,
NAV_ICON_RIGHT_BACK = 6,
NAV_ICON_TURN_ROUND = 7,
NAV_ICON_GO_STRAIGHT = 8,
NAV_ICON_ENTER_ROUNDABOUT = 9,
NAV_ICON_EXIT_ROUNDABOUT = 10,
NAV_ICON_ROLL_STATION = 11,
NAV_ICON_DESTINATION = 12,
NAV_ICON_ENTER_TUNNEL = 13,
};
enum
{
MUSIC_TYPE_LOCAL = 1,
MUSIC_TYPE_BLUETOOTH = 2,
MUSIC_TYPE_UPAN = 3,
NRADIO_TYPE_NET = 1,
NRADIO_TYPE_BOOK = 2,
};
enum
{
OTA_Normal = 0,
OTA_TRANSFERING,
OTA_TRANSFER_INT,
OTA_TRANSFER_SUCC,
OTA_DECRYPTING,
OTA_UNPACKING,
OTA_DECRYPT_FAIL,
OTA_UNPACK_FAIL,
OTA_DECRYPT_SUCC,
OTA_UNPACK_SUCC,
OTA_HMI_UPGRADING,
OTA_HMI_UPGRAD_FAIL,
OTA_HMI_ROLLBACKING,
OTA_HMI_ROLLBACK_SUCC,
OTA_HMI_UPGRAD_SUCC,
OTA_BACKUP_SUCC,
OTA_BACKUP_FAIL,
OTA_DATA_MD5_UNMATCH,
};
enum
{
PHONE_Unavailable = 0,
PHONE_InCall,
PHONE_OutCall,
PHONE_Connect,
PHONE_Cancel_InCall,
PHONE_Cancel_OutCall,
PHONE_List,
};
enum
{
PHONE_REQ_Ring = 0,
PHONE_REQ_Conn,
PHONE_REQ_Cancel,
PHONE_REQ_Mute,
PHONE_REQ_Unmute,
};
CduTcpApi JsonNav NavInfo;
CduTcpApi JsonMusic MusicInfo;
CduTcpApi JsonRadio RadioInfo;
CduTcpApi JsonWeather WeatherInfo;
CduTcpApi JsonAccount AccountInfo;
CduTcpApi JsonNetRadio NetRadioInfo;
CduTcpApi JsonUpgrade UpgradeInfo;
CduTcpApi JsonBlueTooth BlueToothInfo;
CduTcpApi ReqBlueTooth BlueToothReqRing;
CduTcpApi ReqBlueTooth BlueToothReqConn;
CduTcpApi ReqBlueTooth BlueToothReqCancel;
CduTcpApi ReqBlueTooth BlueToothReqMute;
CduTcpApi ReqBlueTooth BlueToothReqUnmute;
CduTcpApi UInt08 CduRecordState;
CduTcpApi UInt08 CduUsbState;
CduTcpApi UInt08 CduMediaSrc;
CduTcpApi UInt08 CduWeatherState;
CduTcpApi UInt08 CduNavigationState;
CduTcpApi UInt08 BlutsMusicState;
CduTcpApi UInt08 OtaState;
CduTcpApi Un08 BlueToothReqFlag;
#define REQ_BlueToothReqRing BlueToothReqFlag.sbit.b0
#define REQ_BlueToothReqConn BlueToothReqFlag.sbit.b1
#define REQ_BlueToothReqCancel BlueToothReqFlag.sbit.b2
#define REQ_BlueToothReqMute BlueToothReqFlag.sbit.b3
#define REQ_BlueToothReqUnmute BlueToothReqFlag.sbit.b4
//#ifndef UPDATE_OTA_STATE
//#define UPDATE_OTA_STATE(state) OtaState = (state)
//#endif // UPDATE_OTA_STATE
#ifndef UPDATE_OTA_STATE
#define UPDATE_OTA_STATE(state) do{\
if(OtaState != (state))\
{\
printf(" OtaState Update[%u]->[%u]\n", OtaState, (state));\
}\
OtaState = (state);\
}while(0)
#endif // UPDATE_OTA_STATE
#define MAX_SPEECH_CONTENT_LENGTH 100
#define MAX_NORMAL_ROAD_NAME_LENGTH 60
CduTcpApi Int08 SpeechContent[MAX_SPEECH_CONTENT_LENGTH];
CduTcpApi Int08 NormalRoadName[MAX_NORMAL_ROAD_NAME_LENGTH];
CduTcpApi UInt16 SpeechContentSize;
CduTcpApi UInt16 NormalRoadNameSize;
CduTcpApi UInt16 UpdSpeechContent;
CduTcpApi UInt16 UpdNormalRoadName;
#endif // CDU_TCP_APP_H_INCLUDED