An extension of original API for working with GPS devices.

Committer:
rgrover1
Date:
Fri Nov 07 08:24:48 2014 +0000
Revision:
4:f35227b1f341
Parent:
3:47aaf0ebde35
making the destructor for GPSProvider non-virtual; moving it to GPSProvider.cpp.; The destructor should forward control to the impl.

Who changed what in which revision?

UserRevisionLine numberNew 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"
rgrover1 0:792e9343fd39 21
rgrover1 0:792e9343fd39 22 class GPSProviderImplBase {
rgrover1 0:792e9343fd39 23 public:
rgrover1 0:792e9343fd39 24 virtual bool setPowerMode(GPSProvider::PowerMode_t power) = 0;
rgrover1 1:c1122f8eec82 25 virtual void reset(void) = 0;
rgrover1 1:c1122f8eec82 26 virtual void start(void) = 0;
rgrover1 1:c1122f8eec82 27 virtual void stop(void) = 0;
rgrover1 1:c1122f8eec82 28 virtual void process(void) = 0;
rgrover1 1:c1122f8eec82 29 virtual void lpmGetImmediateLocation(void) = 0;
rgrover1 3:47aaf0ebde35 30 virtual uint32_t ioctl(uint32_t command, void *arg) = 0;
rgrover1 1:c1122f8eec82 31
rgrover1 1:c1122f8eec82 32 virtual bool haveDeviceInfo(void) const {
rgrover1 1:c1122f8eec82 33 return (deviceInfo != NULL);
rgrover1 1:c1122f8eec82 34 }
rgrover1 1:c1122f8eec82 35 virtual const char *getDeviceInfo(void) const {
rgrover1 1:c1122f8eec82 36 return deviceInfo;
rgrover1 1:c1122f8eec82 37 }
rgrover1 1:c1122f8eec82 38 virtual bool locationAvailable(void) const {
rgrover1 1:c1122f8eec82 39 return lastLocation.valid;
rgrover1 1:c1122f8eec82 40 }
rgrover1 1:c1122f8eec82 41 virtual const GPSProvider::LocationUpdateParams_t *getLastLocation(void) const {
rgrover1 1:c1122f8eec82 42 return (lastLocation.valid) ? &lastLocation : NULL;
rgrover1 1:c1122f8eec82 43 }
rgrover1 1:c1122f8eec82 44 virtual void onLocationUpdate(GPSProvider::LocationUpdateCallback_t callback) {
rgrover1 1:c1122f8eec82 45 locationCallback = callback;
rgrover1 1:c1122f8eec82 46 }
rgrover1 1:c1122f8eec82 47
rgrover1 4:f35227b1f341 48 public:
rgrover1 4:f35227b1f341 49 GPSProviderImplBase() : lastLocation(), deviceInfo(NULL), locationCallback(NULL) {
rgrover1 4:f35227b1f341 50 /* empty */
rgrover1 4:f35227b1f341 51 }
rgrover1 4:f35227b1f341 52
rgrover1 4:f35227b1f341 53 virtual ~GPSProviderImplBase() {
rgrover1 4:f35227b1f341 54 /* empty */
rgrover1 4:f35227b1f341 55 }
rgrover1 4:f35227b1f341 56
rgrover1 1:c1122f8eec82 57 protected:
rgrover1 1:c1122f8eec82 58 GPSProvider::LocationUpdateParams_t lastLocation;
rgrover1 1:c1122f8eec82 59 const char *deviceInfo;
rgrover1 1:c1122f8eec82 60 GPSProvider::LocationUpdateCallback_t locationCallback;
rgrover1 0:792e9343fd39 61 };
rgrover1 0:792e9343fd39 62
rgrover1 0:792e9343fd39 63 #endif /* __GPS_PROVIDER_INSTANCE_BASE_H__ */