GpsData.h 2.4 KB

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