para.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef __PARA_H_
  2. #define __PARA_H_
  3. #include "datatype.h"
  4. #include "platform.h"
  5. #define DEFAULT_POC_PORT 11390
  6. #pragma pack(push)
  7. #pragma pack(1)
  8. typedef enum{
  9. CODE_GBK,
  10. CODE_UNICODE
  11. }MSG_CODE_ENUM;
  12. typedef enum{
  13. ENCODE_EVRC,
  14. ENCODE_EVRC_FULL,
  15. ENCODE_AMRNB
  16. }ENCODE_ENUM;
  17. typedef enum{
  18. DEFINE_SER,
  19. DEFINE_COM
  20. }DEFINE_ENUM;
  21. typedef struct{
  22. T_UINT16 port;
  23. T_INT8 addr[IP_DOMAIN_SIZE+1];//ip or domain
  24. T_INT8 ip[20];
  25. }DSER_DEF;
  26. typedef struct{
  27. T_UINT8 gpsSwitch:1; //GPS是否工作
  28. DSER_DEF gpsServer;
  29. T_UINT8 gpsAuthCode[7];
  30. T_UINT16 gpsInterval;
  31. }GPSPARA_DEF;
  32. #define DEFAULT_BYTES 100
  33. typedef struct{
  34. //int dbmark;//用于识别
  35. T_BOOL pocEnable;
  36. T_UINT32 psn;
  37. T_INT8 pass[30];
  38. DSER_DEF pocServer;
  39. MSG_CODE_ENUM msgCode;
  40. ENCODE_ENUM encodeType;
  41. DEFINE_ENUM udpModifyPriType;
  42. T_UINT8 udpHeartTick_4G;
  43. T_UINT8 udpHeartTick_none_4G;
  44. T_INT8 groupServer[IP_DOMAIN_SIZE+1];
  45. T_INT8 fotaServer[IP_DOMAIN_SIZE+1];
  46. GPSPARA_DEF gps;
  47. T_UINT8 defaultZone[DEFAULT_BYTES];//保留,后面扩展时用,这样就不用重置参数区了
  48. }PARA_DEF;
  49. #pragma pack(pop)
  50. extern PARA_DEF paras;
  51. void para_inits(void);
  52. T_UINT8 setNewPara(T_UINT8 *data, T_UINT16 len);
  53. void SaveNewPara(void);
  54. void saveAuthEncode(T_UINT8 *encode, T_UINT16 length);
  55. T_BOOL readAuthEncode(T_UINT8 *outEncode, T_UINT16 readLen);
  56. int hdataRead(unsigned char *outdata, int outsize);
  57. void hdataSave(unsigned char *indata, unsigned int len);
  58. void showStatus(void);
  59. #endif