GpsData.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef __GPS_DATA_H_
  2. #define __GPS_DATA_H_
  3. #include "stdint.h"
  4. #include "pt.h"
  5. #include "message.h"
  6. #define GPS_PWREN_PIN GPIO_Pin_9
  7. #define GPS_PWREN_PORT GPIOC
  8. #define GPS_PWREN_HIGH GPS_PWREN_PORT->BRR = GPS_PWREN_PIN
  9. #define GPS_PWREN_LOW GPS_PWREN_PORT->BSRR = GPS_PWREN_PIN
  10. typedef struct SUT_GPS_INF
  11. {
  12. unsigned char isGpsWork:1;//GPS模块工作标志
  13. unsigned char isGpsValid:1;//GPS定位标志 0 GPS未定位 1 GPS已定位
  14. unsigned char isServerLogin:1; //GPS 服务器连接成功标志
  15. unsigned char isAutoSend:1;//自动发送标志
  16. unsigned char isGpsAuthOk:1;//GPS是否鉴权成功
  17. // unsigned char isFirstLocationSend:1;//is location package send and get ack or not after ath ok
  18. unsigned char GpsInactiveCt;//串口没反应计数器 ,当串口接收到消息则清零 ,否则持续时间长将复位模块
  19. unsigned char HostCmd;//主机下发的命令
  20. //unsigned short SendTime;//发送到服务器的时间间隔 秒为单位
  21. //unsigned short GPSSendTime;
  22. unsigned int GPS_SecondCnt;
  23. unsigned short GPS_UploadTime;
  24. unsigned char GPS_TimeIndexBackup;
  25. unsigned char year;
  26. unsigned char month;
  27. unsigned char day;
  28. unsigned char hour;
  29. unsigned char minu;
  30. unsigned char sec;
  31. uint32_t longitue;//经度
  32. uint32_t latitue;//纬度
  33. uint32_t speed;//速度
  34. uint32_t aspect;//方位
  35. uint32_t AvgSpeed;//平均速度
  36. uint32_t speedbuf[5];
  37. uint32_t StatisticsMile ;//历程统计
  38. //----------
  39. unsigned char Status;
  40. unsigned char Location[16];
  41. unsigned char Speed[8];
  42. unsigned char Time[8];
  43. uint32_t testJD;
  44. uint32_t testWD;
  45. char NSFlag;//N 北纬 S 南纬
  46. char EWFlag;//E 东经 W 西经
  47. // unsigned char reAthCnt;//resend ath time max 5
  48. }SUT_GPS_INF;
  49. #define GPS_TABLE_NUM 8
  50. /****************************************************
  51. 此处定义的长度很重要,如果长度不是与Message定义的长度一致会出现短信处显示全0满状态,添加不进短信的状态
  52. *****************************************************/
  53. typedef struct SUT_MESS{
  54. unsigned char Update;
  55. unsigned char forcePullGroupOn;//强拉动作开启
  56. unsigned char startCntFlag;
  57. unsigned char skipCnt;
  58. unsigned char GBKMess1[SMS_SIGNAL_LEN+1];//最后一个用来补作结尾
  59. unsigned short len;
  60. unsigned char codeType;
  61. }SUT_MESS;
  62. extern SUT_MESS sutMess;
  63. extern SUT_GPS_INF sutGpsInfo;
  64. extern const unsigned short GPS_TimeTable[GPS_TABLE_NUM];
  65. void GPSRestart(void);
  66. void GPSStop(void);
  67. void process_gps_data(char *buf,uint32_t size);
  68. void GpsInternalChange();
  69. PT_THREAD (ptGpsTask(struct pt *pt));
  70. #endif