navdata.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * =====================================================================================
  3. *
  4. * Filename: navdata.h
  5. *
  6. * Description: Navdata head file
  7. *
  8. * Version: 1.0
  9. * Created: 2018/8/15 17:22:18
  10. * Revision: none
  11. * Compiler: gcc
  12. *
  13. * Author: Jarod Lee
  14. * Organization:
  15. *
  16. * =====================================================================================
  17. */
  18. #ifndef __NAV_DATA_H
  19. #define __NAV_DATA_H
  20. #include <stdbool.h>
  21. #define MAX_SVID 300
  22. enum {
  23. CONSTELL_TYPE_UNKNOWN = 0,
  24. CONSTELL_TYPE_GPS,
  25. CONSTELL_TYPE_GLN,
  26. CONSTELL_TYPE_BDS,
  27. MAX_CONSTELL_TYPES,
  28. };
  29. /*
  30. * Satellite structure
  31. */
  32. struct sate {
  33. int constell; // GPS or GLN or BDS....
  34. int prn;
  35. int cn0;
  36. int elev; // elevation
  37. int azim; // azimuth
  38. bool in_use; // is the satellite used in fix
  39. bool valid; // is the satellite valid
  40. };
  41. /*
  42. * Gnss date structure
  43. */
  44. struct gnss_date {
  45. int year;
  46. int month;
  47. int day;
  48. };
  49. /*
  50. * Gnss time structure
  51. */
  52. struct gnss_time {
  53. int hour;
  54. int minute;
  55. int second;
  56. int ms;
  57. };
  58. /*
  59. * Navigation data
  60. */
  61. struct nav_data {
  62. struct gnss_date date;
  63. struct gnss_time time;
  64. bool is_fixed;
  65. double lat;
  66. double lon;
  67. float alt;
  68. float speed;
  69. float heading;
  70. float hdop;
  71. float vdop;
  72. float pdop;
  73. int sv_inuse;
  74. int sv_inview;
  75. int sv_count;
  76. struct sate sates[MAX_SVID];
  77. };
  78. int prn2svid(int prn, int constell); // convert @prn and @constell to SVID
  79. int tell_constell(int svid); // tell the constellation type of @svid
  80. const char *constell_name(int constell); // get constellation type's name
  81. void navdata_init(struct nav_data *d); // int nav_data to 0
  82. #endif