b.liu | 4e243dc | 2023-11-27 11:20:00 +0800 | [diff] [blame] | 1 | /* |
| 2 | * qser_gnss.h |
| 3 | * |
| 4 | * QSER GNSS header file. |
| 5 | * |
| 6 | * Author : lb |
| 7 | * Date : 2023/11/23 11:13:18 |
| 8 | */ |
| 9 | #ifndef _QSER_GNSS_H |
| 10 | #define _QSER_GNSS_H |
| 11 | #include "mbtk_type.h" |
liuyang | a812f1b | 2024-07-25 17:49:14 +0800 | [diff] [blame] | 12 | #include "mbtk_gnss.h" |
| 13 | #include "mbtk_log.h" |
| 14 | |
b.liu | 4e243dc | 2023-11-27 11:20:00 +0800 | [diff] [blame] | 15 | typedef unsigned int Uint_t; |
wangyouqiang | 3d09b4d | 2024-01-04 13:50:51 +0800 | [diff] [blame] | 16 | #define MOPEN_GNSS_NMEA_MAX_LENGTH 255 /* NMEA string maximum length. */ |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 17 | |
yq.wang | 937355d | 2024-07-26 01:24:42 -0700 | [diff] [blame] | 18 | #define QSER_LEN_MAX 128 |
| 19 | |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 20 | typedef enum |
| 21 | { |
wangyouqiang | 3d09b4d | 2024-01-04 13:50:51 +0800 | [diff] [blame] | 22 | E_MT_LOC_MSG_ID_LOCATION_INFO = 1, /**< pv_data = & mopen_location_info_t */ |
| 23 | E_MT_LOC_MSG_ID_NMEA_INFO = 3, /**< pv_data = & mopen_gnss_nmea_info_t */ |
b.liu | 4e243dc | 2023-11-27 11:20:00 +0800 | [diff] [blame] | 24 | } e_msg_id_t; |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 25 | |
wangyouqiang | 75b6cfd | 2024-05-31 14:25:45 +0800 | [diff] [blame] | 26 | typedef enum { |
| 27 | QSER_GNSS_ERROR_SUCCESS = 0, |
| 28 | QSER_GNSS_ERROR_FAIL, |
| 29 | } qser_gnss_error_e; |
| 30 | |
b.liu | 4e243dc | 2023-11-27 11:20:00 +0800 | [diff] [blame] | 31 | typedef void (*gnss_handler_func_t) |
| 32 | ( |
| 33 | Uint_t *h_loc, |
| 34 | e_msg_id_t e_msg_id, //消息 ID |
| 35 | void *pv_data, //消息内容,取决于 ID,如下说明 |
| 36 | void *context_ptr //用于区分哪个返回的消息 |
| 37 | )/* lynq_AddRxIndMsgHandler_t*/; |
| 38 | |
wangyouqiang | 75b6cfd | 2024-05-31 14:25:45 +0800 | [diff] [blame] | 39 | typedef void (*gnss_async_func_t)(qser_gnss_error_e state); |
liuyang | a812f1b | 2024-07-25 17:49:14 +0800 | [diff] [blame] | 40 | |
yq.wang | 937355d | 2024-07-26 01:24:42 -0700 | [diff] [blame] | 41 | typedef struct |
| 42 | { |
| 43 | char host[QSER_LEN_MAX]; |
| 44 | char id[QSER_LEN_MAX]; |
| 45 | char passwd[QSER_LEN_MAX]; |
| 46 | }qser_agps_info; |
wangyouqiang | 75b6cfd | 2024-05-31 14:25:45 +0800 | [diff] [blame] | 47 | |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 48 | typedef struct |
| 49 | { |
wangyouqiang | 3d09b4d | 2024-01-04 13:50:51 +0800 | [diff] [blame] | 50 | int64_t timestamp; /**< System Timestamp, marked for when got the nmea data */ |
| 51 | int length; /**< NMEA string length. */ |
| 52 | char nmea[MOPEN_GNSS_NMEA_MAX_LENGTH + 1]; /**< NMEA string.*/ |
| 53 | }mopen_gnss_nmea_info_t; /* Message */ |
| 54 | |
| 55 | typedef struct |
| 56 | { |
| 57 | uint32_t size; /**< Set to the size of mcm_gps_location_t. */ |
| 58 | int flags; /**< Contains GPS location flags bits. */ |
| 59 | int position_source; /**< Provider indicator for HYBRID or GPS. */ //功能暂未实现,可不用添加进结构体 |
| 60 | double latitude; /**< Latitude in degrees. */ |
| 61 | double longitude; /**< Longitude in degrees. */ |
| 62 | double altitude; /**< Altitude in meters above the WGS 84 reference ellipsoid. */ |
| 63 | float speed; /**< Speed in meters per second. */ |
| 64 | float bearing; /**< Heading in degrees. */ //功能暂未实现,可不用添加进结构体 |
| 65 | float accuracy; /**< Expected accuracy in meters. */ //功能暂未实现,可不用添加进结构体 |
| 66 | int64_t timestamp; /**< Timestamp for the location fix in UTC million-second base. */ |
| 67 | int32_t is_indoor; /**< Location is indoors. */ //功能暂未实现,可不用添加进结构体 |
| 68 | float floor_number; /**< Indicates the floor number. */ |
| 69 | }mopen_location_info_t;//功能暂未实现,可不用添加进结构体 |
| 70 | |
| 71 | typedef struct |
| 72 | { |
b.liu | 4e243dc | 2023-11-27 11:20:00 +0800 | [diff] [blame] | 73 | uint32_t year; // 大于 1980 |
| 74 | uint32_t month; // 1-12 |
| 75 | uint32_t day; // 1-31 |
| 76 | uint32_t hour; // 0-23 |
| 77 | uint32_t minute; // 0-59 |
| 78 | uint32_t second; // 0-59 |
| 79 | uint32_t millisecond; // 0-999 |
| 80 | } LYNQ_INJECT_TIME_INTO_T; /* Message */ |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 81 | |
b.liu | 4e243dc | 2023-11-27 11:20:00 +0800 | [diff] [blame] | 82 | typedef enum { |
| 83 | DELETE_NOTHING = 0, /*不删除数据*/ |
| 84 | DELETE_EPHEMERIS = 1, /*删除星历*/ |
| 85 | DELETE_ALMANAC = 2, /*删除历书*/ |
| 86 | DELETE_POSITION_TIME = 3, /*删除时间和位置信息. */ |
| 87 | DELETE_UTC = 4, /*删除 UTC 时间*/ |
| 88 | DELETE_ALL = 5 /*删除所有*/ |
| 89 | } DELETE_AIDING_DATA_TYPE_T; |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 90 | |
b.liu | 4e243dc | 2023-11-27 11:20:00 +0800 | [diff] [blame] | 91 | int qser_Gnss_Init (uint32_t *h_gnss); |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 92 | |
b.liu | 4e243dc | 2023-11-27 11:20:00 +0800 | [diff] [blame] | 93 | int qser_Gnss_Deinit (uint32_t h_gnss); |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 94 | |
b.liu | 4e243dc | 2023-11-27 11:20:00 +0800 | [diff] [blame] | 95 | int qser_AddRxIndMsgHandler (gnss_handler_func_t handler_ptr,uint32_t h_gnss); |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 96 | |
b.liu | 4e243dc | 2023-11-27 11:20:00 +0800 | [diff] [blame] | 97 | int qser_Set_Indications (uint32_t h_gnss,e_msg_id_t type); |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 98 | |
wangyouqiang | 75b6cfd | 2024-05-31 14:25:45 +0800 | [diff] [blame] | 99 | int qser_Gnss_Set_Async_Callback(gnss_async_func_t cb); |
| 100 | |
b.liu | 4e243dc | 2023-11-27 11:20:00 +0800 | [diff] [blame] | 101 | int qser_Gnss_Start (uint32_t h_gnss); |
liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 102 | |
wangyouqiang | 75b6cfd | 2024-05-31 14:25:45 +0800 | [diff] [blame] | 103 | int qser_Gnss_Start_Async(uint32_t h_gnss); |
| 104 | |
b.liu | 4e243dc | 2023-11-27 11:20:00 +0800 | [diff] [blame] | 105 | int qser_Gnss_Stop (uint32_t h_gnss); |
| 106 | |
wangyouqiang | 3d09b4d | 2024-01-04 13:50:51 +0800 | [diff] [blame] | 107 | int qser_Gnss_Set_Frequency(uint32_t h_gnss, int frequency); |
| 108 | |
b.liu | 4e243dc | 2023-11-27 11:20:00 +0800 | [diff] [blame] | 109 | int qser_Gnss_InjectTime (uint32_t h_gnss,LYNQ_INJECT_TIME_INTO_T *time_info); |
| 110 | |
| 111 | int qser_Gnss_Delete_Aiding_Data (uint32_t h_gnss,DELETE_AIDING_DATA_TYPE_T flags); |
| 112 | |
wangyouqiang | 3d09b4d | 2024-01-04 13:50:51 +0800 | [diff] [blame] | 113 | int qser_Gnss_Server_Configuration(char *host, char *id, char *password); |
| 114 | |
b.liu | 4e243dc | 2023-11-27 11:20:00 +0800 | [diff] [blame] | 115 | int qser_Gnss_download_tle(); |
| 116 | |
| 117 | int qser_Gnss_injectEphemeris(uint32_t h_gnss); |
| 118 | |
wangyouqiang | 3d09b4d | 2024-01-04 13:50:51 +0800 | [diff] [blame] | 119 | |
b.liu | 4e243dc | 2023-11-27 11:20:00 +0800 | [diff] [blame] | 120 | #endif /* _QSER_GNSS_H */ |