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