Demo
Dependents: A_TeseoLocationNEW A_TeseoLocation
createTeseoGNSS.cpp@0:a77f1f1f8318, 2018-11-09 (annotated)
- Committer:
- apalmieri
- Date:
- Fri Nov 09 17:06:11 2018 +0000
- Revision:
- 0:a77f1f1f8318
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
apalmieri | 0:a77f1f1f8318 | 1 | /** |
apalmieri | 0:a77f1f1f8318 | 2 | ****************************************************************************** |
apalmieri | 0:a77f1f1f8318 | 3 | * @file createTeseoGNSS.cpp |
apalmieri | 0:a77f1f1f8318 | 4 | * @author AST/CL |
apalmieri | 0:a77f1f1f8318 | 5 | * @version V1.1.0 |
apalmieri | 0:a77f1f1f8318 | 6 | * @date May, 2017 |
apalmieri | 0:a77f1f1f8318 | 7 | * @brief . |
apalmieri | 0:a77f1f1f8318 | 8 | ****************************************************************************** |
apalmieri | 0:a77f1f1f8318 | 9 | * @attention |
apalmieri | 0:a77f1f1f8318 | 10 | * |
apalmieri | 0:a77f1f1f8318 | 11 | * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> |
apalmieri | 0:a77f1f1f8318 | 12 | * |
apalmieri | 0:a77f1f1f8318 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
apalmieri | 0:a77f1f1f8318 | 14 | * are permitted provided that the following conditions are met: |
apalmieri | 0:a77f1f1f8318 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
apalmieri | 0:a77f1f1f8318 | 16 | * this list of conditions and the following disclaimer. |
apalmieri | 0:a77f1f1f8318 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
apalmieri | 0:a77f1f1f8318 | 18 | * this list of conditions and the following disclaimer in the documentation |
apalmieri | 0:a77f1f1f8318 | 19 | * and/or other materials provided with the distribution. |
apalmieri | 0:a77f1f1f8318 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
apalmieri | 0:a77f1f1f8318 | 21 | * may be used to endorse or promote products derived from this software |
apalmieri | 0:a77f1f1f8318 | 22 | * without specific prior written permission. |
apalmieri | 0:a77f1f1f8318 | 23 | * |
apalmieri | 0:a77f1f1f8318 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
apalmieri | 0:a77f1f1f8318 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
apalmieri | 0:a77f1f1f8318 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
apalmieri | 0:a77f1f1f8318 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
apalmieri | 0:a77f1f1f8318 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
apalmieri | 0:a77f1f1f8318 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
apalmieri | 0:a77f1f1f8318 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
apalmieri | 0:a77f1f1f8318 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
apalmieri | 0:a77f1f1f8318 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
apalmieri | 0:a77f1f1f8318 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
apalmieri | 0:a77f1f1f8318 | 34 | * |
apalmieri | 0:a77f1f1f8318 | 35 | ****************************************************************************** |
apalmieri | 0:a77f1f1f8318 | 36 | */ |
apalmieri | 0:a77f1f1f8318 | 37 | |
apalmieri | 0:a77f1f1f8318 | 38 | #include "mbed.h" |
apalmieri | 0:a77f1f1f8318 | 39 | #include "Teseo.h" |
apalmieri | 0:a77f1f1f8318 | 40 | #include "GPSProviderImplBase.h" |
apalmieri | 0:a77f1f1f8318 | 41 | |
apalmieri | 0:a77f1f1f8318 | 42 | #include "TeseoConfig.h" |
apalmieri | 0:a77f1f1f8318 | 43 | |
apalmieri | 0:a77f1f1f8318 | 44 | static void _AppOutputCallback(uint32_t msgId, uint32_t msgType, tTeseoData *pData); |
apalmieri | 0:a77f1f1f8318 | 45 | static void _AppEventCallback(eTeseoLocEventType event, uint32_t data); |
apalmieri | 0:a77f1f1f8318 | 46 | static char msg[256]; |
apalmieri | 0:a77f1f1f8318 | 47 | |
apalmieri | 0:a77f1f1f8318 | 48 | static char *geofenceCirclePosition[] = { |
apalmieri | 0:a77f1f1f8318 | 49 | "Unknown", |
apalmieri | 0:a77f1f1f8318 | 50 | "Outside", |
apalmieri | 0:a77f1f1f8318 | 51 | "Boundary", |
apalmieri | 0:a77f1f1f8318 | 52 | "Inside" |
apalmieri | 0:a77f1f1f8318 | 53 | }; |
apalmieri | 0:a77f1f1f8318 | 54 | |
apalmieri | 0:a77f1f1f8318 | 55 | extern Serial serialDebug; |
apalmieri | 0:a77f1f1f8318 | 56 | #define TESEO_APP_LOG_INFO(...) serialDebug.printf(__VA_ARGS__) |
apalmieri | 0:a77f1f1f8318 | 57 | |
apalmieri | 0:a77f1f1f8318 | 58 | GPSProviderImplBase * |
apalmieri | 0:a77f1f1f8318 | 59 | createGPSProviderInstance(void) |
apalmieri | 0:a77f1f1f8318 | 60 | { |
apalmieri | 0:a77f1f1f8318 | 61 | static Teseo gnss(TESEO_PIN_RESET, |
apalmieri | 0:a77f1f1f8318 | 62 | TESEO_PIN_WAKEUP, |
apalmieri | 0:a77f1f1f8318 | 63 | TESEO_PIN_PPS, |
apalmieri | 0:a77f1f1f8318 | 64 | TESEO_PIN_TX, |
apalmieri | 0:a77f1f1f8318 | 65 | TESEO_PIN_RX, |
apalmieri | 0:a77f1f1f8318 | 66 | &serialDebug); |
apalmieri | 0:a77f1f1f8318 | 67 | |
apalmieri | 0:a77f1f1f8318 | 68 | /* Register output callback and event callback functions */ |
apalmieri | 0:a77f1f1f8318 | 69 | gnss.TeseoLocRegOutput(_AppOutputCallback, _AppEventCallback); |
apalmieri | 0:a77f1f1f8318 | 70 | |
apalmieri | 0:a77f1f1f8318 | 71 | return &gnss; |
apalmieri | 0:a77f1f1f8318 | 72 | } |
apalmieri | 0:a77f1f1f8318 | 73 | |
apalmieri | 0:a77f1f1f8318 | 74 | /** |
apalmieri | 0:a77f1f1f8318 | 75 | * @brief This function prints on the console the info about Fix data for single or combined satellite navigation system |
apalmieri | 0:a77f1f1f8318 | 76 | * @param pData |
apalmieri | 0:a77f1f1f8318 | 77 | * @retval None |
apalmieri | 0:a77f1f1f8318 | 78 | */ |
apalmieri | 0:a77f1f1f8318 | 79 | static void |
apalmieri | 0:a77f1f1f8318 | 80 | GetGNSMsgInfos(tTeseoData *pData) |
apalmieri | 0:a77f1f1f8318 | 81 | { |
apalmieri | 0:a77f1f1f8318 | 82 | // char msg[256]; |
apalmieri | 0:a77f1f1f8318 | 83 | |
apalmieri | 0:a77f1f1f8318 | 84 | TESEO_APP_LOG_INFO("\r\n"); |
apalmieri | 0:a77f1f1f8318 | 85 | |
apalmieri | 0:a77f1f1f8318 | 86 | sprintf(msg, "Constellation:\t\t[ %s ]\t", |
apalmieri | 0:a77f1f1f8318 | 87 | pData->gns_data.constellation); |
apalmieri | 0:a77f1f1f8318 | 88 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 89 | |
apalmieri | 0:a77f1f1f8318 | 90 | if (strcmp(pData->gns_data.constellation, "$GPGSV") == 0) { |
apalmieri | 0:a77f1f1f8318 | 91 | TESEO_APP_LOG_INFO("-- only GPS constellation is enabled\n\r"); |
apalmieri | 0:a77f1f1f8318 | 92 | } |
apalmieri | 0:a77f1f1f8318 | 93 | else if (strcmp(pData->gns_data.constellation, "$GLGSV") == 0) { |
apalmieri | 0:a77f1f1f8318 | 94 | TESEO_APP_LOG_INFO("-- only GLONASS constellation is enabled\n\r"); |
apalmieri | 0:a77f1f1f8318 | 95 | } |
apalmieri | 0:a77f1f1f8318 | 96 | else if (strcmp(pData->gns_data.constellation, "$GAGSV") == 0) { |
apalmieri | 0:a77f1f1f8318 | 97 | TESEO_APP_LOG_INFO("-- only GALILEO constellation is enabled\n\r"); |
apalmieri | 0:a77f1f1f8318 | 98 | } |
apalmieri | 0:a77f1f1f8318 | 99 | else if (strcmp(pData->gns_data.constellation, "$BDGSV") == 0) { |
apalmieri | 0:a77f1f1f8318 | 100 | TESEO_APP_LOG_INFO("-- only BEIDOU constellation is enabled\n\r"); |
apalmieri | 0:a77f1f1f8318 | 101 | } |
apalmieri | 0:a77f1f1f8318 | 102 | else if (strcmp(pData->gns_data.constellation, "$QZGSV") == 0) { |
apalmieri | 0:a77f1f1f8318 | 103 | TESEO_APP_LOG_INFO("-- only QZSS constellation is enabled\n\r"); |
apalmieri | 0:a77f1f1f8318 | 104 | } |
apalmieri | 0:a77f1f1f8318 | 105 | else if (strcmp(pData->gns_data.constellation, "$GNGSV") == 0) { |
apalmieri | 0:a77f1f1f8318 | 106 | TESEO_APP_LOG_INFO("-- message to report all satellites for all enabled constellations\n\r"); |
apalmieri | 0:a77f1f1f8318 | 107 | } |
apalmieri | 0:a77f1f1f8318 | 108 | |
apalmieri | 0:a77f1f1f8318 | 109 | sprintf(msg, "UTC:\t\t\t[ %02d:%02d:%02d ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 110 | pData->gns_data.utc.hh, |
apalmieri | 0:a77f1f1f8318 | 111 | pData->gns_data.utc.mm, |
apalmieri | 0:a77f1f1f8318 | 112 | pData->gns_data.utc.ss); |
apalmieri | 0:a77f1f1f8318 | 113 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 114 | |
apalmieri | 0:a77f1f1f8318 | 115 | sprintf(msg,"Latitude:\t\t[ %.0f' %d'' %c ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 116 | (pData->gns_data.xyz.lat - ((int)pData->gns_data.xyz.lat % 100)) / 100, |
apalmieri | 0:a77f1f1f8318 | 117 | ((int)pData->gns_data.xyz.lat % 100), |
apalmieri | 0:a77f1f1f8318 | 118 | pData->gns_data.xyz.ns); |
apalmieri | 0:a77f1f1f8318 | 119 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 120 | |
apalmieri | 0:a77f1f1f8318 | 121 | sprintf(msg,"Longitude:\t\t[ %.0f' %d'' %c ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 122 | (pData->gns_data.xyz.lon - ((int)pData->gns_data.xyz.lon % 100)) / 100, |
apalmieri | 0:a77f1f1f8318 | 123 | ((int)pData->gns_data.xyz.lon % 100), |
apalmieri | 0:a77f1f1f8318 | 124 | pData->gns_data.xyz.ew); |
apalmieri | 0:a77f1f1f8318 | 125 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 126 | |
apalmieri | 0:a77f1f1f8318 | 127 | sprintf(msg,"Satellites locked:\t[ %d ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 128 | pData->gns_data.sats); |
apalmieri | 0:a77f1f1f8318 | 129 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 130 | |
apalmieri | 0:a77f1f1f8318 | 131 | sprintf(msg,"HDOP:\t\t\t[ %.01f ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 132 | pData->gns_data.hdop); |
apalmieri | 0:a77f1f1f8318 | 133 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 134 | |
apalmieri | 0:a77f1f1f8318 | 135 | sprintf(msg,"Altitude:\t\t[ %.01f ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 136 | pData->gns_data.xyz.alt); |
apalmieri | 0:a77f1f1f8318 | 137 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 138 | |
apalmieri | 0:a77f1f1f8318 | 139 | sprintf(msg,"Geoid infos:\t\t[ %.01f ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 140 | pData->gns_data.geo_sep); |
apalmieri | 0:a77f1f1f8318 | 141 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 142 | |
apalmieri | 0:a77f1f1f8318 | 143 | // sprintf(msg,"ID - Checksum:\t\t[ *%x ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 144 | // (pData->gns_data.checksum); |
apalmieri | 0:a77f1f1f8318 | 145 | // TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 146 | |
apalmieri | 0:a77f1f1f8318 | 147 | TESEO_APP_LOG_INFO("\n\n\r"); |
apalmieri | 0:a77f1f1f8318 | 148 | |
apalmieri | 0:a77f1f1f8318 | 149 | return; |
apalmieri | 0:a77f1f1f8318 | 150 | } |
apalmieri | 0:a77f1f1f8318 | 151 | |
apalmieri | 0:a77f1f1f8318 | 152 | /** |
apalmieri | 0:a77f1f1f8318 | 153 | * @brief This function prints on the console the info about GPS Pseudorange Noise Statistics |
apalmieri | 0:a77f1f1f8318 | 154 | * @param pData |
apalmieri | 0:a77f1f1f8318 | 155 | * @retval None |
apalmieri | 0:a77f1f1f8318 | 156 | */ |
apalmieri | 0:a77f1f1f8318 | 157 | static void |
apalmieri | 0:a77f1f1f8318 | 158 | GetGPGSTInfos(tTeseoData *pData) |
apalmieri | 0:a77f1f1f8318 | 159 | { |
apalmieri | 0:a77f1f1f8318 | 160 | // char msg[256]; |
apalmieri | 0:a77f1f1f8318 | 161 | |
apalmieri | 0:a77f1f1f8318 | 162 | TESEO_APP_LOG_INFO("\r\n"); |
apalmieri | 0:a77f1f1f8318 | 163 | |
apalmieri | 0:a77f1f1f8318 | 164 | sprintf(msg, "UTC:\t\t\t[ %02d:%02d:%02d ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 165 | pData->gpgst_data.utc.hh, |
apalmieri | 0:a77f1f1f8318 | 166 | pData->gpgst_data.utc.mm, |
apalmieri | 0:a77f1f1f8318 | 167 | pData->gpgst_data.utc.ss); |
apalmieri | 0:a77f1f1f8318 | 168 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 169 | |
apalmieri | 0:a77f1f1f8318 | 170 | sprintf(msg,"EHPE:\t\t[ %.01f ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 171 | pData->gpgst_data.EHPE); |
apalmieri | 0:a77f1f1f8318 | 172 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 173 | |
apalmieri | 0:a77f1f1f8318 | 174 | sprintf(msg,"Semi-major Dev:\t\t[ %.01f ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 175 | pData->gpgst_data.semi_major_dev); |
apalmieri | 0:a77f1f1f8318 | 176 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 177 | |
apalmieri | 0:a77f1f1f8318 | 178 | sprintf(msg,"Semi-minor Dev:\t\t[ %.01f ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 179 | pData->gpgst_data.semi_minor_dev); |
apalmieri | 0:a77f1f1f8318 | 180 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 181 | |
apalmieri | 0:a77f1f1f8318 | 182 | sprintf(msg,"Semi-maior Angle:\t\t[ %.01f ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 183 | pData->gpgst_data.semi_major_angle); |
apalmieri | 0:a77f1f1f8318 | 184 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 185 | |
apalmieri | 0:a77f1f1f8318 | 186 | sprintf(msg,"Lat Err Dev:\t\t[ %.01f ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 187 | pData->gpgst_data.lat_err_dev); |
apalmieri | 0:a77f1f1f8318 | 188 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 189 | |
apalmieri | 0:a77f1f1f8318 | 190 | sprintf(msg,"Lon Err Dev:\t\t[ %.01f ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 191 | pData->gpgst_data.lon_err_dev); |
apalmieri | 0:a77f1f1f8318 | 192 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 193 | |
apalmieri | 0:a77f1f1f8318 | 194 | sprintf(msg,"Alt Err Dev:\t\t[ %.01f ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 195 | pData->gpgst_data.alt_err_dev); |
apalmieri | 0:a77f1f1f8318 | 196 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 197 | |
apalmieri | 0:a77f1f1f8318 | 198 | // sprintf(msg,"ID - Checksum:\t\t[ *%x ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 199 | // pData->gpgst_data.checksum); |
apalmieri | 0:a77f1f1f8318 | 200 | // TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 201 | |
apalmieri | 0:a77f1f1f8318 | 202 | TESEO_APP_LOG_INFO("\n\n\r"); |
apalmieri | 0:a77f1f1f8318 | 203 | |
apalmieri | 0:a77f1f1f8318 | 204 | return; |
apalmieri | 0:a77f1f1f8318 | 205 | } |
apalmieri | 0:a77f1f1f8318 | 206 | |
apalmieri | 0:a77f1f1f8318 | 207 | /** |
apalmieri | 0:a77f1f1f8318 | 208 | * @brief This function prints on the console the info about Recommended Minimum Specific GPS/Transit data got by the most recent reception process |
apalmieri | 0:a77f1f1f8318 | 209 | * @param pData |
apalmieri | 0:a77f1f1f8318 | 210 | * @retval None |
apalmieri | 0:a77f1f1f8318 | 211 | */ |
apalmieri | 0:a77f1f1f8318 | 212 | static void |
apalmieri | 0:a77f1f1f8318 | 213 | GetGPRMCInfos(tTeseoData *pData) |
apalmieri | 0:a77f1f1f8318 | 214 | { |
apalmieri | 0:a77f1f1f8318 | 215 | // char msg[256]; |
apalmieri | 0:a77f1f1f8318 | 216 | |
apalmieri | 0:a77f1f1f8318 | 217 | TESEO_APP_LOG_INFO("\r\n"); |
apalmieri | 0:a77f1f1f8318 | 218 | |
apalmieri | 0:a77f1f1f8318 | 219 | sprintf(msg, "UTC:\t\t\t\t[ %02d:%02d:%02d ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 220 | pData->gprmc_data.utc.hh, |
apalmieri | 0:a77f1f1f8318 | 221 | pData->gprmc_data.utc.mm, |
apalmieri | 0:a77f1f1f8318 | 222 | pData->gprmc_data.utc.ss); |
apalmieri | 0:a77f1f1f8318 | 223 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 224 | |
apalmieri | 0:a77f1f1f8318 | 225 | sprintf(msg,"Status:\t\t\t\t[ %c ]\t\t", |
apalmieri | 0:a77f1f1f8318 | 226 | pData->gprmc_data.status); |
apalmieri | 0:a77f1f1f8318 | 227 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 228 | if (pData->gprmc_data.status == 'A') { |
apalmieri | 0:a77f1f1f8318 | 229 | TESEO_APP_LOG_INFO("-- Valid (reported in 2D and 3D fix conditions)\n\r"); |
apalmieri | 0:a77f1f1f8318 | 230 | } |
apalmieri | 0:a77f1f1f8318 | 231 | else if (pData->gprmc_data.status == 'V') { |
apalmieri | 0:a77f1f1f8318 | 232 | TESEO_APP_LOG_INFO("-- Warning (reported in NO FIX conditions)\n\r"); |
apalmieri | 0:a77f1f1f8318 | 233 | } |
apalmieri | 0:a77f1f1f8318 | 234 | else { |
apalmieri | 0:a77f1f1f8318 | 235 | TESEO_APP_LOG_INFO("-- Unknown status\n\r"); |
apalmieri | 0:a77f1f1f8318 | 236 | } |
apalmieri | 0:a77f1f1f8318 | 237 | |
apalmieri | 0:a77f1f1f8318 | 238 | sprintf(msg,"Latitude:\t\t\t[ %.0f' %02d'' %c ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 239 | ((pData->gprmc_data.xyz.lat - ((int)pData->gprmc_data.xyz.lat % 100))) / 100, |
apalmieri | 0:a77f1f1f8318 | 240 | ((int)pData->gprmc_data.xyz.lat % 100), |
apalmieri | 0:a77f1f1f8318 | 241 | pData->gprmc_data.xyz.ns); |
apalmieri | 0:a77f1f1f8318 | 242 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 243 | |
apalmieri | 0:a77f1f1f8318 | 244 | sprintf(msg,"Longitude:\t\t\t[ %.0f' %02d'' %c ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 245 | ((pData->gprmc_data.xyz.lon - ((int)pData->gprmc_data.xyz.lon % 100))) / 100, |
apalmieri | 0:a77f1f1f8318 | 246 | ((int)pData->gprmc_data.xyz.lon % 100), |
apalmieri | 0:a77f1f1f8318 | 247 | pData->gprmc_data.xyz.ew); |
apalmieri | 0:a77f1f1f8318 | 248 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 249 | |
apalmieri | 0:a77f1f1f8318 | 250 | sprintf(msg,"Speed over ground (knots):\t[ %.01f ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 251 | pData->gprmc_data.speed); |
apalmieri | 0:a77f1f1f8318 | 252 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 253 | |
apalmieri | 0:a77f1f1f8318 | 254 | sprintf(msg,"Trackgood:\t\t\t[ %.01f ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 255 | pData->gprmc_data.trackgood); |
apalmieri | 0:a77f1f1f8318 | 256 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 257 | |
apalmieri | 0:a77f1f1f8318 | 258 | sprintf(msg,"Date (ddmmyy):\t\t\t[ %d ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 259 | pData->gprmc_data.date); |
apalmieri | 0:a77f1f1f8318 | 260 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 261 | |
apalmieri | 0:a77f1f1f8318 | 262 | sprintf(msg,"Magnetic Variation:\t\t[ %.01f ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 263 | pData->gprmc_data.mag_var); |
apalmieri | 0:a77f1f1f8318 | 264 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 265 | |
apalmieri | 0:a77f1f1f8318 | 266 | if (pData->gprmc_data.mag_var_dir != 'E' && |
apalmieri | 0:a77f1f1f8318 | 267 | pData->gprmc_data.mag_var_dir != 'W') { |
apalmieri | 0:a77f1f1f8318 | 268 | sprintf(msg,"Magnetic Var. Direction:\t[ - ]\n\r"); |
apalmieri | 0:a77f1f1f8318 | 269 | } |
apalmieri | 0:a77f1f1f8318 | 270 | else { |
apalmieri | 0:a77f1f1f8318 | 271 | sprintf(msg,"Magnetic Var. Direction:\t[ %c ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 272 | pData->gprmc_data.mag_var_dir); |
apalmieri | 0:a77f1f1f8318 | 273 | } |
apalmieri | 0:a77f1f1f8318 | 274 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 275 | |
apalmieri | 0:a77f1f1f8318 | 276 | // sprintf(msg,"Checksum:\t\t[ *%x ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 277 | // pData->gprmc_data.checksum); |
apalmieri | 0:a77f1f1f8318 | 278 | // TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 279 | |
apalmieri | 0:a77f1f1f8318 | 280 | TESEO_APP_LOG_INFO("\n\n\r"); |
apalmieri | 0:a77f1f1f8318 | 281 | |
apalmieri | 0:a77f1f1f8318 | 282 | return; |
apalmieri | 0:a77f1f1f8318 | 283 | } |
apalmieri | 0:a77f1f1f8318 | 284 | |
apalmieri | 0:a77f1f1f8318 | 285 | /** |
apalmieri | 0:a77f1f1f8318 | 286 | * @brief This function prints on the console the info about GNSS satellites got by the most recent reception process |
apalmieri | 0:a77f1f1f8318 | 287 | * @param pData |
apalmieri | 0:a77f1f1f8318 | 288 | * @retval None |
apalmieri | 0:a77f1f1f8318 | 289 | */ |
apalmieri | 0:a77f1f1f8318 | 290 | static void |
apalmieri | 0:a77f1f1f8318 | 291 | GetGSAMsgInfos(tTeseoData *pData) |
apalmieri | 0:a77f1f1f8318 | 292 | { |
apalmieri | 0:a77f1f1f8318 | 293 | // char msg[256]; |
apalmieri | 0:a77f1f1f8318 | 294 | |
apalmieri | 0:a77f1f1f8318 | 295 | TESEO_APP_LOG_INFO("\r\n"); |
apalmieri | 0:a77f1f1f8318 | 296 | |
apalmieri | 0:a77f1f1f8318 | 297 | sprintf(msg, "Constellation:\t\t[ %s ]\t", |
apalmieri | 0:a77f1f1f8318 | 298 | pData->gsa_data.constellation); |
apalmieri | 0:a77f1f1f8318 | 299 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 300 | |
apalmieri | 0:a77f1f1f8318 | 301 | if (strcmp(pData->gsa_data.constellation, "$GPGSA") == 0) { |
apalmieri | 0:a77f1f1f8318 | 302 | TESEO_APP_LOG_INFO("-- only GPS constellation is enabled\n\r"); |
apalmieri | 0:a77f1f1f8318 | 303 | } |
apalmieri | 0:a77f1f1f8318 | 304 | else if (strcmp(pData->gsa_data.constellation, "$GLGSA") == 0) { |
apalmieri | 0:a77f1f1f8318 | 305 | TESEO_APP_LOG_INFO("-- only GLONASS constellation is enabled\n\r"); |
apalmieri | 0:a77f1f1f8318 | 306 | } |
apalmieri | 0:a77f1f1f8318 | 307 | else if (strcmp(pData->gsa_data.constellation, "$GAGSA") == 0) { |
apalmieri | 0:a77f1f1f8318 | 308 | TESEO_APP_LOG_INFO("-- only GALILEO constellation is enabled\n\r"); |
apalmieri | 0:a77f1f1f8318 | 309 | } |
apalmieri | 0:a77f1f1f8318 | 310 | else if (strcmp(pData->gsa_data.constellation, "$BDGSA") == 0) { |
apalmieri | 0:a77f1f1f8318 | 311 | TESEO_APP_LOG_INFO("-- only BEIDOU constellation is enabled\n\r"); |
apalmieri | 0:a77f1f1f8318 | 312 | } |
apalmieri | 0:a77f1f1f8318 | 313 | else if (strcmp(pData->gsa_data.constellation, "$GNGSA") == 0) { |
apalmieri | 0:a77f1f1f8318 | 314 | TESEO_APP_LOG_INFO("-- more than one constellation is enabled\n\r"); |
apalmieri | 0:a77f1f1f8318 | 315 | } |
apalmieri | 0:a77f1f1f8318 | 316 | |
apalmieri | 0:a77f1f1f8318 | 317 | sprintf(msg, "Operating Mode:\t\t[ %c ]\t\t", |
apalmieri | 0:a77f1f1f8318 | 318 | pData->gsa_data.operating_mode); |
apalmieri | 0:a77f1f1f8318 | 319 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 320 | if (pData->gsa_data.operating_mode == 'A') { |
apalmieri | 0:a77f1f1f8318 | 321 | TESEO_APP_LOG_INFO("-- Auto (2D/3D)\n\r"); |
apalmieri | 0:a77f1f1f8318 | 322 | } |
apalmieri | 0:a77f1f1f8318 | 323 | else if (pData->gsa_data.operating_mode == 'M') { |
apalmieri | 0:a77f1f1f8318 | 324 | TESEO_APP_LOG_INFO("-- Manual\n\r"); |
apalmieri | 0:a77f1f1f8318 | 325 | } |
apalmieri | 0:a77f1f1f8318 | 326 | |
apalmieri | 0:a77f1f1f8318 | 327 | sprintf(msg,"Current Mode:\t\t[ %d ]\t\t", |
apalmieri | 0:a77f1f1f8318 | 328 | pData->gsa_data.current_mode); |
apalmieri | 0:a77f1f1f8318 | 329 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 330 | if (pData->gsa_data.current_mode == 1) { |
apalmieri | 0:a77f1f1f8318 | 331 | TESEO_APP_LOG_INFO("-- no fix available\n\r"); |
apalmieri | 0:a77f1f1f8318 | 332 | } |
apalmieri | 0:a77f1f1f8318 | 333 | else if (pData->gsa_data.current_mode == 2) { |
apalmieri | 0:a77f1f1f8318 | 334 | TESEO_APP_LOG_INFO("-- 2D\n\r"); |
apalmieri | 0:a77f1f1f8318 | 335 | } |
apalmieri | 0:a77f1f1f8318 | 336 | else if (pData->gsa_data.current_mode == 3) { |
apalmieri | 0:a77f1f1f8318 | 337 | TESEO_APP_LOG_INFO("-- 3D\n\r"); |
apalmieri | 0:a77f1f1f8318 | 338 | } |
apalmieri | 0:a77f1f1f8318 | 339 | |
apalmieri | 0:a77f1f1f8318 | 340 | for (uint8_t i=0; i<12; i++) { |
apalmieri | 0:a77f1f1f8318 | 341 | sprintf(msg,"SatPRN%02d:\t\t[ %d ]\n\r", i+1, |
apalmieri | 0:a77f1f1f8318 | 342 | pData->gsa_data.sat_prn[i]); |
apalmieri | 0:a77f1f1f8318 | 343 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 344 | } |
apalmieri | 0:a77f1f1f8318 | 345 | |
apalmieri | 0:a77f1f1f8318 | 346 | sprintf(msg,"PDOP:\t\t\t[ %.01f ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 347 | pData->gsa_data.pdop); |
apalmieri | 0:a77f1f1f8318 | 348 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 349 | |
apalmieri | 0:a77f1f1f8318 | 350 | sprintf(msg,"HDOP:\t\t\t[ %.01f ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 351 | pData->gsa_data.hdop); |
apalmieri | 0:a77f1f1f8318 | 352 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 353 | |
apalmieri | 0:a77f1f1f8318 | 354 | sprintf(msg,"VDOP:\t\t\t[ %.01f ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 355 | pData->gsa_data.vdop); |
apalmieri | 0:a77f1f1f8318 | 356 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 357 | |
apalmieri | 0:a77f1f1f8318 | 358 | // sprintf(msg,"ID - Checksum:\t\t[ *%x ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 359 | // pData->gsa_data.checksum); |
apalmieri | 0:a77f1f1f8318 | 360 | // TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 361 | |
apalmieri | 0:a77f1f1f8318 | 362 | TESEO_APP_LOG_INFO("\n\n\r"); |
apalmieri | 0:a77f1f1f8318 | 363 | |
apalmieri | 0:a77f1f1f8318 | 364 | } |
apalmieri | 0:a77f1f1f8318 | 365 | |
apalmieri | 0:a77f1f1f8318 | 366 | /** |
apalmieri | 0:a77f1f1f8318 | 367 | * @brief This function prints on the console the info about GNSS satellites got by the most recent reception process |
apalmieri | 0:a77f1f1f8318 | 368 | * @param pData |
apalmieri | 0:a77f1f1f8318 | 369 | * @retval None |
apalmieri | 0:a77f1f1f8318 | 370 | */ |
apalmieri | 0:a77f1f1f8318 | 371 | static void |
apalmieri | 0:a77f1f1f8318 | 372 | GetGSVMsgInfos(tTeseoData *pData) |
apalmieri | 0:a77f1f1f8318 | 373 | { |
apalmieri | 0:a77f1f1f8318 | 374 | uint8_t i; |
apalmieri | 0:a77f1f1f8318 | 375 | uint8_t tot_sats = pData->gsv_data.tot_sats; |
apalmieri | 0:a77f1f1f8318 | 376 | // char msg[256]; |
apalmieri | 0:a77f1f1f8318 | 377 | |
apalmieri | 0:a77f1f1f8318 | 378 | char degree_sym = 248; |
apalmieri | 0:a77f1f1f8318 | 379 | |
apalmieri | 0:a77f1f1f8318 | 380 | TESEO_APP_LOG_INFO("\r\n"); |
apalmieri | 0:a77f1f1f8318 | 381 | |
apalmieri | 0:a77f1f1f8318 | 382 | sprintf(msg, "Constellation:\t\t[ %s ]\t", |
apalmieri | 0:a77f1f1f8318 | 383 | pData->gsv_data.constellation); |
apalmieri | 0:a77f1f1f8318 | 384 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 385 | |
apalmieri | 0:a77f1f1f8318 | 386 | if (strcmp(pData->gsv_data.constellation, "$GPGSV") == 0) { |
apalmieri | 0:a77f1f1f8318 | 387 | TESEO_APP_LOG_INFO("-- message to report all GPS satellites\n\r"); |
apalmieri | 0:a77f1f1f8318 | 388 | } |
apalmieri | 0:a77f1f1f8318 | 389 | else if (strcmp(pData->gsv_data.constellation, "$GLGSV") == 0) { |
apalmieri | 0:a77f1f1f8318 | 390 | TESEO_APP_LOG_INFO("-- message to report all GLONASS satellites\n\r"); |
apalmieri | 0:a77f1f1f8318 | 391 | } |
apalmieri | 0:a77f1f1f8318 | 392 | else if (strcmp(pData->gsv_data.constellation, "$GAGSV") == 0) { |
apalmieri | 0:a77f1f1f8318 | 393 | TESEO_APP_LOG_INFO("-- message to report all GALILEO satellites\n\r"); |
apalmieri | 0:a77f1f1f8318 | 394 | } |
apalmieri | 0:a77f1f1f8318 | 395 | else if (strcmp(pData->gsv_data.constellation, "$BDGSV") == 0) { |
apalmieri | 0:a77f1f1f8318 | 396 | TESEO_APP_LOG_INFO("-- message to report all BEIDOU satellites\n\r"); |
apalmieri | 0:a77f1f1f8318 | 397 | } |
apalmieri | 0:a77f1f1f8318 | 398 | else if (strcmp(pData->gsv_data.constellation, "$QZGSV") == 0) { |
apalmieri | 0:a77f1f1f8318 | 399 | TESEO_APP_LOG_INFO("-- message to report all QZSS satellites\n\r"); |
apalmieri | 0:a77f1f1f8318 | 400 | } |
apalmieri | 0:a77f1f1f8318 | 401 | else if (strcmp(pData->gsv_data.constellation, "$GNGSV") == 0) { |
apalmieri | 0:a77f1f1f8318 | 402 | TESEO_APP_LOG_INFO("-- message to report all satellites for all enabled constellations\n\r"); |
apalmieri | 0:a77f1f1f8318 | 403 | } |
apalmieri | 0:a77f1f1f8318 | 404 | |
apalmieri | 0:a77f1f1f8318 | 405 | /* debug */ |
apalmieri | 0:a77f1f1f8318 | 406 | // sprintf(msg,"Tot Messages:\t\t[ %d ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 407 | // ((tTeseoData *)(handle->pData))->gsv_data.amount); |
apalmieri | 0:a77f1f1f8318 | 408 | // TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 409 | // |
apalmieri | 0:a77f1f1f8318 | 410 | // sprintf(msg,"Message Num:\t\t[ %d ]\n\r", |
apalmieri | 0:a77f1f1f8318 | 411 | // ((tTeseoData *)(handle->pData))->gsv_data.number); |
apalmieri | 0:a77f1f1f8318 | 412 | // TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 413 | |
apalmieri | 0:a77f1f1f8318 | 414 | sprintf(msg,"Num of Satellites:\t[ %d ]\n\r", tot_sats); |
apalmieri | 0:a77f1f1f8318 | 415 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 416 | |
apalmieri | 0:a77f1f1f8318 | 417 | TESEO_APP_LOG_INFO("\n\r"); |
apalmieri | 0:a77f1f1f8318 | 418 | |
apalmieri | 0:a77f1f1f8318 | 419 | for (i=0; i<tot_sats; i++) { |
apalmieri | 0:a77f1f1f8318 | 420 | sprintf(msg,"Sat%02dPRN:\t\t[ %03d ]\n\r", i+1, |
apalmieri | 0:a77f1f1f8318 | 421 | pData->gsv_data.gsv_sat_i[i].prn); |
apalmieri | 0:a77f1f1f8318 | 422 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 423 | |
apalmieri | 0:a77f1f1f8318 | 424 | sprintf(msg,"Sat%02dElev (%c):\t\t[ %03d ]\n\r", i+1, degree_sym, |
apalmieri | 0:a77f1f1f8318 | 425 | pData->gsv_data.gsv_sat_i[i].elev); |
apalmieri | 0:a77f1f1f8318 | 426 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 427 | |
apalmieri | 0:a77f1f1f8318 | 428 | sprintf(msg,"Sat%02dAzim (%c):\t\t[ %03d ]\n\r", i+1, degree_sym, |
apalmieri | 0:a77f1f1f8318 | 429 | pData->gsv_data.gsv_sat_i[i].azim); |
apalmieri | 0:a77f1f1f8318 | 430 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 431 | |
apalmieri | 0:a77f1f1f8318 | 432 | sprintf(msg,"Sat%02dCN0 (dB):\t\t[ %03d ]\n\r", i+1, |
apalmieri | 0:a77f1f1f8318 | 433 | pData->gsv_data.gsv_sat_i[i].cn0); |
apalmieri | 0:a77f1f1f8318 | 434 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 435 | |
apalmieri | 0:a77f1f1f8318 | 436 | TESEO_APP_LOG_INFO("\n\r"); |
apalmieri | 0:a77f1f1f8318 | 437 | } |
apalmieri | 0:a77f1f1f8318 | 438 | |
apalmieri | 0:a77f1f1f8318 | 439 | TESEO_APP_LOG_INFO("\r\n"); |
apalmieri | 0:a77f1f1f8318 | 440 | |
apalmieri | 0:a77f1f1f8318 | 441 | } |
apalmieri | 0:a77f1f1f8318 | 442 | |
apalmieri | 0:a77f1f1f8318 | 443 | /** |
apalmieri | 0:a77f1f1f8318 | 444 | * @brief This function prints on the console the info Geofence |
apalmieri | 0:a77f1f1f8318 | 445 | * @param pData |
apalmieri | 0:a77f1f1f8318 | 446 | * @retval None |
apalmieri | 0:a77f1f1f8318 | 447 | */ |
apalmieri | 0:a77f1f1f8318 | 448 | static void |
apalmieri | 0:a77f1f1f8318 | 449 | GetGeofenceInfos(tTeseoData *pData) |
apalmieri | 0:a77f1f1f8318 | 450 | { |
apalmieri | 0:a77f1f1f8318 | 451 | // char msg[256]; |
apalmieri | 0:a77f1f1f8318 | 452 | |
apalmieri | 0:a77f1f1f8318 | 453 | TESEO_APP_LOG_INFO("\r\n"); |
apalmieri | 0:a77f1f1f8318 | 454 | |
apalmieri | 0:a77f1f1f8318 | 455 | if(pData->geofence_data.op == GNSS_FEATURE_EN_MSG) { |
apalmieri | 0:a77f1f1f8318 | 456 | sprintf(msg, "Geofence Enabling:\t\t[ %s ]\t", |
apalmieri | 0:a77f1f1f8318 | 457 | pData->geofence_data.result ? "ERROR" : "OK"); |
apalmieri | 0:a77f1f1f8318 | 458 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 459 | } |
apalmieri | 0:a77f1f1f8318 | 460 | if(pData->geofence_data.op == GNSS_GEOFENCE_CFG_MSG) { |
apalmieri | 0:a77f1f1f8318 | 461 | sprintf(msg, "Geofence Configuration:\t\t[ %s ]\t", |
apalmieri | 0:a77f1f1f8318 | 462 | pData->geofence_data.result ? "ERROR" : "OK"); |
apalmieri | 0:a77f1f1f8318 | 463 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 464 | } |
apalmieri | 0:a77f1f1f8318 | 465 | if(pData->geofence_data.op == GNSS_GEOFENCE_STATUS_MSG) { |
apalmieri | 0:a77f1f1f8318 | 466 | sprintf(msg, "Geofence Status:\t\t[ %s ]\t", |
apalmieri | 0:a77f1f1f8318 | 467 | pData->geofence_data.result ? "ERROR" : "OK"); |
apalmieri | 0:a77f1f1f8318 | 468 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 469 | if(pData->geofence_data.result == 0) { |
apalmieri | 0:a77f1f1f8318 | 470 | TESEO_APP_LOG_INFO("\r\n"); |
apalmieri | 0:a77f1f1f8318 | 471 | sprintf(msg, "Time/Date:\t\t%02d:%02d:%02d %02d/%02d/%04d\n", |
apalmieri | 0:a77f1f1f8318 | 472 | pData->geofence_data.timestamp.hh, |
apalmieri | 0:a77f1f1f8318 | 473 | pData->geofence_data.timestamp.mm, |
apalmieri | 0:a77f1f1f8318 | 474 | pData->geofence_data.timestamp.ss, |
apalmieri | 0:a77f1f1f8318 | 475 | pData->geofence_data.timestamp.day, |
apalmieri | 0:a77f1f1f8318 | 476 | pData->geofence_data.timestamp.month, |
apalmieri | 0:a77f1f1f8318 | 477 | pData->geofence_data.timestamp.year); |
apalmieri | 0:a77f1f1f8318 | 478 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 479 | |
apalmieri | 0:a77f1f1f8318 | 480 | for(uint8_t i = 0; i<MAX_GEOFENCES_NUM; i++) { |
apalmieri | 0:a77f1f1f8318 | 481 | sprintf(msg, "Position circle[%d]:\t%s\n", |
apalmieri | 0:a77f1f1f8318 | 482 | i, geofenceCirclePosition[pData->geofence_data.status[i]]); |
apalmieri | 0:a77f1f1f8318 | 483 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 484 | } |
apalmieri | 0:a77f1f1f8318 | 485 | } |
apalmieri | 0:a77f1f1f8318 | 486 | } |
apalmieri | 0:a77f1f1f8318 | 487 | if(pData->geofence_data.op == GNSS_GEOFENCE_ALARM_MSG) { |
apalmieri | 0:a77f1f1f8318 | 488 | sprintf(msg, "Geofence Alarm:\t\t[ %s ]\t", |
apalmieri | 0:a77f1f1f8318 | 489 | pData->geofence_data.result ? "ERROR" : "OK"); |
apalmieri | 0:a77f1f1f8318 | 490 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 491 | if(pData->geofence_data.result == 0) { |
apalmieri | 0:a77f1f1f8318 | 492 | TESEO_APP_LOG_INFO("\r\n"); |
apalmieri | 0:a77f1f1f8318 | 493 | sprintf(msg, "Time:\t\t%02d:%02d:%02d\n", |
apalmieri | 0:a77f1f1f8318 | 494 | pData->geofence_data.timestamp.hh, |
apalmieri | 0:a77f1f1f8318 | 495 | pData->geofence_data.timestamp.mm, |
apalmieri | 0:a77f1f1f8318 | 496 | pData->geofence_data.timestamp.ss); |
apalmieri | 0:a77f1f1f8318 | 497 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 498 | int i = pData->geofence_data.idAlarm; |
apalmieri | 0:a77f1f1f8318 | 499 | sprintf(msg, "Position circle[%d]:\t%s\n", |
apalmieri | 0:a77f1f1f8318 | 500 | i, geofenceCirclePosition[pData->geofence_data.status[i]]); |
apalmieri | 0:a77f1f1f8318 | 501 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 502 | } |
apalmieri | 0:a77f1f1f8318 | 503 | } |
apalmieri | 0:a77f1f1f8318 | 504 | TESEO_APP_LOG_INFO("\r\n"); |
apalmieri | 0:a77f1f1f8318 | 505 | |
apalmieri | 0:a77f1f1f8318 | 506 | } |
apalmieri | 0:a77f1f1f8318 | 507 | |
apalmieri | 0:a77f1f1f8318 | 508 | /** |
apalmieri | 0:a77f1f1f8318 | 509 | * @brief This function prints on the console the info about Odometer |
apalmieri | 0:a77f1f1f8318 | 510 | * @param pData |
apalmieri | 0:a77f1f1f8318 | 511 | * @retval None |
apalmieri | 0:a77f1f1f8318 | 512 | */ |
apalmieri | 0:a77f1f1f8318 | 513 | static void |
apalmieri | 0:a77f1f1f8318 | 514 | GetOdometerInfos(tTeseoData *pData) |
apalmieri | 0:a77f1f1f8318 | 515 | { |
apalmieri | 0:a77f1f1f8318 | 516 | // char msg[256]; |
apalmieri | 0:a77f1f1f8318 | 517 | |
apalmieri | 0:a77f1f1f8318 | 518 | TESEO_APP_LOG_INFO("\r\n"); |
apalmieri | 0:a77f1f1f8318 | 519 | |
apalmieri | 0:a77f1f1f8318 | 520 | if(pData->odo_data.op == GNSS_FEATURE_EN_MSG) { |
apalmieri | 0:a77f1f1f8318 | 521 | sprintf(msg, "Odometer Enabling:\t\t[ %s ]\t", |
apalmieri | 0:a77f1f1f8318 | 522 | pData->odo_data.result ? "ERROR" : "OK"); |
apalmieri | 0:a77f1f1f8318 | 523 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 524 | } |
apalmieri | 0:a77f1f1f8318 | 525 | if((pData->odo_data.op == GNSS_ODO_START_MSG) || |
apalmieri | 0:a77f1f1f8318 | 526 | (pData->odo_data.op == GNSS_ODO_STOP_MSG)) { |
apalmieri | 0:a77f1f1f8318 | 527 | sprintf(msg, "Odometer Operation:\t\t[ %s ]\t", |
apalmieri | 0:a77f1f1f8318 | 528 | pData->odo_data.result ? "ERROR" : "OK"); |
apalmieri | 0:a77f1f1f8318 | 529 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 530 | } |
apalmieri | 0:a77f1f1f8318 | 531 | TESEO_APP_LOG_INFO("\r\n"); |
apalmieri | 0:a77f1f1f8318 | 532 | |
apalmieri | 0:a77f1f1f8318 | 533 | } |
apalmieri | 0:a77f1f1f8318 | 534 | |
apalmieri | 0:a77f1f1f8318 | 535 | /** |
apalmieri | 0:a77f1f1f8318 | 536 | * @brief This function prints on the console the info about Datalog |
apalmieri | 0:a77f1f1f8318 | 537 | * @param pData |
apalmieri | 0:a77f1f1f8318 | 538 | * @retval None |
apalmieri | 0:a77f1f1f8318 | 539 | */ |
apalmieri | 0:a77f1f1f8318 | 540 | static void |
apalmieri | 0:a77f1f1f8318 | 541 | GetDatalogInfos(tTeseoData *pData) |
apalmieri | 0:a77f1f1f8318 | 542 | { |
apalmieri | 0:a77f1f1f8318 | 543 | // char msg[256]; |
apalmieri | 0:a77f1f1f8318 | 544 | |
apalmieri | 0:a77f1f1f8318 | 545 | TESEO_APP_LOG_INFO("\r\n"); |
apalmieri | 0:a77f1f1f8318 | 546 | |
apalmieri | 0:a77f1f1f8318 | 547 | if(pData->datalog_data.op == GNSS_FEATURE_EN_MSG) { |
apalmieri | 0:a77f1f1f8318 | 548 | sprintf(msg, "Datalog Enabling:\t\t[ %s ]\t", |
apalmieri | 0:a77f1f1f8318 | 549 | pData->datalog_data.result ? "ERROR" : "OK"); |
apalmieri | 0:a77f1f1f8318 | 550 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 551 | } |
apalmieri | 0:a77f1f1f8318 | 552 | if(pData->datalog_data.op == GNSS_DATALOG_CFG_MSG) { |
apalmieri | 0:a77f1f1f8318 | 553 | sprintf(msg, "Datalog Configuring:\t\t[ %s ]\t", |
apalmieri | 0:a77f1f1f8318 | 554 | pData->datalog_data.result ? "ERROR" : "OK"); |
apalmieri | 0:a77f1f1f8318 | 555 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 556 | } |
apalmieri | 0:a77f1f1f8318 | 557 | if(pData->datalog_data.op == GNSS_DATALOG_START_MSG) { |
apalmieri | 0:a77f1f1f8318 | 558 | sprintf(msg, "Datalog Start:\t\t[ %s ]\t", |
apalmieri | 0:a77f1f1f8318 | 559 | pData->datalog_data.result ? "ERROR" : "OK"); |
apalmieri | 0:a77f1f1f8318 | 560 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 561 | } |
apalmieri | 0:a77f1f1f8318 | 562 | if(pData->datalog_data.op == GNSS_DATALOG_STOP_MSG) { |
apalmieri | 0:a77f1f1f8318 | 563 | sprintf(msg, "Datalog Stop:\t\t[ %s ]\t", |
apalmieri | 0:a77f1f1f8318 | 564 | pData->datalog_data.result ? "ERROR" : "OK"); |
apalmieri | 0:a77f1f1f8318 | 565 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 566 | } |
apalmieri | 0:a77f1f1f8318 | 567 | if(pData->datalog_data.op == GNSS_DATALOG_ERASE_MSG) { |
apalmieri | 0:a77f1f1f8318 | 568 | sprintf(msg, "Datalog Erase:\t\t[ %s ]\t", |
apalmieri | 0:a77f1f1f8318 | 569 | pData->datalog_data.result ? "ERROR" : "OK"); |
apalmieri | 0:a77f1f1f8318 | 570 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 571 | } |
apalmieri | 0:a77f1f1f8318 | 572 | TESEO_APP_LOG_INFO("\r\n"); |
apalmieri | 0:a77f1f1f8318 | 573 | |
apalmieri | 0:a77f1f1f8318 | 574 | } |
apalmieri | 0:a77f1f1f8318 | 575 | |
apalmieri | 0:a77f1f1f8318 | 576 | /** |
apalmieri | 0:a77f1f1f8318 | 577 | * @brief This function prints on the console the ack about Message List cfg |
apalmieri | 0:a77f1f1f8318 | 578 | * @param pData |
apalmieri | 0:a77f1f1f8318 | 579 | * @retval None |
apalmieri | 0:a77f1f1f8318 | 580 | */ |
apalmieri | 0:a77f1f1f8318 | 581 | static void |
apalmieri | 0:a77f1f1f8318 | 582 | GetMsgListAck(tTeseoData *pData) |
apalmieri | 0:a77f1f1f8318 | 583 | { |
apalmieri | 0:a77f1f1f8318 | 584 | // char msg[256]; |
apalmieri | 0:a77f1f1f8318 | 585 | |
apalmieri | 0:a77f1f1f8318 | 586 | TESEO_APP_LOG_INFO("\r\n"); |
apalmieri | 0:a77f1f1f8318 | 587 | |
apalmieri | 0:a77f1f1f8318 | 588 | sprintf(msg, "Msg List config:\t\t[ %s ]\t", |
apalmieri | 0:a77f1f1f8318 | 589 | pData->ack ? "ERROR" : "OK"); |
apalmieri | 0:a77f1f1f8318 | 590 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 591 | |
apalmieri | 0:a77f1f1f8318 | 592 | TESEO_APP_LOG_INFO("\r\n"); |
apalmieri | 0:a77f1f1f8318 | 593 | } |
apalmieri | 0:a77f1f1f8318 | 594 | |
apalmieri | 0:a77f1f1f8318 | 595 | /** |
apalmieri | 0:a77f1f1f8318 | 596 | * @brief This function prints on the console the ack about Message List cfg |
apalmieri | 0:a77f1f1f8318 | 597 | * @param pData |
apalmieri | 0:a77f1f1f8318 | 598 | * @retval None |
apalmieri | 0:a77f1f1f8318 | 599 | */ |
apalmieri | 0:a77f1f1f8318 | 600 | static void |
apalmieri | 0:a77f1f1f8318 | 601 | GetAck(tTeseoData *pData) |
apalmieri | 0:a77f1f1f8318 | 602 | { |
apalmieri | 0:a77f1f1f8318 | 603 | // char msg[256]; |
apalmieri | 0:a77f1f1f8318 | 604 | |
apalmieri | 0:a77f1f1f8318 | 605 | TESEO_APP_LOG_INFO("\r\n"); |
apalmieri | 0:a77f1f1f8318 | 606 | |
apalmieri | 0:a77f1f1f8318 | 607 | sprintf(msg, "Params configuration:\t\t[ %s ]\t", |
apalmieri | 0:a77f1f1f8318 | 608 | pData->ack ? "ERROR" : "OK"); |
apalmieri | 0:a77f1f1f8318 | 609 | TESEO_APP_LOG_INFO(msg); |
apalmieri | 0:a77f1f1f8318 | 610 | |
apalmieri | 0:a77f1f1f8318 | 611 | TESEO_APP_LOG_INFO("\r\n"); |
apalmieri | 0:a77f1f1f8318 | 612 | } |
apalmieri | 0:a77f1f1f8318 | 613 | |
apalmieri | 0:a77f1f1f8318 | 614 | void |
apalmieri | 0:a77f1f1f8318 | 615 | _AppOutputCallback(uint32_t msgId, uint32_t msgType, tTeseoData *pData) |
apalmieri | 0:a77f1f1f8318 | 616 | { |
apalmieri | 0:a77f1f1f8318 | 617 | switch (msgId) { |
apalmieri | 0:a77f1f1f8318 | 618 | case LOC_OUTPUT_LOCATION: { |
apalmieri | 0:a77f1f1f8318 | 619 | // Output last location |
apalmieri | 0:a77f1f1f8318 | 620 | TESEO_APP_LOG_INFO("Loc: lat=%lf, lon=%lf, alt=%f\r\n", pData->gpgga_data.xyz.lat, pData->gpgga_data.xyz.lon, pData->gpgga_data.xyz.alt); |
apalmieri | 0:a77f1f1f8318 | 621 | break; |
apalmieri | 0:a77f1f1f8318 | 622 | } |
apalmieri | 0:a77f1f1f8318 | 623 | case LOC_OUTPUT_NMEA: { |
apalmieri | 0:a77f1f1f8318 | 624 | //return; |
apalmieri | 0:a77f1f1f8318 | 625 | Teseo::eMsg msg = (Teseo::eMsg)msgType; |
apalmieri | 0:a77f1f1f8318 | 626 | switch(msg) { |
apalmieri | 0:a77f1f1f8318 | 627 | case Teseo::GNS: |
apalmieri | 0:a77f1f1f8318 | 628 | // GET Fix data for single or combined Satellite navigation system |
apalmieri | 0:a77f1f1f8318 | 629 | GetGNSMsgInfos(pData); |
apalmieri | 0:a77f1f1f8318 | 630 | break; |
apalmieri | 0:a77f1f1f8318 | 631 | |
apalmieri | 0:a77f1f1f8318 | 632 | case Teseo::GPGST: |
apalmieri | 0:a77f1f1f8318 | 633 | // GET GPS Pseudorange Noise Statistics |
apalmieri | 0:a77f1f1f8318 | 634 | GetGPGSTInfos(pData); |
apalmieri | 0:a77f1f1f8318 | 635 | break; |
apalmieri | 0:a77f1f1f8318 | 636 | |
apalmieri | 0:a77f1f1f8318 | 637 | case Teseo::GPRMC: |
apalmieri | 0:a77f1f1f8318 | 638 | // GET Recommended Minimum Specific GPS/Transit data |
apalmieri | 0:a77f1f1f8318 | 639 | GetGPRMCInfos(pData); |
apalmieri | 0:a77f1f1f8318 | 640 | break; |
apalmieri | 0:a77f1f1f8318 | 641 | |
apalmieri | 0:a77f1f1f8318 | 642 | case Teseo::GSA: |
apalmieri | 0:a77f1f1f8318 | 643 | // GET GPS DOP and Active Satellites |
apalmieri | 0:a77f1f1f8318 | 644 | GetGSAMsgInfos(pData); |
apalmieri | 0:a77f1f1f8318 | 645 | break; |
apalmieri | 0:a77f1f1f8318 | 646 | |
apalmieri | 0:a77f1f1f8318 | 647 | case Teseo::GSV: |
apalmieri | 0:a77f1f1f8318 | 648 | // GET GPS Satellites in View |
apalmieri | 0:a77f1f1f8318 | 649 | GetGSVMsgInfos(pData); |
apalmieri | 0:a77f1f1f8318 | 650 | break; |
apalmieri | 0:a77f1f1f8318 | 651 | |
apalmieri | 0:a77f1f1f8318 | 652 | default: |
apalmieri | 0:a77f1f1f8318 | 653 | break; |
apalmieri | 0:a77f1f1f8318 | 654 | } |
apalmieri | 0:a77f1f1f8318 | 655 | break; |
apalmieri | 0:a77f1f1f8318 | 656 | } |
apalmieri | 0:a77f1f1f8318 | 657 | case LOC_OUTPUT_PSTM: { |
apalmieri | 0:a77f1f1f8318 | 658 | Teseo::ePSTMsg msg = (Teseo::ePSTMsg)msgType; |
apalmieri | 0:a77f1f1f8318 | 659 | switch(msg) { |
apalmieri | 0:a77f1f1f8318 | 660 | case Teseo::PSTMGEOFENCE: |
apalmieri | 0:a77f1f1f8318 | 661 | // GET Geofence info |
apalmieri | 0:a77f1f1f8318 | 662 | GetGeofenceInfos(pData); |
apalmieri | 0:a77f1f1f8318 | 663 | break; |
apalmieri | 0:a77f1f1f8318 | 664 | case Teseo::PSTMODO: |
apalmieri | 0:a77f1f1f8318 | 665 | // GET Geofence info |
apalmieri | 0:a77f1f1f8318 | 666 | GetOdometerInfos(pData); |
apalmieri | 0:a77f1f1f8318 | 667 | break; |
apalmieri | 0:a77f1f1f8318 | 668 | case Teseo::PSTMDATALOG: |
apalmieri | 0:a77f1f1f8318 | 669 | // GET Datalog info |
apalmieri | 0:a77f1f1f8318 | 670 | GetDatalogInfos(pData); |
apalmieri | 0:a77f1f1f8318 | 671 | break; |
apalmieri | 0:a77f1f1f8318 | 672 | case Teseo::PSTMSGL: |
apalmieri | 0:a77f1f1f8318 | 673 | // GET Message List ack |
apalmieri | 0:a77f1f1f8318 | 674 | GetMsgListAck(pData); |
apalmieri | 0:a77f1f1f8318 | 675 | break; |
apalmieri | 0:a77f1f1f8318 | 676 | case Teseo::PSTMSAVEPAR: |
apalmieri | 0:a77f1f1f8318 | 677 | // GET SAVE PAR ack |
apalmieri | 0:a77f1f1f8318 | 678 | GetAck(pData); |
apalmieri | 0:a77f1f1f8318 | 679 | break; |
apalmieri | 0:a77f1f1f8318 | 680 | default: |
apalmieri | 0:a77f1f1f8318 | 681 | break; |
apalmieri | 0:a77f1f1f8318 | 682 | } |
apalmieri | 0:a77f1f1f8318 | 683 | break; |
apalmieri | 0:a77f1f1f8318 | 684 | } |
apalmieri | 0:a77f1f1f8318 | 685 | |
apalmieri | 0:a77f1f1f8318 | 686 | default: |
apalmieri | 0:a77f1f1f8318 | 687 | break; |
apalmieri | 0:a77f1f1f8318 | 688 | } |
apalmieri | 0:a77f1f1f8318 | 689 | } |
apalmieri | 0:a77f1f1f8318 | 690 | |
apalmieri | 0:a77f1f1f8318 | 691 | |
apalmieri | 0:a77f1f1f8318 | 692 | void |
apalmieri | 0:a77f1f1f8318 | 693 | _AppEventCallback(eTeseoLocEventType event, uint32_t data) |
apalmieri | 0:a77f1f1f8318 | 694 | { |
apalmieri | 0:a77f1f1f8318 | 695 | switch (event) { |
apalmieri | 0:a77f1f1f8318 | 696 | case TESEO_LOC_EVENT_START_RESULT: |
apalmieri | 0:a77f1f1f8318 | 697 | if (data != 0) { |
apalmieri | 0:a77f1f1f8318 | 698 | TESEO_APP_LOG_INFO("start failed.\r\n"); |
apalmieri | 0:a77f1f1f8318 | 699 | } else { |
apalmieri | 0:a77f1f1f8318 | 700 | TESEO_APP_LOG_INFO("start OK.\r\n"); |
apalmieri | 0:a77f1f1f8318 | 701 | } |
apalmieri | 0:a77f1f1f8318 | 702 | break; |
apalmieri | 0:a77f1f1f8318 | 703 | case TESEO_LOC_EVENT_STOP_RESULT: |
apalmieri | 0:a77f1f1f8318 | 704 | if (data != 0) { |
apalmieri | 0:a77f1f1f8318 | 705 | TESEO_APP_LOG_INFO("stop failed.\r\n"); |
apalmieri | 0:a77f1f1f8318 | 706 | } else { |
apalmieri | 0:a77f1f1f8318 | 707 | TESEO_APP_LOG_INFO("stop OK.\r\n"); |
apalmieri | 0:a77f1f1f8318 | 708 | } |
apalmieri | 0:a77f1f1f8318 | 709 | break; |
apalmieri | 0:a77f1f1f8318 | 710 | default: |
apalmieri | 0:a77f1f1f8318 | 711 | break; |
apalmieri | 0:a77f1f1f8318 | 712 | } |
apalmieri | 0:a77f1f1f8318 | 713 | } |