An extension of original API for working with GPS devices.

Dependents:   A_TeseoLocationNEW A_TeseoLocation TeseoLocation

GPS_Provider Library

A controller-neutral API for working with GPS devices.

Overview

This library is an extension of the original API published on os.mbed.com

Besides the basic geo-location functionality, this extended API includes the following features:

  • Geofencing
  • Odometer
  • Datalogging

Getting started

This GPS API is meant to be used for building projects on os.mbed.com

A good starting point is this page:

TeseoLocation

Committer:
apalmieri
Date:
Thu Feb 14 11:37:06 2019 +0000
Revision:
4:193bf97d4c5a
Parent:
3:ccd86d6bd3bc
Update .json file

Who changed what in which revision?

UserRevisionLine numberNew contents of line
apalmieri 0:0a9c622571d7 1 /**
apalmieri 0:0a9c622571d7 2 ******************************************************************************
apalmieri 0:0a9c622571d7 3 * @file GPSDatalog.h
apalmieri 0:0a9c622571d7 4 * @author AST/CL
apalmieri 0:0a9c622571d7 5 * @version V1.1.0
apalmieri 0:0a9c622571d7 6 * @date Jun, 2017
apalmieri 0:0a9c622571d7 7 * @brief .
apalmieri 0:0a9c622571d7 8 ******************************************************************************
apalmieri 0:0a9c622571d7 9 * @attention
apalmieri 0:0a9c622571d7 10 *
apalmieri 0:0a9c622571d7 11 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
apalmieri 0:0a9c622571d7 12 *
apalmieri 0:0a9c622571d7 13 * Redistribution and use in source and binary forms, with or without modification,
apalmieri 0:0a9c622571d7 14 * are permitted provided that the following conditions are met:
apalmieri 0:0a9c622571d7 15 * 1. Redistributions of source code must retain the above copyright notice,
apalmieri 0:0a9c622571d7 16 * this list of conditions and the following disclaimer.
apalmieri 0:0a9c622571d7 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
apalmieri 0:0a9c622571d7 18 * this list of conditions and the following disclaimer in the documentation
apalmieri 0:0a9c622571d7 19 * and/or other materials provided with the distribution.
apalmieri 0:0a9c622571d7 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
apalmieri 0:0a9c622571d7 21 * may be used to endorse or promote products derived from this software
apalmieri 0:0a9c622571d7 22 * without specific prior written permission.
apalmieri 0:0a9c622571d7 23 *
apalmieri 0:0a9c622571d7 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
apalmieri 0:0a9c622571d7 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
apalmieri 0:0a9c622571d7 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
apalmieri 0:0a9c622571d7 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
apalmieri 0:0a9c622571d7 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
apalmieri 0:0a9c622571d7 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
apalmieri 0:0a9c622571d7 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
apalmieri 0:0a9c622571d7 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
apalmieri 0:0a9c622571d7 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
apalmieri 0:0a9c622571d7 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
apalmieri 0:0a9c622571d7 34 *
apalmieri 0:0a9c622571d7 35 ******************************************************************************
apalmieri 0:0a9c622571d7 36 */
apalmieri 0:0a9c622571d7 37
apalmieri 0:0a9c622571d7 38 #ifndef __GPS_DATALOG_H__
apalmieri 0:0a9c622571d7 39 #define __GPS_DATALOG_H__
apalmieri 0:0a9c622571d7 40
apalmieri 3:ccd86d6bd3bc 41 /**
apalmieri 3:ccd86d6bd3bc 42 * For more information about DataLogging, please refer to
apalmieri 3:ccd86d6bd3bc 43 * Teseo LIV-3F UM available at st.com
apalmieri 3:ccd86d6bd3bc 44 */
apalmieri 3:ccd86d6bd3bc 45
apalmieri 0:0a9c622571d7 46 class GPSDatalog {
apalmieri 0:0a9c622571d7 47 public:
apalmieri 0:0a9c622571d7 48
apalmieri 0:0a9c622571d7 49 /**
apalmieri 0:0a9c622571d7 50 * Construct a GPSDatalog instance.
apalmieri 0:0a9c622571d7 51 */
apalmieri 0:0a9c622571d7 52 GPSDatalog(bool enableBufferFullAlarm,
apalmieri 0:0a9c622571d7 53 bool enableCircularBuffer,
apalmieri 0:0a9c622571d7 54 unsigned minRate,
apalmieri 0:0a9c622571d7 55 unsigned minSpeed,
apalmieri 0:0a9c622571d7 56 unsigned minPosition,
apalmieri 0:0a9c622571d7 57 int logMask) :
apalmieri 0:0a9c622571d7 58 _enableBufferFullAlarm(enableBufferFullAlarm),
apalmieri 0:0a9c622571d7 59 _enableCircularBuffer(enableCircularBuffer),
apalmieri 0:0a9c622571d7 60 _minRate(minRate),
apalmieri 0:0a9c622571d7 61 _minSpeed(minSpeed),
apalmieri 0:0a9c622571d7 62 _minPosition(minPosition),
apalmieri 0:0a9c622571d7 63 _logMask(logMask) {
apalmieri 0:0a9c622571d7 64 }
apalmieri 0:0a9c622571d7 65
apalmieri 3:ccd86d6bd3bc 66 /**
apalmieri 3:ccd86d6bd3bc 67 * Helper method to know if the datalogging subsystem
apalmieri 3:ccd86d6bd3bc 68 * can raise an alarm in case of buffer full.
apalmieri 3:ccd86d6bd3bc 69 */
apalmieri 0:0a9c622571d7 70 bool getEnableBufferFullAlarm(void) const {
apalmieri 0:0a9c622571d7 71 return _enableBufferFullAlarm;
apalmieri 0:0a9c622571d7 72 }
apalmieri 3:ccd86d6bd3bc 73
apalmieri 3:ccd86d6bd3bc 74 /**
apalmieri 3:ccd86d6bd3bc 75 * Helper method to know if the datalogging subsystem
apalmieri 3:ccd86d6bd3bc 76 * supports circular buffer.
apalmieri 3:ccd86d6bd3bc 77 */
apalmieri 0:0a9c622571d7 78 bool getEnableCircularBuffer(void) const {
apalmieri 0:0a9c622571d7 79 return _enableCircularBuffer;
apalmieri 0:0a9c622571d7 80 }
apalmieri 3:ccd86d6bd3bc 81
apalmieri 3:ccd86d6bd3bc 82 /**
apalmieri 3:ccd86d6bd3bc 83 * Return the rate to record a new entry.
apalmieri 3:ccd86d6bd3bc 84 */
apalmieri 0:0a9c622571d7 85 unsigned getMinRate(void) const {
apalmieri 0:0a9c622571d7 86 return _minRate;
apalmieri 0:0a9c622571d7 87 }
apalmieri 3:ccd86d6bd3bc 88
apalmieri 3:ccd86d6bd3bc 89 /**
apalmieri 3:ccd86d6bd3bc 90 * Return the speed threshold to log a data.
apalmieri 3:ccd86d6bd3bc 91 */
apalmieri 0:0a9c622571d7 92 unsigned getMinSpeed(void) const {
apalmieri 0:0a9c622571d7 93 return _minSpeed;
apalmieri 0:0a9c622571d7 94 }
apalmieri 3:ccd86d6bd3bc 95
apalmieri 3:ccd86d6bd3bc 96 /**
apalmieri 3:ccd86d6bd3bc 97 * Return the minimal speed to log a data.
apalmieri 3:ccd86d6bd3bc 98 */
apalmieri 0:0a9c622571d7 99 unsigned getMinPosition(void) const {
apalmieri 0:0a9c622571d7 100 return _minPosition;
apalmieri 0:0a9c622571d7 101 }
apalmieri 3:ccd86d6bd3bc 102
apalmieri 3:ccd86d6bd3bc 103 /**
apalmieri 3:ccd86d6bd3bc 104 * Return the mask indicating the data to be logged.
apalmieri 3:ccd86d6bd3bc 105 */
apalmieri 0:0a9c622571d7 106 int getLogMask(void) const {
apalmieri 0:0a9c622571d7 107 return _logMask;
apalmieri 0:0a9c622571d7 108 }
apalmieri 0:0a9c622571d7 109
apalmieri 0:0a9c622571d7 110 protected:
apalmieri 0:0a9c622571d7 111 bool _enableBufferFullAlarm;
apalmieri 0:0a9c622571d7 112 bool _enableCircularBuffer;
apalmieri 0:0a9c622571d7 113 unsigned _minRate;
apalmieri 0:0a9c622571d7 114 unsigned _minSpeed;
apalmieri 0:0a9c622571d7 115 unsigned _minPosition;
apalmieri 0:0a9c622571d7 116 int _logMask;
apalmieri 0:0a9c622571d7 117
apalmieri 0:0a9c622571d7 118 private:
apalmieri 0:0a9c622571d7 119 /* disallow copy constructor and assignment operators */
apalmieri 0:0a9c622571d7 120 GPSDatalog(const GPSDatalog&);
apalmieri 0:0a9c622571d7 121 GPSDatalog & operator= (const GPSDatalog&);
apalmieri 0:0a9c622571d7 122 };
apalmieri 0:0a9c622571d7 123
apalmieri 0:0a9c622571d7 124 #endif /* __GPS_DATALOG_H__ */