Hridya Valsaraju | e596a71 | 2016-09-22 14:07:22 -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 | package android.hardware.gnss@1.0; |
| 18 | |
| 19 | /** Represents a GNSS navigation message (or a fragment of it). */ |
| 20 | interface IGnssNavigationMessageCallback { |
| 21 | /* |
| 22 | * Enumeration of available values to indicate the GNSS Navigation message |
| 23 | * types. |
| 24 | * |
| 25 | * For convenience, first byte is the GnssConstellationType on which that signal |
| 26 | * is typically transmitted. |
| 27 | */ |
| 28 | enum GnssNavigationMessageType : int16_t { |
Hridya Valsaraju | 97ecaa0 | 2016-11-02 10:20:07 -0700 | [diff] [blame] | 29 | UNKNOWN = 0, |
Hridya Valsaraju | e596a71 | 2016-09-22 14:07:22 -0700 | [diff] [blame] | 30 | /** GNSS L1 C/A message contained in the structure. */ |
| 31 | GNSS_L1CA = 0x0101, |
| 32 | /** GNSS L2-CNAV message contained in the structure. */ |
| 33 | GNSS_L2CNAV = 0x0102, |
| 34 | /** GNSS L5-CNAV message contained in the structure. */ |
| 35 | GNSS_L5CNAV = 0x0103, |
| 36 | /** GNSS CNAV-2 message contained in the structure. */ |
| 37 | GNSS_CNAV2 = 0x0104, |
| 38 | /** Glonass L1 CA message contained in the structure. */ |
| 39 | GLO_L1CA = 0x0301, |
| 40 | /** Beidou D1 message contained in the structure. */ |
| 41 | BDS_D1 = 0x0501, |
| 42 | /** Beidou D2 message contained in the structure. */ |
| 43 | BDS_D2 = 0x0502, |
| 44 | /** Galileo I/NAV message contained in the structure. */ |
| 45 | GAL_I = 0x0601, |
| 46 | /** Galileo F/NAV message contained in the structure. */ |
| 47 | GAL_F = 0x0602 |
| 48 | }; |
| 49 | |
| 50 | /* |
| 51 | * Status of Navigation Message |
| 52 | * When a message is received properly without any parity error in its |
| 53 | * navigation words, the status must be set to PARITY_PASSED. But if a message is |
| 54 | * received with words that failed parity check, but GNSS is able to correct |
| 55 | * those words, the status must be set to PARITY_REBUILT. |
| 56 | * No need to send any navigation message that contains words with parity error |
| 57 | * and cannot be corrected. |
| 58 | */ |
| 59 | enum NavigationMessageStatus : uint16_t { |
| 60 | PARITY_PASSED = (1 << 0), |
| 61 | PARITY_REBUILT = (1 << 1), |
Hridya Valsaraju | 97ecaa0 | 2016-11-02 10:20:07 -0700 | [diff] [blame] | 62 | UNKNOWN = 0 |
Hridya Valsaraju | e596a71 | 2016-09-22 14:07:22 -0700 | [diff] [blame] | 63 | }; |
| 64 | |
| 65 | struct GnssNavigationMessage { |
| 66 | /* |
| 67 | * Satellite vehicle ID number, as defined in GnssSvInfo::svid |
| 68 | * This is a mandatory value. |
| 69 | */ |
| 70 | int16_t svid; |
| 71 | |
| 72 | /* |
| 73 | * The type of message contained in the structure. |
| 74 | * This is a mandatory value. |
| 75 | */ |
| 76 | GnssNavigationMessageType type; |
| 77 | |
| 78 | /* |
| 79 | * The status of the received navigation message. |
| 80 | * No need to send any navigation message that contains words with parity |
| 81 | * error and cannot be corrected. |
| 82 | */ |
Yifan Hong | 7037fdb | 2016-12-05 17:16:09 -0800 | [diff] [blame^] | 83 | bitfield<NavigationMessageStatus> status; |
Hridya Valsaraju | e596a71 | 2016-09-22 14:07:22 -0700 | [diff] [blame] | 84 | |
| 85 | /* |
| 86 | * Message identifier. It provides an index so the complete Navigation |
| 87 | * Message can be assembled. |
| 88 | * |
| 89 | * - For GNSS L1 C/A subframe 4 and 5, this value corresponds to the 'frame |
| 90 | * id' of the navigation message, in the range of 1-25 (Subframe 1, 2, 3 |
| 91 | * does not contain a 'frame id' and this value can be set to -1.) |
| 92 | * |
| 93 | * - For Glonass L1 C/A, this refers to the frame ID, in the range of 1-5. |
| 94 | * |
| 95 | * - For BeiDou D1, this refers to the frame number in the range of 1-24 |
| 96 | * |
| 97 | * - For Beidou D2, this refers to the frame number, in the range of 1-120 |
| 98 | * |
| 99 | * - For Galileo F/NAV nominal frame structure, this refers to the subframe |
| 100 | * number, in the range of 1-12 |
| 101 | * |
| 102 | * - For Galileo I/NAV nominal frame structure, this refers to the subframe |
| 103 | * number in the range of 1-24 |
| 104 | */ |
| 105 | int16_t messageId; |
| 106 | |
| 107 | /* |
| 108 | * Sub-message identifier. If required by the message 'type', this value |
| 109 | * contains a sub-index within the current message (or frame) that is being |
| 110 | * transmitted. |
| 111 | * |
| 112 | * - For GNSS L1 C/A, BeiDou D1 & BeiDou D2, the submessage id corresponds to |
| 113 | * the subframe number of the navigation message, in the range of 1-5. |
| 114 | * |
| 115 | * - For Glonass L1 C/A, this refers to the String number, in the range from |
| 116 | * 1-15 |
| 117 | * |
| 118 | * - For Galileo F/NAV, this refers to the page type in the range 1-6 |
| 119 | * |
| 120 | * - For Galileo I/NAV, this refers to the word type in the range 1-10+ |
| 121 | */ |
| 122 | int16_t submessageId; |
| 123 | |
| 124 | /* |
| 125 | * The data of the reported GNSS message. The bytes (or words) are specified |
| 126 | * using big endian format (MSB first). The data is stored and decoded |
| 127 | * in a server for research purposes. |
| 128 | * |
| 129 | * - For GNSS L1 C/A, Beidou D1 & Beidou D2, each subframe contains 10 30-bit |
| 130 | * words. Each word (30 bits) must fit into the last 30 bits in a |
| 131 | * 4-byte word (skip B31 and B32), with MSB first, for a total of 40 |
| 132 | * bytes, covering a time period of 6, 6, and 0.6 seconds, respectively. |
| 133 | * The standard followed is 1995 SPS Signal specification. |
| 134 | * |
| 135 | * - For Glonass L1 C/A, each string contains 85 data bits, including the |
| 136 | * checksum. These bits must fit into 11 bytes, with MSB first (skip |
| 137 | * B86-B88), covering a time period of 2 seconds. |
| 138 | * The standard followed is Glonass Interface Control Document Edition 5.1. |
| 139 | * |
| 140 | * - For Galileo F/NAV, each word consists of 238-bit (sync & tail symbols |
| 141 | * excluded). Each word must fit into 30-bytes, with MSB first (skip |
| 142 | * B239, B240), covering a time period of 10 seconds. The standard |
| 143 | * followed is European GNSS(Galileo) Signal in Space Interface |
| 144 | * Control Document Issue 1.2. |
| 145 | * |
| 146 | * - For Galileo I/NAV, each page contains 2 page parts, even and odd, with |
| 147 | * a total of 2x114 = 228 bits, (sync & tail excluded) that must fit |
| 148 | * into 29 bytes, with MSB first (skip B229-B232). The standard followed |
| 149 | * is same as above. |
| 150 | * |
| 151 | * TODO(b/32022567): Describe this relationship with data to the VTS |
| 152 | * via custom annotations and plug in a VTS test to verify that the data |
| 153 | * correctly follows the standard. |
| 154 | * |
| 155 | */ |
| 156 | vec<uint8_t> data; |
| 157 | }; |
| 158 | |
| 159 | /* |
| 160 | * The callback to report an available fragment of a GNSS navigation messages |
| 161 | * from the HAL. |
| 162 | * |
| 163 | * @param message - The GNSS navigation submessage/subframe representation. |
| 164 | */ |
| 165 | gnssNavigationMessageCb(GnssNavigationMessage message); |
| 166 | }; |