HgsTcpProc.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /********************************************************************************
  2. * File Name: HgsTcpProc.h
  3. * Function Describe: Header file for HgsTcpProc.c
  4. * Explain:
  5. * Writer: wuzhao
  6. * Date: 2016-12-8
  7. *******************************************************************************/
  8. #ifndef __HGSTCPPROC_H
  9. #define __HGSTCPPROC_H
  10. /************************************file begin*******************************/
  11. #define CONFIG_SER_SOCKET 2
  12. #define CONFIG_TCP_MAX_CONNECT 3
  13. #define CONFIG_TCP_RETRY_CNT 3//如因网络延迟连接TCP慢返回,最久等多久
  14. #define CONF_PASS1 2
  15. #define CONF_PASS2 1
  16. #define CONF_PASS3 3
  17. typedef struct
  18. {
  19. unsigned short g_usOptionCnt;
  20. unsigned char g_ubConfigFlag :1;//是否进入配置管理功能
  21. #if(USE_CONFIG_FUN==1)
  22. unsigned char g_ubConfigTcpStatus:1;
  23. unsigned char g_ubConfigKeyStart:1;
  24. unsigned char g_ubConfigFinished:1;//完成数据交互,可上传结果
  25. unsigned char g_ucConfigKeyStep;
  26. unsigned char g_ucConfigKeyPCnt;
  27. unsigned char g_ucConfigKeyNCnt;
  28. unsigned char g_ucConfigKeyPN;//0没旋,1正2负
  29. /////////////////////////////////
  30. unsigned char g_ucTcpRetryNum;//多久没连接成功,再发起一次连接
  31. unsigned char g_ucTcpConnectTime;//发起连接次数
  32. unsigned char g_ucTcpSendRetryNum;//多久没数据应答,再发起一次数据发送
  33. unsigned char g_ucTcpSendDateTime;//发送数据次数
  34. unsigned char g_ucConfigStatus;//配置终端发送类型:上报列表/上报结果
  35. unsigned char g_ucConfigValue;//当g_ucConfigStatus为2时有用
  36. unsigned char g_ucConfigSerAckStatus;//服务器响应结果
  37. /////////////////////////////////
  38. #endif
  39. }__attribute__ ((packed)) CONFIG_SER_DEF;
  40. extern CONFIG_SER_DEF sutConfig;
  41. void ConfigCtrHandle(void);
  42. extern unsigned char CCID[];
  43. extern unsigned char HigosSendFlag;
  44. extern unsigned char HgsConnetCnt,HgsConnetStatus;
  45. extern unsigned char tcpControl;
  46. //int ModemGetCCID(void);
  47. void SendHgsData(void);
  48. void HigosTick(void);
  49. unsigned short SendTcpSeverPack(unsigned char *,unsigned char,unsigned short);
  50. void HigosInit(void);
  51. void Hgs_Data_RecvHandle(char *, unsigned short);
  52. void HigosStartCnt(unsigned char);
  53. void HigosStopCnt(void);
  54. void PrintTcpData(unsigned char *tcpData, unsigned short len);
  55. /************************************file end ******************************************/
  56. #endif