mbed Connector Endpoint interface. This interface permits a mbed endpoint to easily setup MDS resources and emit those resources to an MDS server.
Dependents: IoT_LED_demo ServoTest uWater_Project hackathon ... more
api/Location.h@58:5b53d462d311, 2015-07-25 (annotated)
- Committer:
- ansond
- Date:
- Sat Jul 25 05:14:14 2015 +0000
- Revision:
- 58:5b53d462d311
- Child:
- 59:3b99f4901e85
updated configuration header structure. Added Location base class
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 58:5b53d462d311 | 1 | /** |
ansond | 58:5b53d462d311 | 2 | * @file Location.h |
ansond | 58:5b53d462d311 | 3 | * @brief mbed CoAP Endpoint location base class |
ansond | 58:5b53d462d311 | 4 | * @author Doug Anson/Chris Paola |
ansond | 58:5b53d462d311 | 5 | * @version 1.0 |
ansond | 58:5b53d462d311 | 6 | * @see |
ansond | 58:5b53d462d311 | 7 | * |
ansond | 58:5b53d462d311 | 8 | * Copyright (c) 2014 |
ansond | 58:5b53d462d311 | 9 | * |
ansond | 58:5b53d462d311 | 10 | * Licensed under the Apache License, Version 2.0 (the "License"); |
ansond | 58:5b53d462d311 | 11 | * you may not use this file except in compliance with the License. |
ansond | 58:5b53d462d311 | 12 | * You may obtain a copy of the License at |
ansond | 58:5b53d462d311 | 13 | * |
ansond | 58:5b53d462d311 | 14 | * http://www.apache.org/licenses/LICENSE-2.0 |
ansond | 58:5b53d462d311 | 15 | * |
ansond | 58:5b53d462d311 | 16 | * Unless required by applicable law or agreed to in writing, software |
ansond | 58:5b53d462d311 | 17 | * distributed under the License is distributed on an "AS IS" BASIS, |
ansond | 58:5b53d462d311 | 18 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ansond | 58:5b53d462d311 | 19 | * See the License for the specific language governing permissions and |
ansond | 58:5b53d462d311 | 20 | * limitations under the License. |
ansond | 58:5b53d462d311 | 21 | */ |
ansond | 58:5b53d462d311 | 22 | |
ansond | 58:5b53d462d311 | 23 | #ifndef __LOCATION_H__ |
ansond | 58:5b53d462d311 | 24 | #define __LOCATION_H__ |
ansond | 58:5b53d462d311 | 25 | |
ansond | 58:5b53d462d311 | 26 | // mbed API |
ansond | 58:5b53d462d311 | 27 | #include "mbed.h" |
ansond | 58:5b53d462d311 | 28 | |
ansond | 58:5b53d462d311 | 29 | // Max length of a coordinate: -XXX.YYYYYY |
ansond | 58:5b53d462d311 | 30 | #define LOCATION_COORDINATE_LENGTH 12 |
ansond | 58:5b53d462d311 | 31 | |
ansond | 58:5b53d462d311 | 32 | // Max length of the MSL altitude (m): ZZZZZZ.Z |
ansond | 58:5b53d462d311 | 33 | #define LOCATION_MSL_ALT_LENGTH 9 |
ansond | 58:5b53d462d311 | 34 | |
ansond | 58:5b53d462d311 | 35 | // Max length of the speed (km/h): ZZZZZZ.Z |
ansond | 58:5b53d462d311 | 36 | #define LOCATION_SPEED_LENGTH 9 |
ansond | 58:5b53d462d311 | 37 | |
ansond | 58:5b53d462d311 | 38 | namespace Connector { |
ansond | 58:5b53d462d311 | 39 | |
ansond | 58:5b53d462d311 | 40 | /** Location class |
ansond | 58:5b53d462d311 | 41 | */ |
ansond | 58:5b53d462d311 | 42 | class Location |
ansond | 58:5b53d462d311 | 43 | { |
ansond | 58:5b53d462d311 | 44 | protected: |
ansond | 58:5b53d462d311 | 45 | RawSerial *m_pc; |
ansond | 58:5b53d462d311 | 46 | char m_latitude[LOCATION_COORDINATE_LENGTH+1]; |
ansond | 58:5b53d462d311 | 47 | char m_longitude[LOCATION_COORDINATE_LENGTH+1]; |
ansond | 58:5b53d462d311 | 48 | char m_msl_altitude_m[LOCATION_MSL_ALT_LENGTH+1]; |
ansond | 58:5b53d462d311 | 49 | char m_speed[LOCATION_SPEED_LENGTH+1]; |
ansond | 58:5b53d462d311 | 50 | |
ansond | 58:5b53d462d311 | 51 | public: |
ansond | 58:5b53d462d311 | 52 | /** |
ansond | 58:5b53d462d311 | 53 | Default constructor |
ansond | 58:5b53d462d311 | 54 | @param pc input BufferedSerial instance for debugging (if NULL, no debugging output will occur in the library) |
ansond | 58:5b53d462d311 | 55 | */ |
ansond | 58:5b53d462d311 | 56 | Location(const RawSerial *pc); |
ansond | 58:5b53d462d311 | 57 | |
ansond | 58:5b53d462d311 | 58 | /** |
ansond | 58:5b53d462d311 | 59 | Copy constructor |
ansond | 58:5b53d462d311 | 60 | @param logger input Location instance to deep copy |
ansond | 58:5b53d462d311 | 61 | */ |
ansond | 58:5b53d462d311 | 62 | Location(const Location &logger); |
ansond | 58:5b53d462d311 | 63 | |
ansond | 58:5b53d462d311 | 64 | /** |
ansond | 58:5b53d462d311 | 65 | Destructor |
ansond | 58:5b53d462d311 | 66 | */ |
ansond | 58:5b53d462d311 | 67 | virtual ~Location(); |
ansond | 58:5b53d462d311 | 68 | |
ansond | 58:5b53d462d311 | 69 | /** |
ansond | 58:5b53d462d311 | 70 | Update the current location (pure virtual) |
ansond | 58:5b53d462d311 | 71 | */ |
ansond | 58:5b53d462d311 | 72 | virtual void updateLocation() = 0; |
ansond | 58:5b53d462d311 | 73 | |
ansond | 58:5b53d462d311 | 74 | /** |
ansond | 58:5b53d462d311 | 75 | Get latest Latitude (pure virtual) |
ansond | 58:5b53d462d311 | 76 | */ |
ansond | 58:5b53d462d311 | 77 | virtual char *getLatitude() = 0; |
ansond | 58:5b53d462d311 | 78 | |
ansond | 58:5b53d462d311 | 79 | /** |
ansond | 58:5b53d462d311 | 80 | Get latest Longitude (pure virtual) |
ansond | 58:5b53d462d311 | 81 | */ |
ansond | 58:5b53d462d311 | 82 | virtual char *getLongitude() = 0; |
ansond | 58:5b53d462d311 | 83 | |
ansond | 58:5b53d462d311 | 84 | /** |
ansond | 58:5b53d462d311 | 85 | Get latest MSL Altitude (m) (pure virtual) |
ansond | 58:5b53d462d311 | 86 | */ |
ansond | 58:5b53d462d311 | 87 | virtual char *getMSLAltitude() = 0; |
ansond | 58:5b53d462d311 | 88 | |
ansond | 58:5b53d462d311 | 89 | /** |
ansond | 58:5b53d462d311 | 90 | Get latest Speed (km/h) (pure virtual) |
ansond | 58:5b53d462d311 | 91 | */ |
ansond | 58:5b53d462d311 | 92 | virtual char *getSpeed() = 0; |
ansond | 58:5b53d462d311 | 93 | |
ansond | 58:5b53d462d311 | 94 | protected: |
ansond | 58:5b53d462d311 | 95 | /** |
ansond | 58:5b53d462d311 | 96 | Init buffers |
ansond | 58:5b53d462d311 | 97 | */ |
ansond | 58:5b53d462d311 | 98 | void initBuffers(); |
ansond | 58:5b53d462d311 | 99 | }; |
ansond | 58:5b53d462d311 | 100 | |
ansond | 58:5b53d462d311 | 101 | }; |
ansond | 58:5b53d462d311 | 102 | |
ansond | 58:5b53d462d311 | 103 | #endif // __LOCATION_H__ |