GPSProvider wrapper library for STMicroelectronics' X-NUCLEO-GNSS1A1 Expansion Board.

Dependents:   TeseoLocation

X_NUCLEO_GNSS1A1 Library

GPS_Provider wrapper library for STMicroelectronics' X-NUCLEO-GNSS1A1 component.

Overview

This library includes drivers for ST’s Teseo-LIV3F Global Navigation Satellite System (GNSS) device and middleware for the NMEA protocol support. This firmware package implements the port of the GPS_Provider to STMicroelectronics' X-NUCLEO-GNSS1A1 GNSS Expansion Board.

The key features of the library are:

  • Complete software to build applications using Teseo-LIV3F GNSS device
  • Middleware for the NMEA protocol support

Furthermore the library provides the following advanced features:

  • Geofencing - allows the Teseo-LIV3F receiver to raise a NMEA message when the resolved GNSS position is close to or entering or exiting from a specific circle
  • Odometer - provides information on the traveled distance using only the resolved GNSS position
  • Data Logging - allows the Teseo-LIV3F receiver to save locally on the flash the resolved GNSS position to be retrieved on demand from the Host

Hardware description

The X-NUCLEO-GNSS1A1 is a Global Navigation Satellite System Expansion Board usable with the STM32 Nucleo system and other Arduino compatible platforms. It is designed around the STMicroelectronics Teseo-LIV3F GNSS receiver IC working on multiple constellations (GPS/Galileo/Glonass/BeiDou/QZSS).

The Teseo-LIV3F module is designed for top performance in a minimal space. Within its 10x10mm compact size, Teseo-LIV3F offers superior accuracy thanks to the on board 26MHz Temperature Compensated Crystal Oscillator (TCXO) and a reduced Time To First Fix (TTFF) relying to its dedicated 32KHz Real Time Clock (RTC) oscillator.

The X-NUCLEO-GNSS1A1, hosting the Teseo-LIV3F, is compatible with Arduino UNO R3 connector layout and interfaces with the MCU via the UART channel. To connect by serial port the GNSS receiver and the host the following parameters must be used:

  • 8 data bits
  • No parity
  • 1 stop bit
  • 9600 bauds

A GPS/GLONASS/Beidou antenna, distributed along with the X-NUCLEO-GNSS1A1 Expansion Board, must be connected to the antenna connector present on the Expansion Board. For the X-NUCLEO-GNSS1A1 proper operations, the following jumper settings must be used:

  • J2 open
  • J3 closed
  • J4 closed
  • J5 open
  • J6 closed
  • J7 closed
  • J8 open
  • J9 closed
  • J10 open
  • J11 closed
  • J12 closed
  • J13 closed
  • J14 closed
  • J15 closed

Tested platforms

This firmware has been tested on STM32 NUCLEO-F401RE

Example Application

To run GNSS example applications using X-NUCLEO-GNSS1A1 Expansion Board based on mbed OS, please refer to TeseoLocation page.

Committer:
apalmieri
Date:
Thu Jan 14 09:29:14 2021 +0000
Revision:
5:1fe1ba1f0013
Parent:
3:2d568ec8da14
Get GNSS library aligned with mbed-os-6.6.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
apalmieri 0:a77f1f1f8318 1 /**
apalmieri 0:a77f1f1f8318 2 *******************************************************************************
apalmieri 0:a77f1f1f8318 3 * @file Teseo.h
apalmieri 0:a77f1f1f8318 4 * @author AST / Central Lab
apalmieri 0:a77f1f1f8318 5 * @version V1.0.0
apalmieri 0:a77f1f1f8318 6 * @date May-2017
apalmieri 0:a77f1f1f8318 7 * @brief Teseo Location Class
apalmieri 0:a77f1f1f8318 8 *
apalmieri 0:a77f1f1f8318 9 *******************************************************************************
apalmieri 0:a77f1f1f8318 10 * @attention
apalmieri 0:a77f1f1f8318 11 *
apalmieri 0:a77f1f1f8318 12 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
apalmieri 0:a77f1f1f8318 13 *
apalmieri 0:a77f1f1f8318 14 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
apalmieri 0:a77f1f1f8318 15 * You may not use this file except in compliance with the License.
apalmieri 0:a77f1f1f8318 16 * You may obtain a copy of the License at:
apalmieri 0:a77f1f1f8318 17 *
apalmieri 0:a77f1f1f8318 18 * http://www.st.com/software_license_agreement_liberty_v2
apalmieri 0:a77f1f1f8318 19 *
apalmieri 0:a77f1f1f8318 20 * Redistribution and use in source and binary forms, with or without modification,
apalmieri 0:a77f1f1f8318 21 * are permitted provided that the following conditions are met:
apalmieri 0:a77f1f1f8318 22 * 1. Redistributions of source code must retain the above copyright notice,
apalmieri 0:a77f1f1f8318 23 * this list of conditions and the following disclaimer.
apalmieri 0:a77f1f1f8318 24 * 2. Redistributions in binary form must reproduce the above copyright notice,
apalmieri 0:a77f1f1f8318 25 * this list of conditions and the following disclaimer in the documentation
apalmieri 0:a77f1f1f8318 26 * and/or other materials provided with the distribution.
apalmieri 0:a77f1f1f8318 27 * 3. Neither the name of STMicroelectronics nor the names of its contributors
apalmieri 0:a77f1f1f8318 28 * may be used to endorse or promote products derived from this software
apalmieri 0:a77f1f1f8318 29 * without specific prior written permission.
apalmieri 0:a77f1f1f8318 30 *
apalmieri 0:a77f1f1f8318 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
apalmieri 0:a77f1f1f8318 32 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
apalmieri 0:a77f1f1f8318 33 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
apalmieri 0:a77f1f1f8318 34 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
apalmieri 0:a77f1f1f8318 35 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
apalmieri 0:a77f1f1f8318 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
apalmieri 0:a77f1f1f8318 37 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
apalmieri 0:a77f1f1f8318 38 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
apalmieri 0:a77f1f1f8318 39 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
apalmieri 0:a77f1f1f8318 40 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
apalmieri 0:a77f1f1f8318 41 *
apalmieri 0:a77f1f1f8318 42 ********************************************************************************
apalmieri 0:a77f1f1f8318 43 */
apalmieri 0:a77f1f1f8318 44
apalmieri 0:a77f1f1f8318 45 #ifndef __TESEO_H__
apalmieri 0:a77f1f1f8318 46 #define __TESEO_H__
apalmieri 0:a77f1f1f8318 47
apalmieri 0:a77f1f1f8318 48 #include "mbed.h"
apalmieri 0:a77f1f1f8318 49 #include "GPSProviderImplBase.h"
apalmieri 0:a77f1f1f8318 50
apalmieri 0:a77f1f1f8318 51 #include "TeseoConfig.h"
apalmieri 0:a77f1f1f8318 52 #include "NMEAParser.h"
apalmieri 0:a77f1f1f8318 53
apalmieri 0:a77f1f1f8318 54 #define STD_UART_BAUD 9600// 9600
apalmieri 0:a77f1f1f8318 55 #define FWU_UART_BAUD 115200
apalmieri 0:a77f1f1f8318 56 #define TESEO_I2C_ADDRESS 0x3A
apalmieri 0:a77f1f1f8318 57 #define POWERON_STABLE_SIGNAL_DELAY_MS 150
apalmieri 0:a77f1f1f8318 58
apalmieri 0:a77f1f1f8318 59 /** Indicates the outputted location information */
apalmieri 0:a77f1f1f8318 60 #define LOC_OUTPUT_LOCATION (1)
apalmieri 0:a77f1f1f8318 61 #define LOC_OUTPUT_NMEA (2)
apalmieri 0:a77f1f1f8318 62 #define LOC_OUTPUT_PSTM (3)
apalmieri 0:a77f1f1f8318 63
apalmieri 0:a77f1f1f8318 64 /**
apalmieri 0:a77f1f1f8318 65 * @brief Constant that indicates the maximum number of nmea messages to be processed.
apalmieri 0:a77f1f1f8318 66 */
apalmieri 0:a77f1f1f8318 67 #define NMEA_MSGS_NUM 6 //Note: update this constant coherently to eMsg enum type
apalmieri 0:a77f1f1f8318 68
apalmieri 0:a77f1f1f8318 69 /**
apalmieri 0:a77f1f1f8318 70 * @brief Constant that indicates the maximum number of proprietary nmea messages to be processed.
apalmieri 0:a77f1f1f8318 71 */
apalmieri 0:a77f1f1f8318 72 #define PSTM_NMEA_MSGS_NUM 5 //Note: update this constant coherently to ePSTMsg enum type
apalmieri 0:a77f1f1f8318 73
apalmieri 0:a77f1f1f8318 74 /**
apalmieri 0:a77f1f1f8318 75 * @brief Constant that indicates the maximum number of positions that can be stored.
apalmieri 0:a77f1f1f8318 76 */
apalmieri 0:a77f1f1f8318 77 #define MAX_STOR_POS 64
apalmieri 0:a77f1f1f8318 78
apalmieri 0:a77f1f1f8318 79 /**
apalmieri 0:a77f1f1f8318 80 * @brief Constant that indicates the lenght of the buffer that stores the GPS data read by the GPS expansion.
apalmieri 0:a77f1f1f8318 81 */
apalmieri 0:a77f1f1f8318 82
apalmieri 0:a77f1f1f8318 83 #define TESEO_RXBUF_LEN 256//90
apalmieri 0:a77f1f1f8318 84 #define TESEO_RXQUEUE_LEN 8
apalmieri 0:a77f1f1f8318 85
apalmieri 0:a77f1f1f8318 86 /**
apalmieri 0:a77f1f1f8318 87 * @brief Enumeration structure that containes the two success states of a process
apalmieri 0:a77f1f1f8318 88 */
apalmieri 0:a77f1f1f8318 89 typedef enum {
apalmieri 0:a77f1f1f8318 90 TESEO_STATUS_SUCCESS = 0, /**< Success status */
apalmieri 0:a77f1f1f8318 91 TESEO_STATUS_FAILURE = 1 /**< Failure status */
apalmieri 0:a77f1f1f8318 92 } eStatus;
apalmieri 0:a77f1f1f8318 93
apalmieri 0:a77f1f1f8318 94 /** Location event definitions */
apalmieri 0:a77f1f1f8318 95 typedef enum {
apalmieri 0:a77f1f1f8318 96 /** Start result event */
apalmieri 0:a77f1f1f8318 97 TESEO_LOC_EVENT_START_RESULT,
apalmieri 0:a77f1f1f8318 98 /** Stop result event */
apalmieri 0:a77f1f1f8318 99 TESEO_LOC_EVENT_STOP_RESULT,
apalmieri 0:a77f1f1f8318 100 } eTeseoLocEventType;
apalmieri 0:a77f1f1f8318 101
apalmieri 0:a77f1f1f8318 102 /** Teseo Location state */
apalmieri 0:a77f1f1f8318 103 typedef enum {
apalmieri 0:a77f1f1f8318 104 TESEO_LOC_STATE_IDLE,
apalmieri 0:a77f1f1f8318 105 TESEO_LOC_STATE_RUN,
apalmieri 0:a77f1f1f8318 106 TESEO_LOC_STATE_FEATURE,
apalmieri 0:a77f1f1f8318 107 TESEO_LOC_STATE_DEBUG
apalmieri 0:a77f1f1f8318 108 } eTeseoLocState;
apalmieri 0:a77f1f1f8318 109
apalmieri 0:a77f1f1f8318 110 /**
apalmieri 0:a77f1f1f8318 111 * @brief Enumeration structure that containes the two states of a debug process
apalmieri 0:a77f1f1f8318 112 */
apalmieri 0:a77f1f1f8318 113 typedef enum {
apalmieri 0:a77f1f1f8318 114 DEBUG_OFF = 0, /**< In this case, nothing will be printed on the console (nmea strings, positions and so on) */
apalmieri 0:a77f1f1f8318 115 DEBUG_ON = 1 /**< In this case, nmea strings and just acquired positions will be printed on the console */
apalmieri 0:a77f1f1f8318 116 } eDebugState;
apalmieri 0:a77f1f1f8318 117
apalmieri 0:a77f1f1f8318 118 /**
apalmieri 0:a77f1f1f8318 119 * @brief Data structure that contains the driver informations
apalmieri 0:a77f1f1f8318 120 */
apalmieri 0:a77f1f1f8318 121 typedef struct TeseoData {
apalmieri 0:a77f1f1f8318 122 eDebugState debug; /**< Debug status */
apalmieri 0:a77f1f1f8318 123 GPGGA_Infos gpgga_data; /**< $GPGGA Data holder */
apalmieri 0:a77f1f1f8318 124 GNS_Infos gns_data; /**< $--GNS Data holder */
apalmieri 0:a77f1f1f8318 125 GPGST_Infos gpgst_data; /**< $GPGST Data holder */
apalmieri 0:a77f1f1f8318 126 GPRMC_Infos gprmc_data; /**< $GPRMC Data holder */
apalmieri 0:a77f1f1f8318 127 GSA_Infos gsa_data; /**< $--GSA Data holder */
apalmieri 0:a77f1f1f8318 128 GSV_Infos gsv_data; /**< $--GSV Data holder */
apalmieri 0:a77f1f1f8318 129
apalmieri 0:a77f1f1f8318 130 Geofence_Infos geofence_data; /**< Geofence Data holder */
apalmieri 0:a77f1f1f8318 131 Odometer_Infos odo_data; /**< Odometer Data holder */
apalmieri 0:a77f1f1f8318 132 Datalog_Infos datalog_data; /**< Datalog Data holder */
apalmieri 0:a77f1f1f8318 133
apalmieri 0:a77f1f1f8318 134 Ack_Info ack; /**< */
apalmieri 0:a77f1f1f8318 135
apalmieri 0:a77f1f1f8318 136 } tTeseoData;
apalmieri 0:a77f1f1f8318 137
apalmieri 0:a77f1f1f8318 138 /** Application register this out callback function and Teseo class will pass outputted information to application */
apalmieri 0:a77f1f1f8318 139 typedef void (*teseo_app_output_callback)(uint32_t msgId, uint32_t msgType, tTeseoData *pData);
apalmieri 0:a77f1f1f8318 140 /** Application register this event callback function and Teseo class will pass internal processing event to application */
apalmieri 0:a77f1f1f8318 141 typedef void (*teseo_app_event_callback)(eTeseoLocEventType event, uint32_t data);
apalmieri 0:a77f1f1f8318 142
apalmieri 0:a77f1f1f8318 143 class Teseo : public GPSProviderImplBase {
apalmieri 0:a77f1f1f8318 144 public:
apalmieri 0:a77f1f1f8318 145
apalmieri 0:a77f1f1f8318 146 typedef enum {
apalmieri 0:a77f1f1f8318 147 TEST,
apalmieri 0:a77f1f1f8318 148 GETSWVER,
apalmieri 0:a77f1f1f8318 149 FORCESTANDBY,
apalmieri 0:a77f1f1f8318 150 RFTESTON,
apalmieri 0:a77f1f1f8318 151 RFTESTOFF,
apalmieri 0:a77f1f1f8318 152 LOWPOWER,
apalmieri 0:a77f1f1f8318 153 FWUPDATE
apalmieri 0:a77f1f1f8318 154 } eCmd;
apalmieri 0:a77f1f1f8318 155
apalmieri 0:a77f1f1f8318 156 /** NMEA messages types */
apalmieri 0:a77f1f1f8318 157 typedef enum {
apalmieri 0:a77f1f1f8318 158 GPGGA,
apalmieri 0:a77f1f1f8318 159 GNS,
apalmieri 0:a77f1f1f8318 160 GPGST,
apalmieri 0:a77f1f1f8318 161 GPRMC,
apalmieri 0:a77f1f1f8318 162 GSA,
apalmieri 0:a77f1f1f8318 163 GSV,
apalmieri 0:a77f1f1f8318 164 } eMsg;
apalmieri 0:a77f1f1f8318 165
apalmieri 0:a77f1f1f8318 166 /** NMEA proprietary messages types */
apalmieri 0:a77f1f1f8318 167 typedef enum {
apalmieri 0:a77f1f1f8318 168 PSTMGEOFENCE,
apalmieri 0:a77f1f1f8318 169 PSTMODO,
apalmieri 0:a77f1f1f8318 170 PSTMDATALOG,
apalmieri 0:a77f1f1f8318 171 PSTMSGL,
apalmieri 0:a77f1f1f8318 172 PSTMSAVEPAR
apalmieri 0:a77f1f1f8318 173 } ePSTMsg;
apalmieri 0:a77f1f1f8318 174
apalmieri 0:a77f1f1f8318 175 private:
apalmieri 0:a77f1f1f8318 176
apalmieri 0:a77f1f1f8318 177 eTeseoLocState _locState;
apalmieri 0:a77f1f1f8318 178
apalmieri 0:a77f1f1f8318 179 DigitalOut _loc_led2;
apalmieri 0:a77f1f1f8318 180 DigitalOut _reset;
apalmieri 0:a77f1f1f8318 181 DigitalOut _pps;
apalmieri 0:a77f1f1f8318 182 DigitalOut _wakeup;
apalmieri 0:a77f1f1f8318 183 PinName _uartRx;
apalmieri 0:a77f1f1f8318 184 PinName _uartTx;
apalmieri 0:a77f1f1f8318 185
apalmieri 5:1fe1ba1f0013 186 BufferedSerial *_uart;
apalmieri 0:a77f1f1f8318 187 I2C *_i2c;
apalmieri 0:a77f1f1f8318 188
apalmieri 0:a77f1f1f8318 189 tTeseoData pData;
apalmieri 0:a77f1f1f8318 190 GPGGA_Infos stored_positions[MAX_STOR_POS];
apalmieri 0:a77f1f1f8318 191
apalmieri 0:a77f1f1f8318 192 int FwWaitAck();
apalmieri 0:a77f1f1f8318 193
apalmieri 0:a77f1f1f8318 194 Thread *serialStreamThread;
apalmieri 0:a77f1f1f8318 195
apalmieri 0:a77f1f1f8318 196 /**
apalmieri 0:a77f1f1f8318 197 * Command string
apalmieri 0:a77f1f1f8318 198 */
apalmieri 0:a77f1f1f8318 199 char _teseoCmd[TESEO_RXBUF_LEN];
apalmieri 0:a77f1f1f8318 200
apalmieri 0:a77f1f1f8318 201 /**
apalmieri 0:a77f1f1f8318 202 * Message struct
apalmieri 0:a77f1f1f8318 203 */
apalmieri 0:a77f1f1f8318 204 struct _teseoMsg {
apalmieri 0:a77f1f1f8318 205 uint8_t len;
apalmieri 0:a77f1f1f8318 206 uint8_t buf[TESEO_RXBUF_LEN];
apalmieri 0:a77f1f1f8318 207 };
apalmieri 0:a77f1f1f8318 208
apalmieri 0:a77f1f1f8318 209 public:
apalmieri 0:a77f1f1f8318 210
apalmieri 0:a77f1f1f8318 211 /** Constructor: Teseo
apalmieri 0:a77f1f1f8318 212 * Create the Teseo, accept specified configuration
apalmieri 0:a77f1f1f8318 213 *
apalmieri 0:a77f1f1f8318 214 * @param [in] resetPin
apalmieri 0:a77f1f1f8318 215 * GPIO pin to control location chip reset.
apalmieri 0:a77f1f1f8318 216 * @param [in] wakeupPin
apalmieri 0:a77f1f1f8318 217 * GPIO pin to detect if the chip is still wakeup.
apalmieri 0:a77f1f1f8318 218 * @param [in] ppsPin
apalmieri 0:a77f1f1f8318 219 * GPIO pin... .
apalmieri 0:a77f1f1f8318 220 * @param [in] uartTxPin
apalmieri 0:a77f1f1f8318 221 * GPIO pin for serial Tx channel between the host and the GNSS controller.
apalmieri 0:a77f1f1f8318 222 * @param [in] uartRxPin
apalmieri 0:a77f1f1f8318 223 * GPIO pin for serial Rx channel between the host and the GNSS controller.
apalmieri 0:a77f1f1f8318 224 */
apalmieri 0:a77f1f1f8318 225 Teseo(PinName resetPin,
apalmieri 0:a77f1f1f8318 226 PinName wakeupPin,
apalmieri 0:a77f1f1f8318 227 PinName ppsPin,
apalmieri 0:a77f1f1f8318 228 PinName uartTxPin,
apalmieri 5:1fe1ba1f0013 229 PinName uartRxPin);
apalmieri 0:a77f1f1f8318 230
apalmieri 0:a77f1f1f8318 231 /** Constructor: Teseo
apalmieri 0:a77f1f1f8318 232 * Create the Teseo, accept specified configuration
apalmieri 0:a77f1f1f8318 233 *
apalmieri 0:a77f1f1f8318 234 * @param [in] resetPin
apalmieri 0:a77f1f1f8318 235 * GPIO pin to control location chip reset.
apalmieri 0:a77f1f1f8318 236 * @param [in] wakeupPin
apalmieri 0:a77f1f1f8318 237 * GPIO pin to detect if the chip is still wakeup.
apalmieri 0:a77f1f1f8318 238 * @param [in] ppsPin
apalmieri 0:a77f1f1f8318 239 * GPIO pin... .
apalmieri 0:a77f1f1f8318 240 * @param [in] uartTxPin
apalmieri 0:a77f1f1f8318 241 * GPIO pin for serial Tx channel between the host and the GNSS controller.
apalmieri 0:a77f1f1f8318 242 * @param [in] uartRxPin
apalmieri 0:a77f1f1f8318 243 * GPIO pin for serial Rx channel between the host and the GNSS controller.
apalmieri 0:a77f1f1f8318 244 * @param [in] i2cBus
apalmieri 0:a77f1f1f8318 245 * I2C Bus not supported yet.
apalmieri 0:a77f1f1f8318 246 */
apalmieri 0:a77f1f1f8318 247 Teseo(PinName resetPin,
apalmieri 0:a77f1f1f8318 248 PinName wakeupPin,
apalmieri 0:a77f1f1f8318 249 PinName ppsPin,
apalmieri 0:a77f1f1f8318 250 PinName uartTxPin,
apalmieri 0:a77f1f1f8318 251 PinName uartRxPin,
apalmieri 5:1fe1ba1f0013 252 I2C *i2cBus);
apalmieri 0:a77f1f1f8318 253
apalmieri 0:a77f1f1f8318 254 /** Register output callback and event callback functions
apalmieri 0:a77f1f1f8318 255 * @param app_output_cb Teseo class output the location and satellite information to application
apalmieri 0:a77f1f1f8318 256 * @param app_event_cb Teseo class output the start and stop result to application
apalmieri 0:a77f1f1f8318 257 */
apalmieri 0:a77f1f1f8318 258 void TeseoLocRegOutput(teseo_app_output_callback app_output_cb, teseo_app_event_callback app_event_cb);
apalmieri 0:a77f1f1f8318 259
apalmieri 0:a77f1f1f8318 260 void SendCommand(Teseo::eCmd c);
apalmieri 0:a77f1f1f8318 261 void SendCommand(char *cmd);
apalmieri 0:a77f1f1f8318 262
apalmieri 0:a77f1f1f8318 263 int EnableLowPower();
apalmieri 0:a77f1f1f8318 264
apalmieri 0:a77f1f1f8318 265 void ReadSentence(Teseo::eMsg msg);
apalmieri 0:a77f1f1f8318 266
apalmieri 0:a77f1f1f8318 267 eStatus WakeStatus(void){
apalmieri 0:a77f1f1f8318 268 return _wakeup.read() ? TESEO_STATUS_SUCCESS : TESEO_STATUS_FAILURE;
apalmieri 0:a77f1f1f8318 269 }
apalmieri 0:a77f1f1f8318 270
apalmieri 0:a77f1f1f8318 271 void ReadProcess(void);
apalmieri 0:a77f1f1f8318 272
apalmieri 0:a77f1f1f8318 273 private:
apalmieri 0:a77f1f1f8318 274
apalmieri 0:a77f1f1f8318 275 virtual bool setPowerMode(GPSProvider::PowerMode_t pwrMode);
apalmieri 0:a77f1f1f8318 276 virtual void start(void);
apalmieri 0:a77f1f1f8318 277 virtual void stop(void);
apalmieri 0:a77f1f1f8318 278 virtual void process(void);
apalmieri 0:a77f1f1f8318 279 virtual void reset(void);
apalmieri 0:a77f1f1f8318 280 virtual const GPSProvider::LocationUpdateParams_t *getLastLocation(void) const;
apalmieri 0:a77f1f1f8318 281
apalmieri 0:a77f1f1f8318 282 gps_provider_error_t cfgMessageList(int level);
apalmieri 0:a77f1f1f8318 283 gps_provider_error_t saveConfigParams(void);
apalmieri 0:a77f1f1f8318 284
apalmieri 0:a77f1f1f8318 285 /** Set NMEA stream verbosity */
apalmieri 0:a77f1f1f8318 286 virtual void setVerboseMode(int level);
apalmieri 0:a77f1f1f8318 287
apalmieri 0:a77f1f1f8318 288 /** Geofencing */
apalmieri 0:a77f1f1f8318 289 virtual bool isGeofencingSupported(void);
apalmieri 0:a77f1f1f8318 290 virtual gps_provider_error_t enableGeofence(void);
apalmieri 0:a77f1f1f8318 291 virtual gps_provider_error_t configGeofences(GPSGeofence *geofences[], unsigned geofenceCount);
apalmieri 0:a77f1f1f8318 292 virtual gps_provider_error_t geofenceReq(void);
apalmieri 0:a77f1f1f8318 293 gps_provider_error_t cfgGeofenceCircle(void);
apalmieri 0:a77f1f1f8318 294
apalmieri 0:a77f1f1f8318 295 /** Datalogging */
apalmieri 0:a77f1f1f8318 296 virtual bool isDataloggingSupported(void);
apalmieri 0:a77f1f1f8318 297 virtual gps_provider_error_t enableDatalog(void);
apalmieri 0:a77f1f1f8318 298 virtual gps_provider_error_t configDatalog(GPSDatalog *datalog);
apalmieri 0:a77f1f1f8318 299 virtual gps_provider_error_t startDatalog(void);
apalmieri 0:a77f1f1f8318 300 virtual gps_provider_error_t stopDatalog(void);
apalmieri 0:a77f1f1f8318 301 virtual gps_provider_error_t eraseDatalog(void);
apalmieri 0:a77f1f1f8318 302 virtual gps_provider_error_t logReqStatus(void);
apalmieri 0:a77f1f1f8318 303 virtual gps_provider_error_t logReqQuery(GPSProvider::LogQueryParams_t &logReqQuery);
apalmieri 0:a77f1f1f8318 304
apalmieri 0:a77f1f1f8318 305 /* Odometer */
apalmieri 0:a77f1f1f8318 306 virtual bool isOdometerSupported(void);
apalmieri 0:a77f1f1f8318 307 virtual gps_provider_error_t enableOdo(void);
apalmieri 0:a77f1f1f8318 308 virtual gps_provider_error_t startOdo(unsigned alarmDistance);
apalmieri 0:a77f1f1f8318 309 virtual gps_provider_error_t stopOdo(void);
apalmieri 0:a77f1f1f8318 310 virtual gps_provider_error_t resetOdo(void);
apalmieri 0:a77f1f1f8318 311
apalmieri 0:a77f1f1f8318 312 void _InitUART(int br = STD_UART_BAUD);
apalmieri 5:1fe1ba1f0013 313 void _ResetFast(void);
apalmieri 5:1fe1ba1f0013 314 void _Reset(void);
apalmieri 0:a77f1f1f8318 315 void _SendString(char *buf, int len);
apalmieri 0:a77f1f1f8318 316 int _WakeUp();
apalmieri 0:a77f1f1f8318 317 int _CRC(char *buf, int size);
apalmieri 3:2d568ec8da14 318
apalmieri 0:a77f1f1f8318 319 /**
apalmieri 0:a77f1f1f8318 320 * @brief This function gets a chunck of NMEA messages
apalmieri 0:a77f1f1f8318 321 * @param msg NMEA message to search for
apalmieri 0:a77f1f1f8318 322 * @retval eStatus TESEO_STATUS_SUCCESS if the parse process goes ok, TESEO_FAILURE if it doesn't
apalmieri 0:a77f1f1f8318 323 */
apalmieri 0:a77f1f1f8318 324 eStatus _GetMsg(Teseo::eMsg msg, uint8_t *buffer);
apalmieri 0:a77f1f1f8318 325 /**
apalmieri 0:a77f1f1f8318 326 * @brief This function gets a chunck of PSTM NMEA messages
apalmieri 0:a77f1f1f8318 327 * @param msg PSTM NMEA message to search for
apalmieri 0:a77f1f1f8318 328 * @retval eStatus TESEO_STATUS_SUCCESS if the parse process goes ok, TESEO_FAILURE if it doesn't
apalmieri 0:a77f1f1f8318 329 */
apalmieri 0:a77f1f1f8318 330 void _GetPSTMsg(Teseo::ePSTMsg msg, uint8_t *buffer);
apalmieri 0:a77f1f1f8318 331 void _GetLocationMsg(Teseo::eMsg msg, uint8_t *buffer);
apalmieri 0:a77f1f1f8318 332
apalmieri 0:a77f1f1f8318 333 void _LocLed2Set(void){
apalmieri 0:a77f1f1f8318 334 _loc_led2.write(1);
apalmieri 0:a77f1f1f8318 335 }
apalmieri 0:a77f1f1f8318 336 void _LocLed2Reset(void){
apalmieri 0:a77f1f1f8318 337 _loc_led2.write(0);
apalmieri 0:a77f1f1f8318 338 }
apalmieri 0:a77f1f1f8318 339
apalmieri 0:a77f1f1f8318 340 void outputHandler(uint32_t msgId, uint32_t msgType, tTeseoData *pData);
apalmieri 0:a77f1f1f8318 341 void eventHandler(eTeseoLocEventType event, uint32_t data);
apalmieri 0:a77f1f1f8318 342
apalmieri 0:a77f1f1f8318 343 teseo_app_output_callback appOutCb;
apalmieri 0:a77f1f1f8318 344 teseo_app_event_callback appEventCb;
apalmieri 0:a77f1f1f8318 345
apalmieri 0:a77f1f1f8318 346 MemoryPool<struct _teseoMsg, TESEO_RXQUEUE_LEN> mpool;
apalmieri 0:a77f1f1f8318 347 Queue<struct _teseoMsg, TESEO_RXQUEUE_LEN> queue;
apalmieri 0:a77f1f1f8318 348 };
apalmieri 0:a77f1f1f8318 349
apalmieri 0:a77f1f1f8318 350 #endif /*__TESEO_H__*/