blob: c472cf5270d104aaef5eb1f7f0422dfbaf5c2965 [file] [log] [blame]
lichengzhangf4fa50b2023-08-10 04:10:11 -07001#ifdef __cplusplus
2extern "C" {
3#endif
4
5typedef enum
6{
7 /**< 0 reserve */
8 E_MT_LOC_MSG_ID_LOCATION_INFO = 1, /**< pv_data = &QL_LOC_LOCATION_INFO_T */
9 /**< 2 reserve */
10 E_MT_LOC_MSG_ID_NMEA_INFO = 3, /**< pv_data = &QL_LOC_NMEA_INFO_T */
11}e_msg_id_t;
12
13#define MOPEN_GNSS_NMEA_MAX_LENGTH 255 /** NMEA string maximum length. */
14typedef struct
15{
16 int64_t timestamp; /**< System Timestamp, marked for when got the nmea data */
17 int length; /**< NMEA string length. */
18 char nmea[MOPEN_GNSS_NMEA_MAX_LENGTH + 1]; /**< NMEA string.*/
19}mopen_gnss_nmea_info_t; /* Message */
20
21struct mopen_location_info_t
22{
23 uint32_t size; /**< Set to the size of mcm_gps_location_t. */
24 int flags; /**< Contains GPS location flags bits. */
25 int position_source; /**< Provider indicator for HYBRID or GPS. */
26 double latitude; /**< Latitude in degrees. */
27 double longitude; /**< Longitude in degrees. */
28 double altitude; /**< Altitude in meters above the WGS 84 reference ellipsoid. */
29 float speed; /**< Speed in meters per second. */
30 float bearing; /**< Heading in degrees. */
31 float accuracy; /**< Expected accuracy in meters. */
32 int64_t timestamp; /**< Timestamp for the location fix in UTC million-second base. */
33 int32_t is_indoor; /**< Location is indoors. */
34 float floor_number; /**< Indicates the floor number. */
35};
36
37/*Instantiate callback function*/
38void cb
39(
40 uint32_t h_loc,
41 e_msg_id_t e_msg_id,
42 void *pv_data,
43 void *context_ptr
44 )
45{
46 printf("e_msg_id=%d\n", e_msg_id);
47 switch(e_msg_id)
48 {
49 case E_MT_LOC_MSG_ID_LOCATION_INFO:
50 {
51 mopen_location_info_t *pt_location = (mopen_location_info_t *)pv_data;
52 printf("**** flag=0x%X, Latitude = %f, Longitude=%f, altitude = %f, speed = %f, timestamp = %lld ****\n",
53 pt_location->flags,
54 pt_location->latitude,
55 pt_location->longitude,
56 pt_location->altitude,
57 pt_location->speed,
58 pt_location->timestamp);
59 break;
60 }
61 case E_MT_LOC_MSG_ID_NMEA_INFO:
62 {
63 mopen_gnss_nmea_info_t *pt_nmea = (mopen_gnss_nmea_info_t *)pv_data;
64
65 printf("**** NMEA info: timestamp=%lld, length=%d, nmea=%s ****\n",
66 pt_nmea->timestamp, pt_nmea->length, pt_nmea->nmea);
67 break;
68 }
69 }
70}
71
72typedef void (*gnss_handler_func_t)
73(
74 uint32_t h_loc,
75 e_msg_id_t e_msg_id,
76 void *pv_data,
77 void *context_ptr
78 );
79
80typedef enum {
81 DELETE_NOTHING = 0, /**< Delete nothing. */
82 DELETE_EPHEMERIS = 1, /**< Delete ephemeris data. */
83 DELETE_ALMANAC = 2, /**< Delete almanac data. */
84 DELETE_POSITION_TIME = 3, /**< Delete position and time data. */
85 DELETE_UTC = 4, /**< Delete UTC data. */
86 DELETE_ALL = 5, /**< Delete all location data. */
87}DELETE_AIDING_DATA_TYPE_T;
88
89typedef struct
90{
91 uint32_t year; // >1980
92 uint32_t month; // 1-12
93 uint32_t day; // 1-31
94 uint32_t hour; // 0-23
95 uint32_t minute; // 0-59
96 uint32_t second; // 0-59
97 uint32_t millisecond; // 0-999
98}LYNQ_INJECT_TIME_INTO_T; /* Message */
99
100
101void user_help(void)
102{
103 printf("\t-1 exit\n"
104 "\t1 gnss init\n"
105 "\t2 gnss deinit \n"
106 "\t3 gnss add handle function\n"
107 "\t4 gnss set single mode\n"
108 "\t5 gnss set get_para_from_nmea mode\n"
109 "\t6 gnss start\n"
110 "\t7 gnss stop\n"
111 "\t8 gnss Delete_Aiding_Data and reset\n"
112 "\t9 gnss injecttime\n"
113 "please input operator: >> ");
114}
115void delete_type(void)
116{
117 printf("\t0 DELETE_NOTHING\n"
118 "\t1 DELETE_EPHEMERIS\n"
119 "\t2 DELETE_ALMANAC\n"
120 "\t3 DELETE_POSITION_TIME \n"
121 "\t4 DELETE_UTC\n"
122 "\t5 DELETE_ALL\n"
123 "please input operator: >> ");
124}
125
126#ifdef __cplusplus
127}
128#endif