A controller-neutral API for working with GPS devices.
Dependents: CsrLocationDemo CsrLocationDemo
GPSProviderImplBase.h@1:c1122f8eec82, 2014-10-31 (annotated)
- Committer:
- rgrover1
- Date:
- Fri Oct 31 13:34:59 2014 +0000
- Revision:
- 1:c1122f8eec82
- Parent:
- 0:792e9343fd39
- Child:
- 3:47aaf0ebde35
Updating GPSProvider based on input from CSR.
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" |
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 | 1:c1122f8eec82 | 30 | |
rgrover1 | 1:c1122f8eec82 | 31 | virtual bool haveDeviceInfo(void) const { |
rgrover1 | 1:c1122f8eec82 | 32 | return (deviceInfo != NULL); |
rgrover1 | 1:c1122f8eec82 | 33 | } |
rgrover1 | 1:c1122f8eec82 | 34 | virtual const char *getDeviceInfo(void) const { |
rgrover1 | 1:c1122f8eec82 | 35 | return deviceInfo; |
rgrover1 | 1:c1122f8eec82 | 36 | } |
rgrover1 | 1:c1122f8eec82 | 37 | virtual bool locationAvailable(void) const { |
rgrover1 | 1:c1122f8eec82 | 38 | return lastLocation.valid; |
rgrover1 | 1:c1122f8eec82 | 39 | } |
rgrover1 | 1:c1122f8eec82 | 40 | virtual const GPSProvider::LocationUpdateParams_t *getLastLocation(void) const { |
rgrover1 | 1:c1122f8eec82 | 41 | return (lastLocation.valid) ? &lastLocation : NULL; |
rgrover1 | 1:c1122f8eec82 | 42 | } |
rgrover1 | 1:c1122f8eec82 | 43 | virtual void onLocationUpdate(GPSProvider::LocationUpdateCallback_t callback) { |
rgrover1 | 1:c1122f8eec82 | 44 | locationCallback = callback; |
rgrover1 | 1:c1122f8eec82 | 45 | } |
rgrover1 | 1:c1122f8eec82 | 46 | |
rgrover1 | 1:c1122f8eec82 | 47 | protected: |
rgrover1 | 1:c1122f8eec82 | 48 | GPSProvider::LocationUpdateParams_t lastLocation; |
rgrover1 | 1:c1122f8eec82 | 49 | const char *deviceInfo; |
rgrover1 | 1:c1122f8eec82 | 50 | GPSProvider::LocationUpdateCallback_t locationCallback; |
rgrover1 | 0:792e9343fd39 | 51 | }; |
rgrover1 | 0:792e9343fd39 | 52 | |
rgrover1 | 0:792e9343fd39 | 53 | #endif /* __GPS_PROVIDER_INSTANCE_BASE_H__ */ |