Lifu Tang | df0fcf7 | 2015-10-27 14:58:25 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2016 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ANDROID_INCLUDE_HARDWARE_GPS_INTERNAL_H |
| 18 | #define ANDROID_INCLUDE_HARDWARE_GPS_INTERNAL_H |
| 19 | |
| 20 | #include "hardware/gps.h" |
| 21 | |
| 22 | /**************************************************************************** |
| 23 | * This file contains legacy structs that are deprecated/retired from gps.h * |
| 24 | ****************************************************************************/ |
| 25 | |
| 26 | __BEGIN_DECLS |
| 27 | |
| 28 | /** |
| 29 | * Legacy struct to represent SV status. |
| 30 | * See GpsSvStatus_v2 for more information. |
| 31 | */ |
| 32 | typedef struct { |
| 33 | /** set to sizeof(GpsSvStatus_v1) */ |
| 34 | size_t size; |
| 35 | int num_svs; |
| 36 | GpsSvInfo sv_list[GPS_MAX_SVS]; |
| 37 | uint32_t ephemeris_mask; |
| 38 | uint32_t almanac_mask; |
| 39 | uint32_t used_in_fix_mask; |
| 40 | } GpsSvStatus_v1; |
| 41 | |
| 42 | #pragma pack(push,4) |
| 43 | // We need to keep the alignment of this data structure to 4-bytes, to ensure that in 64-bit |
| 44 | // environments the size of this legacy definition does not collide with _v2. Implementations should |
| 45 | // be using _v2 and _v3, so it's OK to pay the 'unaligned' penalty in 64-bit if an old |
| 46 | // implementation is still in use. |
| 47 | |
| 48 | /** |
| 49 | * Legacy struct to represent the status of AGPS. |
| 50 | */ |
| 51 | typedef struct { |
| 52 | /** set to sizeof(AGpsStatus_v1) */ |
| 53 | size_t size; |
| 54 | AGpsType type; |
| 55 | AGpsStatusValue status; |
| 56 | } AGpsStatus_v1; |
| 57 | |
| 58 | #pragma pack(pop) |
| 59 | |
| 60 | /** |
| 61 | * Legacy struct to represent the status of AGPS augmented with a IPv4 address |
| 62 | * field. |
| 63 | */ |
| 64 | typedef struct { |
| 65 | /** set to sizeof(AGpsStatus_v2) */ |
| 66 | size_t size; |
| 67 | AGpsType type; |
| 68 | AGpsStatusValue status; |
| 69 | |
| 70 | /*-------------------- New fields in _v2 --------------------*/ |
| 71 | |
| 72 | uint32_t ipaddr; |
| 73 | } AGpsStatus_v2; |
| 74 | |
| 75 | /** |
| 76 | * Legacy extended interface for AGPS support. |
| 77 | * See AGpsInterface_v2 for more information. |
| 78 | */ |
| 79 | typedef struct { |
| 80 | /** set to sizeof(AGpsInterface_v1) */ |
| 81 | size_t size; |
| 82 | void (*init)( AGpsCallbacks* callbacks ); |
| 83 | int (*data_conn_open)( const char* apn ); |
| 84 | int (*data_conn_closed)(); |
| 85 | int (*data_conn_failed)(); |
| 86 | int (*set_server)( AGpsType type, const char* hostname, int port ); |
| 87 | } AGpsInterface_v1; |
| 88 | |
| 89 | /** |
| 90 | * Legacy struct to represent an estimate of the GPS clock time. |
| 91 | * See GpsClock_v2 for more details. |
| 92 | */ |
| 93 | typedef struct { |
| 94 | /** set to sizeof(GpsClock_v1) */ |
| 95 | size_t size; |
| 96 | GpsClockFlags flags; |
| 97 | int16_t leap_second; |
| 98 | GpsClockType type; |
| 99 | int64_t time_ns; |
| 100 | double time_uncertainty_ns; |
| 101 | int64_t full_bias_ns; |
| 102 | double bias_ns; |
| 103 | double bias_uncertainty_ns; |
| 104 | double drift_nsps; |
| 105 | double drift_uncertainty_nsps; |
| 106 | } GpsClock_v1; |
| 107 | |
| 108 | /** |
| 109 | * Legacy struct to represent a GPS Measurement, it contains raw and computed |
| 110 | * information. |
| 111 | * See GpsMeasurement_v2 for more details. |
| 112 | */ |
| 113 | typedef struct { |
| 114 | /** set to sizeof(GpsMeasurement_v1) */ |
| 115 | size_t size; |
| 116 | GpsMeasurementFlags flags; |
| 117 | int8_t prn; |
| 118 | double time_offset_ns; |
| 119 | GpsMeasurementState state; |
| 120 | int64_t received_gps_tow_ns; |
| 121 | int64_t received_gps_tow_uncertainty_ns; |
| 122 | double c_n0_dbhz; |
| 123 | double pseudorange_rate_mps; |
| 124 | double pseudorange_rate_uncertainty_mps; |
| 125 | GpsAccumulatedDeltaRangeState accumulated_delta_range_state; |
| 126 | double accumulated_delta_range_m; |
| 127 | double accumulated_delta_range_uncertainty_m; |
| 128 | double pseudorange_m; |
| 129 | double pseudorange_uncertainty_m; |
| 130 | double code_phase_chips; |
| 131 | double code_phase_uncertainty_chips; |
| 132 | float carrier_frequency_hz; |
| 133 | int64_t carrier_cycles; |
| 134 | double carrier_phase; |
| 135 | double carrier_phase_uncertainty; |
| 136 | GpsLossOfLock loss_of_lock; |
| 137 | int32_t bit_number; |
| 138 | int16_t time_from_last_bit_ms; |
| 139 | double doppler_shift_hz; |
| 140 | double doppler_shift_uncertainty_hz; |
| 141 | GpsMultipathIndicator multipath_indicator; |
| 142 | double snr_db; |
| 143 | double elevation_deg; |
| 144 | double elevation_uncertainty_deg; |
| 145 | double azimuth_deg; |
| 146 | double azimuth_uncertainty_deg; |
| 147 | bool used_in_fix; |
| 148 | } GpsMeasurement_v1; |
| 149 | |
| 150 | /** Represents a reading of GPS measurements. */ |
| 151 | typedef struct { |
| 152 | /** set to sizeof(GpsData_v1) */ |
| 153 | size_t size; |
| 154 | |
| 155 | /** Number of measurements. */ |
| 156 | size_t measurement_count; |
| 157 | |
| 158 | /** The array of measurements. */ |
| 159 | GpsMeasurement_v1 measurements[GPS_MAX_MEASUREMENT]; |
| 160 | |
| 161 | /** The GPS clock time reading. */ |
| 162 | GpsClock_v1 clock; |
| 163 | } GpsData_v1; |
| 164 | |
| 165 | __END_DECLS |
| 166 | |
| 167 | #endif /* ANDROID_INCLUDE_HARDWARE_GPS_INTERNAL_H */ |