ST / GPSProvider
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers GPSProviderImplBase.h Source File

GPSProviderImplBase.h

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2006-2014 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef __GPS_PROVIDER_INSTANCE_BASE_H__
00018 #define __GPS_PROVIDER_INSTANCE_BASE_H__
00019 
00020 #include "GPSProvider.h"
00021 #include "GPSGeofence.h"
00022 
00023 class GPSProviderImplBase {
00024 public:
00025     virtual bool setPowerMode(GPSProvider::PowerMode_t power) = 0;
00026     virtual void reset(void)   = 0;
00027     virtual void start(void)   = 0;
00028     virtual void stop(void)    = 0;
00029     virtual void process(void) = 0;
00030     virtual void lpmGetImmediateLocation(void) = 0;
00031     virtual uint32_t ioctl(uint32_t command, void *arg) = 0;
00032 
00033     virtual bool haveDeviceInfo(void) const {
00034         return (deviceInfo != NULL);
00035     }
00036     virtual const char *getDeviceInfo(void) const {
00037         return deviceInfo;
00038     }
00039     virtual bool locationAvailable(void) const {
00040         return lastLocation.valid;
00041     }
00042     virtual const GPSProvider::LocationUpdateParams_t *getLastLocation(void) const {
00043         return (lastLocation.valid) ? &lastLocation : NULL;
00044     }
00045     virtual void onLocationUpdate(GPSProvider::LocationUpdateCallback_t callback) {
00046         locationCallback = callback;
00047     }
00048     // [ST-GNSS] - Geofencing API
00049     virtual bool isGeofencingSupported(void) const { 
00050         return false; /* Requesting action from porters: override this API if this capability is supported. */ 
00051     }
00052     // [ST-GNSS] - Geofencing API
00053     virtual void onGeofencesTrigger(GPSProvider::GeofencesTriggerCallback_t callback) {
00054         geofencesTriggerCallback = callback;
00055     }
00056 
00057 protected:
00058     GPSProvider::LocationUpdateParams_t     lastLocation;
00059     const char                              *deviceInfo;
00060     GPSProvider::LocationUpdateCallback_t   locationCallback;
00061     // [ST-GNSS] - Geofencing API
00062     GPSGeofence                             **geofences;
00063     // [ST-GNSS] - Geofencing API
00064     GPSProvider::GeofencesTriggerCallback_t geofencesTriggerCallback; 
00065 };
00066 
00067 #endif /* __GPS_PROVIDER_INSTANCE_BASE_H__ */