liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame] | 1 | #ifndef __QL_MCM_GPS_H__ |
| 2 | #define __QL_MCM_GPS_H__ |
| 3 | #include "mbtk_type.h" |
| 4 | |
| 5 | |
| 6 | #define LOC_IND_LOCATION_INFO_ON (1 << 0) |
| 7 | #define LOC_IND_STATUS_INFO_ON (1 << 1) |
| 8 | #define LOC_IND_SV_INFO_ON (1 << 2) |
| 9 | #define LOC_IND_NMEA_INFO_ON (1 << 3) |
| 10 | #define LOC_IND_CAP_INFO_ON (1 << 4) |
| 11 | #define LOC_IND_UTC_TIME_REQ_ON (1 << 5) |
| 12 | #define LOC_IND_XTRA_DATA_REQ_ON (1 << 6) |
| 13 | #define LOC_IND_AGPS_DATA_CONN_CMD_REQ_ON (1 << 7) |
| 14 | #define LOC_IND_NI_NFY_USER_RESP_REQ_ON (1 << 8) |
| 15 | |
| 16 | typedef uint32 loc_client_handle_type; |
| 17 | |
| 18 | typedef enum |
| 19 | { |
| 20 | E_QL_LOC_POS_MODE_STANDALONE = 0, /**< Mode for running GPS standalone (no assistance). */ |
| 21 | E_QL_LOC_POS_MODE_MS_BASED = 1, /**< AGPS MS-Based mode. */ |
| 22 | E_QL_LOC_POS_MODE_MS_ASSISTED = 2, /**< AGPS MS-Assisted mode. */ |
| 23 | }E_QL_LOC_POS_MODE_T; |
| 24 | |
| 25 | typedef enum |
| 26 | { |
| 27 | E_QL_LOC_POS_RECURRENCE_PERIODIC = 0, /**< Receive GPS fixes on a recurring basis at a specified period. */ |
| 28 | E_QL_LOC_POS_RECURRENCE_SINGLE = 1, /**< Request a single-shot GPS fix. */ |
| 29 | }E_QL_LOC_POS_RECURRENCE_T; |
| 30 | |
| 31 | typedef struct |
| 32 | { |
| 33 | E_QL_LOC_POS_MODE_T mode; /* Position mode. */ |
| 34 | E_QL_LOC_POS_RECURRENCE_T recurrence; /* Recurrence */ |
| 35 | uint32_t min_interval; /* Minimum Interval, NMEA report frequency, 1000 means 1Hz, 100 means 10Hz */ |
| 36 | uint32_t preferred_accuracy; /* Preferred Accuracy , 30m or more, the less it takes longer timer. */ |
| 37 | uint32_t preferred_time; /* Preferred Time, first cold-boot may take 100s or more, hot boot may take 2s */ |
| 38 | }QL_LOC_POS_MODE_INFO_T; |
| 39 | |
| 40 | typedef enum |
| 41 | { |
| 42 | E_QL_LOC_LOCATION_LAT_LONG_VALID = 0x0001, /**< GPS location has valid latitude and longitude. */ |
| 43 | E_QL_LOC_LOCATION_ALTITUDE_VALID = 0x0002, /**< GPS location has a valid altitude. */ |
| 44 | E_QL_LOC_LOCATION_SPEED_VALID = 0x0004, /**< GPS location has a valid speed. */ |
| 45 | E_QL_LOC_LOCATION_BEARING_VALID = 0x0008, /**< GPS location has a valid bearing. */ |
| 46 | E_QL_LOC_LOCATION_ACCURACY_VALID = 0x0010, /**< GPS location has valid accuracy. */ |
| 47 | E_QL_LOC_LOCATION_SOURCE_INFO_VALID= 0x0020, /**< GPS location has valid source information. */ |
| 48 | E_QL_LOC_LOCATION_IS_INDOOR_VALID = 0x0040, /**< GPS location has a valid "is indoor?" flag. */ |
| 49 | E_QL_LOC_LOCATION_FLOOR_NUMBE_VALID= 0x0080, /**< GPS location has a valid floor number. */ |
| 50 | E_QL_LOC_LOCATION_MAP_URL_VALID = 0x0100, /**< GPS location has a valid map URL. */ |
| 51 | E_QL_LOC_LOCATION_MAP_INDEX_VALID = 0x0200, /**< GPS location has a valid map index. */ |
| 52 | }E_QL_LOC_LOCATION_VALID_FLAG; |
| 53 | |
| 54 | typedef enum |
| 55 | { |
| 56 | E_QL_LOC_ULP_LOCATION_SOURCE_HYBRID= 0x0001, /**< Position source is ULP. */ |
| 57 | E_QL_LOC_ULP_LOCATION_SOURCE_GNSS = 0x0002, /**< Position source is GNSS only. */ |
| 58 | }E_QL_LOC_ULP_LOCATION_SOURCE; |
| 59 | |
| 60 | #define QL_LOC_GPS_RAW_DATA_LEN_MAX 256 /** Raw data maximum size. */ |
| 61 | #define QL_LOC_GPS_LOCATION_MAP_URL_SIZE 399 /** Location map URL maximum size (used for indoor positioning). */ |
| 62 | #define QL_LOC_GPS_LOCATION_MAP_IDX_SIZE 16 /** Location map index maximum size (used for indoor positioning). */ |
| 63 | typedef struct |
| 64 | { |
| 65 | uint32_t size; /**< Set to the size of mcm_gps_location_t. */ |
| 66 | E_QL_LOC_LOCATION_VALID_FLAG flags; /**< Contains GPS location flags bits. */ |
| 67 | E_QL_LOC_ULP_LOCATION_SOURCE position_source; /**< Provider indicator for HYBRID or GPS. */ |
| 68 | double latitude; /**< Latitude in degrees. */ |
| 69 | double longitude; /**< Longitude in degrees. */ |
| 70 | double altitude; /**< Altitude in meters above the WGS 84 reference ellipsoid. */ |
| 71 | float speed; /**< Speed in meters per second. */ |
| 72 | float bearing; /**< Heading in degrees. */ |
| 73 | float accuracy; /**< Expected accuracy in meters. */ |
| 74 | int64_t timestamp; /**< Timestamp for the location fix in UTC million-second base. */ |
| 75 | int32_t is_indoor; /**< Location is indoors. */ |
| 76 | float floor_number; /**< Indicates the floor number. */ |
| 77 | uint32_t raw_data_len; /**< Must be set to # of elements in raw_data */ |
| 78 | uint8_t raw_data[QL_LOC_GPS_RAW_DATA_LEN_MAX]; /**< Allows the HAL to pass additional information related to the location. */ |
| 79 | char map_url[QL_LOC_GPS_LOCATION_MAP_URL_SIZE + 1]; /**< Map URL. */ |
| 80 | uint8_t map_index[QL_LOC_GPS_LOCATION_MAP_IDX_SIZE]; /**< Map index. */ |
| 81 | }QL_LOC_LOCATION_INFO_T; /* Type */ |
| 82 | |
| 83 | typedef enum |
| 84 | { |
| 85 | E_QL_LOC_STATUS_NONE = 0, /**< GPS status unknown. */ |
| 86 | E_QL_LOC_STATUS_SESSION_BEGIN = 1, /**< GPS has begun navigating. */ |
| 87 | E_QL_LOC_STATUS_SESSION_END = 2, /**< GPS has stopped navigating. */ |
| 88 | E_QL_LOC_STATUS_ENGINE_ON = 3, /**< GPS has powered on but is not navigating. */ |
| 89 | E_QL_LOC_STATUS_ENGINE_OFF = 4, /**< GPS is powered off. */ |
| 90 | }E_QL_LOC_STATUS_VALUE_T; |
| 91 | |
| 92 | typedef struct |
| 93 | { |
| 94 | uint32_t size; /**< Set to the size of mcm_gps_sv_info_t. */ |
| 95 | int prn; /**< Pseudo-random number for the SV. */ |
| 96 | float snr; /**< Signal-to-noise ratio. */ |
| 97 | float elevation; /**< Elevation of the SV in degrees. */ |
| 98 | float azimuth; /**< Azimuth of the SV in degrees. */ |
| 99 | }QL_LOC_SV_INFO_T; /* Type */ |
| 100 | |
| 101 | #define QL_LOC_GPS_SUPPORT_SVS_MAX 32 /** Maximum number of satellites in view. */ |
| 102 | typedef struct |
| 103 | { |
| 104 | uint32_t size; /**< Set to the size of mcm_gps_sv_status_t. */ |
| 105 | int num_svs; /**< Number of SVs currently visible. */ |
| 106 | QL_LOC_SV_INFO_T sv_list[QL_LOC_GPS_SUPPORT_SVS_MAX]; /**< Contains an array of SV information. */ |
| 107 | uint32_t ephemeris_mask; /**< Bitmask indicating which SVs have ephemeris data. */ |
| 108 | uint32_t almanac_mask; /**< Bitmask indicating which SVs have almanac data. */ |
| 109 | uint32_t used_in_fix_mask; /**< Bitmask indicating which SVs were used for computing the most recent position fix. */ |
| 110 | }QL_LOC_SV_STATUS_T; /* Type */ |
| 111 | |
| 112 | |
| 113 | #define QL_LOC_NMEA_MAX_LENGTH 255 /** NMEA string maximum length. */ |
| 114 | typedef struct |
| 115 | { |
| 116 | int64_t timestamp; /**< System Timestamp, marked for when got the nmea data */ |
| 117 | int length; /**< NMEA string length. */ |
| 118 | char nmea[QL_LOC_NMEA_MAX_LENGTH + 1]; /**< NMEA string.*/ |
| 119 | }QL_LOC_NMEA_INFO_T; /* Message */ |
| 120 | |
| 121 | typedef enum |
| 122 | { |
| 123 | E_QL_LOC_CAPABILITY_SCHEDULING = 0x01, /**< GPS HAL schedules fixes for GPS_POSITION_RECURRENCE_PERIODIC mode. |
| 124 | If this is not set, the framework uses \n 1000 ms for min_interval |
| 125 | and will call start() and stop() to schedule the GPS. */ |
| 126 | E_QL_LOC_CAPABILITY_MSB = 0x02, /**< GPS supports MS-Based AGPS mode. */ |
| 127 | E_QL_LOC_CAPABILITY_MSA = 0x04, /**< GPS supports MS-Assisted AGPS mode. */ |
| 128 | E_QL_LOC_CAPABILITY_SINGLE_SHOT = 0x08, /**< GPS supports single-shot fixes. */ |
| 129 | E_QL_LOC_CAPABILITY_ON_DEMAND_TIME = 0x10, /**< GPS supports on-demand time injection. */ |
| 130 | }E_QL_LOC_CAPABILITIES_T; |
| 131 | |
| 132 | |
| 133 | #define QL_LOC_GPS_SSID_BUF_SIZE 32 /** Maximum SSID (Service Set Identifier) buffer size. */ |
| 134 | #define QL_LOC_IPV6_ADDR_LEN 16 /** IPv6 address length. */ |
| 135 | typedef enum |
| 136 | { |
| 137 | E_QL_LOC_AGPS_TYPE_INVALID = -1, /**< Invalid. */ |
| 138 | E_QL_LOC_AGPS_TYPE_ANY = 0, /**< Any. */ |
| 139 | E_QL_LOC_AGPS_TYPE_SUPL = 1, /**< SUPL. */ |
| 140 | E_QL_LOC_AGPS_TYPE_C2K = 2, /**< C2K. */ |
| 141 | E_QL_LOC_AGPS_TYPE_WWAN_ANY = 3, /**< WWAN any. */ |
| 142 | E_QL_LOC_AGPS_TYPE_WIFI = 4, /**< Wi-Fi. */ |
| 143 | E_QL_LOC_AGPS_TYPE_SUPL_ES = 5, /**< SUPL_ES. */ |
| 144 | }E_QL_LOC_AGPS_TYPE_T; |
| 145 | |
| 146 | typedef enum |
| 147 | { |
| 148 | E_QL_LOC_REQUEST_AGPS_DATA_CONN = 1, /**< GPS requests a data connection for AGPS. */ |
| 149 | E_QL_LOC_RELEASE_AGPS_DATA_CONN = 2, /**< GPS releases the AGPS data connection. */ |
| 150 | E_QL_LOC_AGPS_DATA_CONNECTED = 3, /**< AGPS data connection is initiated */ |
| 151 | E_QL_LOC_AGPS_DATA_CONN_DONE = 4, /**< AGPS data connection is completed. */ |
| 152 | E_QL_LOC_AGPS_DATA_CONN_FAILED = 5, /**< AGPS data connection failed. */ |
| 153 | }E_QL_LOC_AGPS_STATUS_VALUE_T; |
| 154 | |
| 155 | typedef struct |
| 156 | { |
| 157 | uint32_t size; /**< Set to the size of mcm_agps_status_t. */ |
| 158 | E_QL_LOC_AGPS_TYPE_T type; /**< Type. */ |
| 159 | E_QL_LOC_AGPS_STATUS_VALUE_T status; /**< Status. */ |
| 160 | int ipv4_addr; /**< IPv4 address. */ |
| 161 | char ipv6_addr[QL_LOC_IPV6_ADDR_LEN + 1]; /**< IPv6 address. */ |
| 162 | char ssid[QL_LOC_GPS_SSID_BUF_SIZE + 1]; /**< SSID. */ |
| 163 | char password[QL_LOC_GPS_SSID_BUF_SIZE + 1]; /**< Password. */ |
| 164 | }QL_LOC_AGPS_STATUS_T; |
| 165 | |
| 166 | |
| 167 | #define QL_LOC_NI_SHORT_STRING_MAXLEN 255 /** NI short string maximum length. */ |
| 168 | #define QL_LOC_NI_LONG_STRING_MAXLEN 2047 /** NI long string maximum length. */ |
| 169 | typedef enum |
| 170 | { |
| 171 | E_QL_LOC_NI_TYPE_VOICE = 1, /**< Voice. */ |
| 172 | E_QL_LOC_NI_TYPE_UMTS_SUPL = 2, /**< UMTS SUPL. */ |
| 173 | E_QL_LOC_NI_TYPE_UMTS_CTRL_PLANE= 3, /**< UMTS control plane. */ |
| 174 | }E_QL_LOC_NI_TYPE_T; |
| 175 | |
| 176 | typedef enum |
| 177 | { |
| 178 | E_QL_LOC_NI_NEED_NOTIFY = 0x0001, /**< NI requires notification. */ |
| 179 | E_QL_LOC_NI_NEED_VERIFY = 0x0002, /**< NI requires verification. */ |
| 180 | E_QL_LOC_NI_PRIVACY_OVERRIDE = 0x0004, /**< NI requires privacy override; no notification/minimal trace. */ |
| 181 | }E_QL_LOC_NI_NOTIFY_FLAGS_T; |
| 182 | |
| 183 | typedef enum |
| 184 | { |
| 185 | E_QL_LOC_NI_RESPONSE_ACCEPT = 1, /**< Accept. */ |
| 186 | E_QL_LOC_NI_RESPONSE_DENY = 2, /**< Deny. */ |
| 187 | E_QL_LOC_NI_RESPONSE_NORESP = 3, /**< No response. */ |
| 188 | }E_QL_LOC_NI_USER_RESPONSE_TYPE_T; |
| 189 | |
| 190 | typedef enum |
| 191 | { |
| 192 | E_QL_LOC_NI_ENC_NONE = 0, /**< None. */ |
| 193 | E_QL_LOC_NI_ENC_SUPL_GSM_DEFAULT= 1, /**< SUPL GSM default. */ |
| 194 | E_QL_LOC_NI_ENC_SUPL_UTF8 = 2, /**< SUPL UTF8. */ |
| 195 | E_QL_LOC_NI_ENC_SUPL_UCS2 = 3, /**< SUPL UCS2. */ |
| 196 | E_QL_LOC_NI_ENC_UNKNOWN = -1, /**< Unknown. */ |
| 197 | }E_QL_LOC_NI_ENC_TYPE_T; |
| 198 | |
| 199 | typedef struct |
| 200 | { |
| 201 | uint32_t size; /**< Set to the size of mcm_gps_ni_notification_t. */ |
| 202 | int notification_id; /**< An ID generated by the HAL to associate NI notifications and UI responses. */ |
| 203 | E_QL_LOC_NI_TYPE_T ni_type; /**< An NI type used to distinguish different categories of NI events, such as GPS_NI_TYPE_VOICE, GPS_NI_TYPE_UMTS_SUPL, etc. */ |
| 204 | E_QL_LOC_NI_NOTIFY_FLAGS_T notify_flags; /**< Notification/verification options; combinations of GpsNiNotifyFlags constants. */ |
| 205 | int timeout; /**< Timeout period to wait for a user response. Set to 0 for no timeout limit. */ |
| 206 | E_QL_LOC_NI_USER_RESPONSE_TYPE_T default_response; /**< Default response when the response times out. */ |
| 207 | char requestor_id[QL_LOC_NI_SHORT_STRING_MAXLEN + 1]; /**< Requestor ID. */ |
| 208 | char text[QL_LOC_NI_LONG_STRING_MAXLEN + 1]; /**< Notification message. It can also be used to store the client ID in some cases. */ |
| 209 | E_QL_LOC_NI_ENC_TYPE_T requestor_id_encoding; /**< Client ID encoding scheme. */ |
| 210 | E_QL_LOC_NI_ENC_TYPE_T text_encoding; /**< Client name encoding scheme. */ |
| 211 | char extras[QL_LOC_NI_LONG_STRING_MAXLEN + 1]; /**< Pointer to extra data. Format:\n- key_1 = value_1, - key_2 = value_2 @tablebulletend */ |
| 212 | }QL_LOC_NI_NOTIFICATION_INTO_T; |
| 213 | |
| 214 | #define QL_LOC_MAX_SEVER_ADDR_LENGTH 255 /** Maximum generic server address length for the host name. */ |
| 215 | typedef struct |
| 216 | {/** Indication Message; Indication with the reported XTRA server URLs. */ |
| 217 | char server1[QL_LOC_MAX_SEVER_ADDR_LENGTH + 1]; /**< server1.*/ |
| 218 | char server2[QL_LOC_MAX_SEVER_ADDR_LENGTH + 1]; /**< server2.*/ |
| 219 | char server3[QL_LOC_MAX_SEVER_ADDR_LENGTH + 1]; /**< server3.*/ |
| 220 | }QL_LOC_XTRA_REPORT_SERVER_INTO_T; |
| 221 | |
| 222 | typedef enum |
| 223 | { |
| 224 | E_QL_LOC_NFY_MSG_ID_STATUS_INFO = 0, /**< pv_data = &E_QL_LOC_STATUS_VALUE_T */ |
| 225 | E_QL_LOC_NFY_MSG_ID_LOCATION_INFO, /**< pv_data = &QL_LOC_LOCATION_INFO_T */ |
| 226 | E_QL_LOC_NFY_MSG_ID_SV_INFO, /**< pv_data = &QL_LOC_SV_STATUS_T */ |
| 227 | E_QL_LOC_NFY_MSG_ID_NMEA_INFO, /**< pv_data = &QL_LOC_NMEA_INFO_T */ |
| 228 | E_QL_LOC_NFY_MSG_ID_CAPABILITIES_INFO, /**< pv_data = &E_QL_LOC_CAPABILITIES_T */ |
| 229 | E_QL_LOC_NFY_MSG_ID_AGPS_STATUS, /**< pv_data = &QL_LOC_AGPS_STATUS_T */ |
| 230 | E_QL_LOC_NFY_MSG_ID_NI_NOTIFICATION, /**< pv_data = &QL_LOC_NI_NOTIFICATION_INTO_T */ |
| 231 | E_QL_LOC_NFY_MSG_ID_XTRA_REPORT_SERVER, /**< pv_data = &QL_LOC_XTRA_REPORT_SERVER_INTO_T */ |
| 232 | }E_QL_LOC_NFY_MSG_ID_T; |
| 233 | |
| 234 | /* callback function register to QL_LOC_AddRxIndMsgHandler |
| 235 | e_msg_id: which kind of msg can be received depend on the bit_mask set in QL_LOC_Set_Indications; |
| 236 | pv_data: depend on the e_msg_id type. |
| 237 | */ |
| 238 | typedef void (*QL_LOC_RxIndMsgHandlerFunc_t) |
| 239 | ( |
| 240 | loc_client_handle_type h_loc, |
| 241 | E_QL_LOC_NFY_MSG_ID_T e_msg_id, |
| 242 | void *pv_data, |
| 243 | void *contextPtr |
| 244 | ); |
| 245 | |
| 246 | typedef enum |
| 247 | { |
| 248 | E_QL_LOC_DELETE_EPHEMERIS = (1 << 0), /**< Delete ephemeris data. */ |
| 249 | E_QL_LOC_DELETE_ALMANAC = (1 << 1), /**< Delete almanac data. */ |
| 250 | E_QL_LOC_DELETE_POSITION = (1 << 2), /**< Delete position data. */ |
| 251 | E_QL_LOC_DELETE_TIME = (1 << 3), /**< Delete time data. */ |
| 252 | E_QL_LOC_DELETE_IONO = (1 << 4), /**< Delete IONO data. */ |
| 253 | E_QL_LOC_DELETE_UTC = (1 << 5), /**< Delete UTC data. */ |
| 254 | E_QL_LOC_DELETE_HEALTH = (1 << 6), /**< Delete health data. */ |
| 255 | E_QL_LOC_DELETE_SVDIR = (1 << 7), /**< Delete SVDIR data. */ |
| 256 | E_QL_LOC_DELETE_SVSTEER = (1 << 8), /**< Delete SVSTEER data. */ |
| 257 | E_QL_LOC_DELETE_SADATA = (1 << 9), /**< Delete SA data. */ |
| 258 | E_QL_LOC_DELETE_RTI = (1 << 10), /**< Delete RTI data. */ |
| 259 | E_QL_LOC_DELETE_CELLDB_INFO = (1 << 11), /**< Delete cell DB information. */ |
| 260 | E_QL_LOC_DELETE_ALMANAC_CORR = (1 << 12), /**< Delete almanac correction data. */ |
| 261 | E_QL_LOC_DELETE_FREQ_BIAS_EST = (1 << 13), /**< Delete frequency bias estimate. */ |
| 262 | E_QL_LOC_DELETE_EPHEMERIS_GLO = (1 << 14), /**< Delete ephemeris GLO data. */ |
| 263 | E_QL_LOC_DELETE_ALMANAC_GLO = (1 << 15), /**< Delete almanac GLO data. */ |
| 264 | E_QL_LOC_DELETE_SVDIR_GLO = (1 << 16), /**< Delete SVDIR GLO data. */ |
| 265 | E_QL_LOC_DELETE_SVSTEER_GLO = (1 << 17), /**< Delete SVSTEER GLO data. */ |
| 266 | E_QL_LOC_DELETE_ALMANAC_CORR_GLO= (1 << 18), /**< Delete almanac correction GLO data. */ |
| 267 | E_QL_LOC_DELETE_TIME_GPS = (1 << 19), /**< Delete time GPS data. */ |
| 268 | E_QL_LOC_DELETE_TIME_GLO = (1 << 20), /**< Delete time GLO data. */ |
| 269 | E_QL_LOC_DELETE_ALL = 0xFFFFFFFF, /**< Delete all location data. */ |
| 270 | }E_QL_LOC_DELETE_AIDING_DATA_TYPE_T; |
| 271 | |
| 272 | typedef struct |
| 273 | { |
| 274 | int64_t time; /**< Inject time.*/ |
| 275 | int64_t time_reference; /**< Time reference.*/ |
| 276 | int32_t uncertainty; /**< Uncertainty.*/ |
| 277 | }QL_LOC_INJECT_TIME_INTO_T; /* Message */ |
| 278 | |
| 279 | typedef struct |
| 280 | { |
| 281 | double latitude; /**< Latitude.*/ |
| 282 | double longitude; /**< Longitude.*/ |
| 283 | float accuracy; /**< Accuracy.*/ |
| 284 | }QL_LOC_INJECT_LOCATION_INTO_T; |
| 285 | |
| 286 | typedef enum |
| 287 | { |
| 288 | E_QL_LOC_AGPS_APN_BEARER_INVALID= -1, /**< Invalid. */ |
| 289 | E_QL_LOC_AGPS_APN_BEARER_IPV4 = 0, /**< IPv4. */ |
| 290 | E_QL_LOC_AGPS_APN_BEARER_IPV6 = 1, /**< IPv6. */ |
| 291 | E_QL_LOC_AGPS_APN_BEARER_IPV4V6 = 2, /**< IPv4/v6. */ |
| 292 | }E_QL_LOC_AGPS_APN_BEARER_TYPE_T; |
| 293 | |
| 294 | #define QL_LOC_APN_NAME_LENGTH_MAX 100 |
| 295 | typedef struct |
| 296 | { |
| 297 | E_QL_LOC_AGPS_TYPE_T e_agps_type; /**< AGPS type.*/ |
| 298 | char apn[QL_LOC_APN_NAME_LENGTH_MAX + 1];/**< APN.*/ |
| 299 | E_QL_LOC_AGPS_APN_BEARER_TYPE_T e_bearer_type; /**< Bearer type.*/ |
| 300 | }QL_LOC_AGPS_DATA_CONN_OPEN_INTO_T; |
| 301 | |
| 302 | #define QL_LOC_SEVER_ADDR_LENGTH_MAX 255 |
| 303 | typedef struct |
| 304 | { |
| 305 | E_QL_LOC_AGPS_TYPE_T e_agps_type; /**< AGPS type.*/ |
| 306 | char host_name[QL_LOC_SEVER_ADDR_LENGTH_MAX + 1];/**< Host name.*/ |
| 307 | uint32_t port; /**< Port.*/ |
| 308 | }QL_LOC_AGPS_SERVER_INTO_T; |
| 309 | |
| 310 | typedef struct |
| 311 | { |
| 312 | int32_t notify_id; /**< Notification ID.*/ |
| 313 | E_QL_LOC_NI_USER_RESPONSE_TYPE_T user_resp; /**< User response.*/ |
| 314 | }QL_LOC_NI_RESPONSE_INTO_T; |
| 315 | |
| 316 | |
| 317 | |
| 318 | /* Add callback function if anything changed specified by the mask in QL_LOC_Set_Indications*/ |
| 319 | int QL_LOC_AddRxIndMsgHandler(QL_LOC_RxIndMsgHandlerFunc_t handlerPtr, void* contextPtr); |
| 320 | |
| 321 | /* Set what we want callbacks for, for the detail mean of bit_mask, please refer to the macro of LOC_IND_xxxxx_INFO_ON */ |
| 322 | int QL_LOC_Set_Indications(loc_client_handle_type h_loc, int bit_mask); |
| 323 | |
| 324 | /* Set GPS position mode, detail info please refer to QL_LOC_POS_MODE_INFO_T */ |
| 325 | int QL_LOC_Set_Position_Mode(loc_client_handle_type h_loc, QL_LOC_POS_MODE_INFO_T *pt_mode); |
| 326 | |
| 327 | /* Start navigation, same as AT+QGPS=1, NMEA port start outputing nmea data */ |
| 328 | int QL_LOC_Start_Navigation(loc_client_handle_type h_loc); |
| 329 | |
| 330 | /* Stop navigation, same as AT+QGPSEND, NMEA port stop outputing nmea data */ |
| 331 | int QL_LOC_Stop_Navigation(loc_client_handle_type h_loc); |
| 332 | |
| 333 | /* Set up GPS connection and start getting coordinates , this api will call QL_LOC_Start_Navigation inside first, |
| 334 | then wait for LOC_IND_LOCATION_INFO_ON event happen, if timeout, it will use last time stored loc_info. |
| 335 | If got this event, location infor will save to pt_loc_info and call QL_LOC_Stop_Navigation stop and exit. */ |
| 336 | int QL_LOC_Get_Current_Location(loc_client_handle_type h_loc, QL_LOC_LOCATION_INFO_T *pt_loc_info, int timeout_sec); |
| 337 | |
| 338 | /* Init LOC module and return the h_loc, this should be called before any other QL_LOC_xxx api. */ |
| 339 | int QL_LOC_Client_Init(loc_client_handle_type *ph_loc); |
| 340 | |
| 341 | /* DeInit LOC module and release resource, this should be called at last. */ |
| 342 | int QL_LOC_Client_Deinit(loc_client_handle_type h_loc); |
| 343 | |
| 344 | /* Deletes location-aiding data. */ |
| 345 | int QL_LOC_Delete_Aiding_Data( loc_client_handle_type h_loc, |
| 346 | E_QL_LOC_DELETE_AIDING_DATA_TYPE_T flags); |
| 347 | |
| 348 | /* Injects time. */ |
| 349 | int QL_LOC_InjectTime( loc_client_handle_type h_loc, |
| 350 | QL_LOC_INJECT_TIME_INTO_T *pt_info); |
| 351 | |
| 352 | /* Injects Location. */ |
| 353 | int QL_LOC_InjectLocation( loc_client_handle_type h_loc, |
| 354 | QL_LOC_INJECT_LOCATION_INTO_T *pt_info); |
| 355 | |
| 356 | /** Injects XTRA data. |
| 357 | Since the IPC mechanism puts a limit on the size of the data transferable in one message at 64 KB, |
| 358 | the application using this command must break the data down into chunks of a smaller size and repeatedly |
| 359 | call this API until all the data has been injected. */ |
| 360 | int QL_LOC_Xtra_InjectData(loc_client_handle_type h_loc, |
| 361 | char *data, |
| 362 | int length); // QL_LOC_XTRA_FILE_DATA_SIZE_MAX |
| 363 | |
| 364 | #define QL_LOC_XTRA_FILE_DATA_SIZE_MAX 0xFC00 |
| 365 | /* Injects xtra data via file name. */ |
| 366 | int QL_LOC_Xtra_InjectFile( loc_client_handle_type h_loc, |
| 367 | char *filename); |
| 368 | |
| 369 | /** Indicates that the AGPS data connection is open. */ |
| 370 | int QL_LOC_Agps_DataConnOpen( loc_client_handle_type h_loc, |
| 371 | QL_LOC_AGPS_DATA_CONN_OPEN_INTO_T *pt_info); |
| 372 | |
| 373 | /** Indicates that the AGPS data connection is closed. */ |
| 374 | int QL_LOC_Agps_DataConnClose(loc_client_handle_type h_loc, |
| 375 | E_QL_LOC_AGPS_TYPE_T atype); |
| 376 | |
| 377 | /** Indicates that the AGPS data connection failed to start. */ |
| 378 | int QL_LOC_Agps_NfyDataConnFailed(loc_client_handle_type h_loc, |
| 379 | E_QL_LOC_AGPS_TYPE_T atype); |
| 380 | |
| 381 | /** Set AGPS server infor. */ |
| 382 | int QL_LOC_Agps_SetServer(loc_client_handle_type h_loc, |
| 383 | QL_LOC_AGPS_SERVER_INTO_T *pt_info); |
| 384 | |
| 385 | /** Sends a user response for NI. */ |
| 386 | int QL_LOC_NI_SetResponse(loc_client_handle_type h_loc, |
| 387 | QL_LOC_NI_RESPONSE_INTO_T *pt_info); |
| 388 | |
| 389 | /** Updates the network availability status. */ |
| 390 | int QL_LOC_Agps_UpdateNWAvailability(loc_client_handle_type h_loc, |
| 391 | int available, |
| 392 | const char *apn); |
| 393 | |
| 394 | /* |
| 395 | Usage 1 (Normally use): |
| 396 | 1, QL_LOC_Client_Init |
| 397 | 2, QL_LOC_AddRxIndMsgHandler(pf_cb) |
| 398 | 3, QL_LOC_Set_Indications |
| 399 | 4, QL_LOC_Start_Navigation |
| 400 | 5, handle the events in pf_cb |
| 401 | 6, QL_LOC_Stop_Navigation |
| 402 | 7, QL_LOC_Client_Deinit |
| 403 | |
| 404 | |
| 405 | Usage 2 (Just get position once): |
| 406 | 1, QL_LOC_Client_Init |
| 407 | 2, QL_LOC_AddRxIndMsgHandler(pf_cb) ---- This can be omitted! |
| 408 | 3, QL_LOC_Set_Indications, set bit_mask=LOC_IND_LOCATION_INFO_ON |
| 409 | 4, QL_LOC_Get_Current_Location, if not timeout, it will return current position infor or use last stored one. |
| 410 | 7, QL_LOC_Client_Deinit |
| 411 | */ |
| 412 | |
| 413 | #endif // __QL_MCM_GPS_H__ |
| 414 | |