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:
source/GPSProvider.cpp@4:193bf97d4c5a, 2019-02-14 (annotated)
- Committer:
- apalmieri
- Date:
- Thu Feb 14 11:37:06 2019 +0000
- Revision:
- 4:193bf97d4c5a
- Parent:
- 0:0a9c622571d7
Update .json file
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
apalmieri | 0:0a9c622571d7 | 1 | /* mbed Microcontroller Library |
apalmieri | 0:0a9c622571d7 | 2 | * Copyright (c) 2006-2014 ARM Limited |
apalmieri | 0:0a9c622571d7 | 3 | * |
apalmieri | 0:0a9c622571d7 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
apalmieri | 0:0a9c622571d7 | 5 | * you may not use this file except in compliance with the License. |
apalmieri | 0:0a9c622571d7 | 6 | * You may obtain a copy of the License at |
apalmieri | 0:0a9c622571d7 | 7 | * |
apalmieri | 0:0a9c622571d7 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
apalmieri | 0:0a9c622571d7 | 9 | * |
apalmieri | 0:0a9c622571d7 | 10 | * Unless required by applicable law or agreed to in writing, software |
apalmieri | 0:0a9c622571d7 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
apalmieri | 0:0a9c622571d7 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
apalmieri | 0:0a9c622571d7 | 13 | * See the License for the specific language governing permissions and |
apalmieri | 0:0a9c622571d7 | 14 | * limitations under the License. |
apalmieri | 0:0a9c622571d7 | 15 | */ |
apalmieri | 0:0a9c622571d7 | 16 | |
apalmieri | 0:0a9c622571d7 | 17 | #include "mbed.h" |
apalmieri | 0:0a9c622571d7 | 18 | #include "GPSProviderImplBase.h" |
apalmieri | 0:0a9c622571d7 | 19 | #include "GPSProvider.h" |
apalmieri | 0:0a9c622571d7 | 20 | |
apalmieri | 0:0a9c622571d7 | 21 | bool |
apalmieri | 0:0a9c622571d7 | 22 | GPSProvider::setPowerMode(PowerMode_t power) |
apalmieri | 0:0a9c622571d7 | 23 | { |
apalmieri | 0:0a9c622571d7 | 24 | return impl->setPowerMode(power); |
apalmieri | 0:0a9c622571d7 | 25 | } |
apalmieri | 0:0a9c622571d7 | 26 | |
apalmieri | 0:0a9c622571d7 | 27 | void |
apalmieri | 0:0a9c622571d7 | 28 | GPSProvider::reset(void) |
apalmieri | 0:0a9c622571d7 | 29 | { |
apalmieri | 0:0a9c622571d7 | 30 | impl->reset(); |
apalmieri | 0:0a9c622571d7 | 31 | } |
apalmieri | 0:0a9c622571d7 | 32 | |
apalmieri | 0:0a9c622571d7 | 33 | void |
apalmieri | 0:0a9c622571d7 | 34 | GPSProvider::start(void) |
apalmieri | 0:0a9c622571d7 | 35 | { |
apalmieri | 0:0a9c622571d7 | 36 | impl->start(); |
apalmieri | 0:0a9c622571d7 | 37 | } |
apalmieri | 0:0a9c622571d7 | 38 | |
apalmieri | 0:0a9c622571d7 | 39 | void |
apalmieri | 0:0a9c622571d7 | 40 | GPSProvider::stop(void) |
apalmieri | 0:0a9c622571d7 | 41 | { |
apalmieri | 0:0a9c622571d7 | 42 | impl->stop(); |
apalmieri | 0:0a9c622571d7 | 43 | } |
apalmieri | 0:0a9c622571d7 | 44 | |
apalmieri | 0:0a9c622571d7 | 45 | void |
apalmieri | 0:0a9c622571d7 | 46 | GPSProvider::process(void) |
apalmieri | 0:0a9c622571d7 | 47 | { |
apalmieri | 0:0a9c622571d7 | 48 | impl->process(); |
apalmieri | 0:0a9c622571d7 | 49 | } |
apalmieri | 0:0a9c622571d7 | 50 | |
apalmieri | 0:0a9c622571d7 | 51 | bool |
apalmieri | 0:0a9c622571d7 | 52 | GPSProvider::haveDeviceInfo(void) const |
apalmieri | 0:0a9c622571d7 | 53 | { |
apalmieri | 0:0a9c622571d7 | 54 | return impl->haveDeviceInfo(); |
apalmieri | 0:0a9c622571d7 | 55 | } |
apalmieri | 0:0a9c622571d7 | 56 | |
apalmieri | 0:0a9c622571d7 | 57 | const char * |
apalmieri | 0:0a9c622571d7 | 58 | GPSProvider::getDeviceInfo(void) const |
apalmieri | 0:0a9c622571d7 | 59 | { |
apalmieri | 0:0a9c622571d7 | 60 | return impl->getDeviceInfo(); |
apalmieri | 0:0a9c622571d7 | 61 | } |
apalmieri | 0:0a9c622571d7 | 62 | |
apalmieri | 0:0a9c622571d7 | 63 | uint32_t |
apalmieri | 0:0a9c622571d7 | 64 | GPSProvider::ioctl(uint32_t command, void *arg) |
apalmieri | 0:0a9c622571d7 | 65 | { |
apalmieri | 0:0a9c622571d7 | 66 | return impl->ioctl(command, arg); |
apalmieri | 0:0a9c622571d7 | 67 | } |
apalmieri | 0:0a9c622571d7 | 68 | |
apalmieri | 0:0a9c622571d7 | 69 | bool |
apalmieri | 0:0a9c622571d7 | 70 | GPSProvider::locationAvailable(void) const |
apalmieri | 0:0a9c622571d7 | 71 | { |
apalmieri | 0:0a9c622571d7 | 72 | return impl->locationAvailable(); |
apalmieri | 0:0a9c622571d7 | 73 | } |
apalmieri | 0:0a9c622571d7 | 74 | |
apalmieri | 0:0a9c622571d7 | 75 | const GPSProvider::LocationUpdateParams_t * |
apalmieri | 0:0a9c622571d7 | 76 | GPSProvider::getLastLocation(void) const |
apalmieri | 0:0a9c622571d7 | 77 | { |
apalmieri | 0:0a9c622571d7 | 78 | return impl->getLastLocation(); |
apalmieri | 0:0a9c622571d7 | 79 | } |
apalmieri | 0:0a9c622571d7 | 80 | |
apalmieri | 0:0a9c622571d7 | 81 | void |
apalmieri | 0:0a9c622571d7 | 82 | GPSProvider::onLocationUpdate(LocationUpdateCallback_t callback) |
apalmieri | 0:0a9c622571d7 | 83 | { |
apalmieri | 0:0a9c622571d7 | 84 | impl->onLocationUpdate(callback); |
apalmieri | 0:0a9c622571d7 | 85 | } |
apalmieri | 0:0a9c622571d7 | 86 | |
apalmieri | 0:0a9c622571d7 | 87 | void |
apalmieri | 0:0a9c622571d7 | 88 | GPSProvider::lpmGetImmediateLocation(void) |
apalmieri | 0:0a9c622571d7 | 89 | { |
apalmieri | 0:0a9c622571d7 | 90 | impl->lpmGetImmediateLocation(); |
apalmieri | 0:0a9c622571d7 | 91 | } |
apalmieri | 0:0a9c622571d7 | 92 | |
apalmieri | 0:0a9c622571d7 | 93 | /** [ST-GNSS ] - Enable verbose NMEA stream */ |
apalmieri | 0:0a9c622571d7 | 94 | void |
apalmieri | 0:0a9c622571d7 | 95 | GPSProvider::setVerboseMode(int level) |
apalmieri | 0:0a9c622571d7 | 96 | { |
apalmieri | 0:0a9c622571d7 | 97 | impl->setVerboseMode(level); |
apalmieri | 0:0a9c622571d7 | 98 | } |
apalmieri | 0:0a9c622571d7 | 99 | |
apalmieri | 0:0a9c622571d7 | 100 | /** [ST-GNSS] - Geofencing API */ |
apalmieri | 0:0a9c622571d7 | 101 | bool |
apalmieri | 0:0a9c622571d7 | 102 | GPSProvider::isGeofencingSupported(void) |
apalmieri | 0:0a9c622571d7 | 103 | { |
apalmieri | 0:0a9c622571d7 | 104 | return impl->isGeofencingSupported(); |
apalmieri | 0:0a9c622571d7 | 105 | } |
apalmieri | 0:0a9c622571d7 | 106 | |
apalmieri | 0:0a9c622571d7 | 107 | /** [ST-GNSS] - Geofencing API */ |
apalmieri | 0:0a9c622571d7 | 108 | gps_provider_error_t |
apalmieri | 0:0a9c622571d7 | 109 | GPSProvider::enableGeofence(void) |
apalmieri | 0:0a9c622571d7 | 110 | { |
apalmieri | 0:0a9c622571d7 | 111 | return impl->enableGeofence(); |
apalmieri | 0:0a9c622571d7 | 112 | } |
apalmieri | 0:0a9c622571d7 | 113 | |
apalmieri | 0:0a9c622571d7 | 114 | /** [ST-GNSS] - Geofencing API */ |
apalmieri | 0:0a9c622571d7 | 115 | gps_provider_error_t |
apalmieri | 0:0a9c622571d7 | 116 | GPSProvider::configGeofences(GPSGeofence *geofences[], unsigned geofenceCount) |
apalmieri | 0:0a9c622571d7 | 117 | { |
apalmieri | 0:0a9c622571d7 | 118 | return impl->configGeofences(geofences, geofenceCount); |
apalmieri | 0:0a9c622571d7 | 119 | } |
apalmieri | 0:0a9c622571d7 | 120 | |
apalmieri | 0:0a9c622571d7 | 121 | /** [ST-GNSS] - Geofencing API */ |
apalmieri | 0:0a9c622571d7 | 122 | gps_provider_error_t |
apalmieri | 0:0a9c622571d7 | 123 | GPSProvider::geofenceReq(void) |
apalmieri | 0:0a9c622571d7 | 124 | { |
apalmieri | 0:0a9c622571d7 | 125 | return impl->geofenceReq(); |
apalmieri | 0:0a9c622571d7 | 126 | } |
apalmieri | 0:0a9c622571d7 | 127 | |
apalmieri | 0:0a9c622571d7 | 128 | /** [ST-GNSS] - Geofencing API */ |
apalmieri | 0:0a9c622571d7 | 129 | void |
apalmieri | 0:0a9c622571d7 | 130 | GPSProvider::onGeofenceCfgMessage(GeofenceCfgMessageCallback_t callback) |
apalmieri | 0:0a9c622571d7 | 131 | { |
apalmieri | 0:0a9c622571d7 | 132 | impl->onGeofenceCfgMessage(callback); |
apalmieri | 0:0a9c622571d7 | 133 | } |
apalmieri | 0:0a9c622571d7 | 134 | |
apalmieri | 0:0a9c622571d7 | 135 | /** [ST-GNSS] - Geofencing API */ |
apalmieri | 0:0a9c622571d7 | 136 | void |
apalmieri | 0:0a9c622571d7 | 137 | GPSProvider::onGeofenceStatusMessage(GeofenceStatusMessageCallback_t callback) |
apalmieri | 0:0a9c622571d7 | 138 | { |
apalmieri | 0:0a9c622571d7 | 139 | impl->onGeofenceStatusMessage(callback); |
apalmieri | 0:0a9c622571d7 | 140 | } |
apalmieri | 0:0a9c622571d7 | 141 | |
apalmieri | 0:0a9c622571d7 | 142 | /** [ST-GNSS] - Datalogging API */ |
apalmieri | 0:0a9c622571d7 | 143 | bool |
apalmieri | 0:0a9c622571d7 | 144 | GPSProvider::isDataloggingSupported(void) |
apalmieri | 0:0a9c622571d7 | 145 | { |
apalmieri | 0:0a9c622571d7 | 146 | return impl->isDataloggingSupported(); |
apalmieri | 0:0a9c622571d7 | 147 | } |
apalmieri | 0:0a9c622571d7 | 148 | |
apalmieri | 0:0a9c622571d7 | 149 | /** [ST-GNSS] - Datalogging API */ |
apalmieri | 0:0a9c622571d7 | 150 | gps_provider_error_t |
apalmieri | 0:0a9c622571d7 | 151 | GPSProvider::enableDatalog(void) |
apalmieri | 0:0a9c622571d7 | 152 | { |
apalmieri | 0:0a9c622571d7 | 153 | return impl->enableDatalog(); |
apalmieri | 0:0a9c622571d7 | 154 | } |
apalmieri | 0:0a9c622571d7 | 155 | |
apalmieri | 0:0a9c622571d7 | 156 | /** [ST-GNSS] - Datalogging API */ |
apalmieri | 0:0a9c622571d7 | 157 | gps_provider_error_t |
apalmieri | 0:0a9c622571d7 | 158 | GPSProvider::configDatalog(GPSDatalog *datalog) |
apalmieri | 0:0a9c622571d7 | 159 | { |
apalmieri | 0:0a9c622571d7 | 160 | return impl->configDatalog(datalog); |
apalmieri | 0:0a9c622571d7 | 161 | } |
apalmieri | 0:0a9c622571d7 | 162 | |
apalmieri | 0:0a9c622571d7 | 163 | /** [ST-GNSS] - Datalogging API */ |
apalmieri | 0:0a9c622571d7 | 164 | gps_provider_error_t |
apalmieri | 0:0a9c622571d7 | 165 | GPSProvider::startDatalog(void) |
apalmieri | 0:0a9c622571d7 | 166 | { |
apalmieri | 0:0a9c622571d7 | 167 | return impl->startDatalog(); |
apalmieri | 0:0a9c622571d7 | 168 | } |
apalmieri | 0:0a9c622571d7 | 169 | |
apalmieri | 0:0a9c622571d7 | 170 | /** [ST-GNSS] - Datalogging API */ |
apalmieri | 0:0a9c622571d7 | 171 | gps_provider_error_t |
apalmieri | 0:0a9c622571d7 | 172 | GPSProvider::stopDatalog(void) |
apalmieri | 0:0a9c622571d7 | 173 | { |
apalmieri | 0:0a9c622571d7 | 174 | return impl->stopDatalog(); |
apalmieri | 0:0a9c622571d7 | 175 | } |
apalmieri | 0:0a9c622571d7 | 176 | |
apalmieri | 0:0a9c622571d7 | 177 | /** [ST-GNSS] - Datalogging API */ |
apalmieri | 0:0a9c622571d7 | 178 | gps_provider_error_t |
apalmieri | 0:0a9c622571d7 | 179 | GPSProvider::eraseDatalog(void) |
apalmieri | 0:0a9c622571d7 | 180 | { |
apalmieri | 0:0a9c622571d7 | 181 | return impl->eraseDatalog(); |
apalmieri | 0:0a9c622571d7 | 182 | } |
apalmieri | 0:0a9c622571d7 | 183 | |
apalmieri | 0:0a9c622571d7 | 184 | /** [ST-GNSS] - Datalogging API */ |
apalmieri | 0:0a9c622571d7 | 185 | gps_provider_error_t |
apalmieri | 0:0a9c622571d7 | 186 | GPSProvider::logReqStatus(void) |
apalmieri | 0:0a9c622571d7 | 187 | { |
apalmieri | 0:0a9c622571d7 | 188 | return impl->logReqStatus(); |
apalmieri | 0:0a9c622571d7 | 189 | } |
apalmieri | 0:0a9c622571d7 | 190 | |
apalmieri | 0:0a9c622571d7 | 191 | /** [ST-GNSS] - Datalogging API */ |
apalmieri | 0:0a9c622571d7 | 192 | gps_provider_error_t |
apalmieri | 0:0a9c622571d7 | 193 | GPSProvider::logReqQuery(LogQueryParams_t &logReqQuery) |
apalmieri | 0:0a9c622571d7 | 194 | { |
apalmieri | 0:0a9c622571d7 | 195 | return impl->logReqQuery(logReqQuery); |
apalmieri | 0:0a9c622571d7 | 196 | } |
apalmieri | 0:0a9c622571d7 | 197 | |
apalmieri | 0:0a9c622571d7 | 198 | /** [ST-GNSS] - Datalogging API */ |
apalmieri | 0:0a9c622571d7 | 199 | void |
apalmieri | 0:0a9c622571d7 | 200 | GPSProvider::onLogStatus(LogStatusCallback_t callback) |
apalmieri | 0:0a9c622571d7 | 201 | { |
apalmieri | 0:0a9c622571d7 | 202 | impl->onLogStatus(callback); |
apalmieri | 0:0a9c622571d7 | 203 | } |
apalmieri | 0:0a9c622571d7 | 204 | |
apalmieri | 0:0a9c622571d7 | 205 | /** [ST-GNSS] - Datalogging API */ |
apalmieri | 0:0a9c622571d7 | 206 | void |
apalmieri | 0:0a9c622571d7 | 207 | GPSProvider::onLogQuery(LogQueryCallback_t callback) |
apalmieri | 0:0a9c622571d7 | 208 | { |
apalmieri | 0:0a9c622571d7 | 209 | impl->onLogQuery(callback); |
apalmieri | 0:0a9c622571d7 | 210 | } |
apalmieri | 0:0a9c622571d7 | 211 | |
apalmieri | 0:0a9c622571d7 | 212 | /** [ST-GNSS] - Odometer API */ |
apalmieri | 0:0a9c622571d7 | 213 | bool |
apalmieri | 0:0a9c622571d7 | 214 | GPSProvider::isOdometerSupported(void) |
apalmieri | 0:0a9c622571d7 | 215 | { |
apalmieri | 0:0a9c622571d7 | 216 | return impl->isOdometerSupported(); |
apalmieri | 0:0a9c622571d7 | 217 | } |
apalmieri | 0:0a9c622571d7 | 218 | |
apalmieri | 0:0a9c622571d7 | 219 | /** [ST-GNSS] - Odometer API */ |
apalmieri | 0:0a9c622571d7 | 220 | gps_provider_error_t |
apalmieri | 0:0a9c622571d7 | 221 | GPSProvider::enableOdo(void) |
apalmieri | 0:0a9c622571d7 | 222 | { |
apalmieri | 0:0a9c622571d7 | 223 | return impl->enableOdo(); |
apalmieri | 0:0a9c622571d7 | 224 | } |
apalmieri | 0:0a9c622571d7 | 225 | |
apalmieri | 0:0a9c622571d7 | 226 | /** [ST-GNSS] - Odometer API */ |
apalmieri | 0:0a9c622571d7 | 227 | gps_provider_error_t |
apalmieri | 0:0a9c622571d7 | 228 | GPSProvider::startOdo(unsigned alarmDistance) |
apalmieri | 0:0a9c622571d7 | 229 | { |
apalmieri | 0:0a9c622571d7 | 230 | return impl->startOdo(alarmDistance); |
apalmieri | 0:0a9c622571d7 | 231 | } |
apalmieri | 0:0a9c622571d7 | 232 | |
apalmieri | 0:0a9c622571d7 | 233 | /** [ST-GNSS] - Odometer API */ |
apalmieri | 0:0a9c622571d7 | 234 | gps_provider_error_t |
apalmieri | 0:0a9c622571d7 | 235 | GPSProvider::stopOdo(void) |
apalmieri | 0:0a9c622571d7 | 236 | { |
apalmieri | 0:0a9c622571d7 | 237 | return impl->stopOdo(); |
apalmieri | 0:0a9c622571d7 | 238 | } |
apalmieri | 0:0a9c622571d7 | 239 | |
apalmieri | 0:0a9c622571d7 | 240 | /** [ST-GNSS] - Odometer API */ |
apalmieri | 0:0a9c622571d7 | 241 | gps_provider_error_t |
apalmieri | 0:0a9c622571d7 | 242 | GPSProvider::resetOdo(void) |
apalmieri | 0:0a9c622571d7 | 243 | { |
apalmieri | 0:0a9c622571d7 | 244 | return impl->resetOdo(); |
apalmieri | 0:0a9c622571d7 | 245 | } |
apalmieri | 0:0a9c622571d7 | 246 | |
apalmieri | 0:0a9c622571d7 | 247 | /** [ST-GNSS] - Odometer API */ |
apalmieri | 0:0a9c622571d7 | 248 | void |
apalmieri | 0:0a9c622571d7 | 249 | GPSProvider::onOdo(OdoCallback_t callback) |
apalmieri | 0:0a9c622571d7 | 250 | { |
apalmieri | 0:0a9c622571d7 | 251 | impl->onOdo(callback); |
apalmieri | 0:0a9c622571d7 | 252 | } |