A controller-neutral API for working with GPS devices.
Dependents: CsrLocationDemo CsrLocationDemo
GPSProviderImplBase.h@3:47aaf0ebde35, 2014-11-04 (annotated)
- Committer:
- rgrover1
- Date:
- Tue Nov 04 11:31:49 2014 +0000
- Revision:
- 3:47aaf0ebde35
- Parent:
- 1:c1122f8eec82
- Child:
- 4:f35227b1f341
improvements from Jie;; add support for ioctl()
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 | 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 | 1:c1122f8eec82 | 48 | protected: |
rgrover1 | 1:c1122f8eec82 | 49 | GPSProvider::LocationUpdateParams_t lastLocation; |
rgrover1 | 1:c1122f8eec82 | 50 | const char *deviceInfo; |
rgrover1 | 1:c1122f8eec82 | 51 | GPSProvider::LocationUpdateCallback_t locationCallback; |
rgrover1 | 0:792e9343fd39 | 52 | }; |
rgrover1 | 0:792e9343fd39 | 53 | |
rgrover1 | 0:792e9343fd39 | 54 | #endif /* __GPS_PROVIDER_INSTANCE_BASE_H__ */ |