An extension of original API for working with GPS devices.
GPSProviderImplBase.h@10:013af7b8c22a, 2017-06-19 (annotated)
- Committer:
- apalmieri
- Date:
- Mon Jun 19 13:48:56 2017 +0000
- Revision:
- 10:013af7b8c22a
- Parent:
- 8:47fa213225c3
Typo in header comment
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rgrover1 | 0:792e9343fd39 | 1 | /* mbed Microcontroller Library |
rgrover1 | 0:792e9343fd39 | 2 | * Copyright (c) 2006-2014 ARM Limited |
rgrover1 | 0:792e9343fd39 | 3 | * |
rgrover1 | 0:792e9343fd39 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
rgrover1 | 0:792e9343fd39 | 5 | * you may not use this file except in compliance with the License. |
rgrover1 | 0:792e9343fd39 | 6 | * You may obtain a copy of the License at |
rgrover1 | 0:792e9343fd39 | 7 | * |
rgrover1 | 0:792e9343fd39 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
rgrover1 | 0:792e9343fd39 | 9 | * |
rgrover1 | 0:792e9343fd39 | 10 | * Unless required by applicable law or agreed to in writing, software |
rgrover1 | 0:792e9343fd39 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
rgrover1 | 0:792e9343fd39 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
rgrover1 | 0:792e9343fd39 | 13 | * See the License for the specific language governing permissions and |
rgrover1 | 0:792e9343fd39 | 14 | * limitations under the License. |
rgrover1 | 0:792e9343fd39 | 15 | */ |
rgrover1 | 0:792e9343fd39 | 16 | |
rgrover1 | 0:792e9343fd39 | 17 | #ifndef __GPS_PROVIDER_INSTANCE_BASE_H__ |
rgrover1 | 0:792e9343fd39 | 18 | #define __GPS_PROVIDER_INSTANCE_BASE_H__ |
rgrover1 | 0:792e9343fd39 | 19 | |
rgrover1 | 0:792e9343fd39 | 20 | #include "GPSProvider.h" |
apalmieri | 8:47fa213225c3 | 21 | #include "GPSGeofence.h" |
rgrover1 | 0:792e9343fd39 | 22 | |
rgrover1 | 0:792e9343fd39 | 23 | class GPSProviderImplBase { |
rgrover1 | 0:792e9343fd39 | 24 | public: |
rgrover1 | 0:792e9343fd39 | 25 | virtual bool setPowerMode(GPSProvider::PowerMode_t power) = 0; |
rgrover1 | 1:c1122f8eec82 | 26 | virtual void reset(void) = 0; |
rgrover1 | 1:c1122f8eec82 | 27 | virtual void start(void) = 0; |
rgrover1 | 1:c1122f8eec82 | 28 | virtual void stop(void) = 0; |
rgrover1 | 1:c1122f8eec82 | 29 | virtual void process(void) = 0; |
rgrover1 | 1:c1122f8eec82 | 30 | virtual void lpmGetImmediateLocation(void) = 0; |
rgrover1 | 3:47aaf0ebde35 | 31 | virtual uint32_t ioctl(uint32_t command, void *arg) = 0; |
rgrover1 | 1:c1122f8eec82 | 32 | |
rgrover1 | 1:c1122f8eec82 | 33 | virtual bool haveDeviceInfo(void) const { |
rgrover1 | 1:c1122f8eec82 | 34 | return (deviceInfo != NULL); |
rgrover1 | 1:c1122f8eec82 | 35 | } |
rgrover1 | 1:c1122f8eec82 | 36 | virtual const char *getDeviceInfo(void) const { |
rgrover1 | 1:c1122f8eec82 | 37 | return deviceInfo; |
rgrover1 | 1:c1122f8eec82 | 38 | } |
rgrover1 | 1:c1122f8eec82 | 39 | virtual bool locationAvailable(void) const { |
rgrover1 | 1:c1122f8eec82 | 40 | return lastLocation.valid; |
rgrover1 | 1:c1122f8eec82 | 41 | } |
rgrover1 | 1:c1122f8eec82 | 42 | virtual const GPSProvider::LocationUpdateParams_t *getLastLocation(void) const { |
rgrover1 | 1:c1122f8eec82 | 43 | return (lastLocation.valid) ? &lastLocation : NULL; |
rgrover1 | 1:c1122f8eec82 | 44 | } |
rgrover1 | 1:c1122f8eec82 | 45 | virtual void onLocationUpdate(GPSProvider::LocationUpdateCallback_t callback) { |
rgrover1 | 1:c1122f8eec82 | 46 | locationCallback = callback; |
rgrover1 | 1:c1122f8eec82 | 47 | } |
apalmieri | 8:47fa213225c3 | 48 | // [ST-GNSS] - Geofencing API |
apalmieri | 8:47fa213225c3 | 49 | virtual bool isGeofencingSupported(void) const { |
apalmieri | 8:47fa213225c3 | 50 | return false; /* Requesting action from porters: override this API if this capability is supported. */ |
apalmieri | 8:47fa213225c3 | 51 | } |
apalmieri | 8:47fa213225c3 | 52 | // [ST-GNSS] - Geofencing API |
apalmieri | 8:47fa213225c3 | 53 | virtual void onGeofencesTrigger(GPSProvider::GeofencesTriggerCallback_t callback) { |
apalmieri | 8:47fa213225c3 | 54 | geofencesTriggerCallback = callback; |
apalmieri | 8:47fa213225c3 | 55 | } |
rgrover1 | 1:c1122f8eec82 | 56 | |
rgrover1 | 1:c1122f8eec82 | 57 | protected: |
apalmieri | 8:47fa213225c3 | 58 | GPSProvider::LocationUpdateParams_t lastLocation; |
apalmieri | 8:47fa213225c3 | 59 | const char *deviceInfo; |
apalmieri | 8:47fa213225c3 | 60 | GPSProvider::LocationUpdateCallback_t locationCallback; |
apalmieri | 8:47fa213225c3 | 61 | // [ST-GNSS] - Geofencing API |
apalmieri | 8:47fa213225c3 | 62 | GPSGeofence **geofences; |
apalmieri | 8:47fa213225c3 | 63 | // [ST-GNSS] - Geofencing API |
apalmieri | 8:47fa213225c3 | 64 | GPSProvider::GeofencesTriggerCallback_t geofencesTriggerCallback; |
rgrover1 | 0:792e9343fd39 | 65 | }; |
rgrover1 | 0:792e9343fd39 | 66 | |
rgrover1 | 0:792e9343fd39 | 67 | #endif /* __GPS_PROVIDER_INSTANCE_BASE_H__ */ |