Rtk.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #pragma once
  2. #include "../common/comm.h"
  3. #include "../common/notifier.h"
  4. #include "MqttClient.h"
  5. #define MAXLEAPS 64 /* max number of leap seconds table */
  6. static double leaps[MAXLEAPS+1][7]={ /* leap seconds (y,m,d,h,m,s,utc-gpst) */
  7. {2017,1,1,0,0,0,-18},
  8. {2015,7,1,0,0,0,-17},
  9. {2012,7,1,0,0,0,-16},
  10. {2009,1,1,0,0,0,-15},
  11. {2006,1,1,0,0,0,-14},
  12. {1999,1,1,0,0,0,-13},
  13. {1997,7,1,0,0,0,-12},
  14. {1996,1,1,0,0,0,-11},
  15. {1994,7,1,0,0,0,-10},
  16. {1993,7,1,0,0,0, -9},
  17. {1992,7,1,0,0,0, -8},
  18. {1991,1,1,0,0,0, -7},
  19. {1990,1,1,0,0,0, -6},
  20. {1988,1,1,0,0,0, -5},
  21. {1985,7,1,0,0,0, -4},
  22. {1983,7,1,0,0,0, -3},
  23. {1982,7,1,0,0,0, -2},
  24. {1981,7,1,0,0,0, -1},
  25. {0}
  26. };
  27. typedef struct { /* time struct */
  28. time_t time; /* time (s) expressed by standard time_t */
  29. double sec; /* fraction of second under 1 s */
  30. } gtime_t;
  31. class CMessageQueue;
  32. class CRtkSensor//:public ISensorNotify
  33. {
  34. public:
  35. CRtkSensor(CMessageQueue* q);
  36. void Notify(int8_t* buffer, int32_t size);
  37. void SetSensorSocket(SensorSocket<CRtkSensor>* udp);
  38. void Start();
  39. void Stop();
  40. void Send_ZGJ_status(int Status);//ץ�ֻ�״̬��Ϣ�ϱ�
  41. // void Send_ZGJ_status(float gpsweek,float gpsTime,int Status);//ץ�ֻ�״̬��Ϣ�ϱ�
  42. gtime_t timeadd(gtime_t t, double sec);
  43. double timediff(gtime_t t1, gtime_t t2);
  44. gtime_t epoch2time(const double *ep);
  45. gtime_t gpst2utc(gtime_t t);
  46. private:
  47. void Run();
  48. // void Send_ZGJ_Rtk(float headingAngle, float lat, float lon);//ץ�ֻ�λ����Ϣ�ϱ�
  49. // void Send_ZGJ_Rtk(float headingAngle, float lat, float lon,float loc_status);//ץ�ֻ�λ����Ϣ�ϱ�
  50. void Send_ZGJ_Rtk(float gpsweek,float gpsTime,float headingAngle,float lat,float lon,float loc_status);
  51. private:
  52. CMessageQueue* _message;
  53. SensorSocket<CRtkSensor>* _socket;
  54. long long _curTick;
  55. bool F_SendDate;
  56. bool _run;
  57. int32_t _count=0;
  58. gtime_t rtk_time;
  59. float gpsweek,gpsTime;
  60. };