mbed Connector Interface simplification API on top of mbed-client
Fork of mbedConnectorInterfaceV3 by
NOTE:
This repo has been replaced with https://github.com/ARMmbed/mbedConnectorInterface. No further updates will occur with this repo. Please use the github repo instead. Thanks!
source/Location.cpp@0:1f1f55e73248, 2016-02-19 (annotated)
- Committer:
- ansond
- Date:
- Fri Feb 19 17:32:14 2016 +0000
- Revision:
- 0:1f1f55e73248
- Child:
- 33:1d0b855df5a5
initial checkin
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 0:1f1f55e73248 | 1 | /** |
ansond | 0:1f1f55e73248 | 2 | * @file Location.cpp |
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 | #include "mbed-connector-interface/Location.h" |
ansond | 0:1f1f55e73248 | 24 | |
ansond | 0:1f1f55e73248 | 25 | namespace Connector { |
ansond | 0:1f1f55e73248 | 26 | |
ansond | 0:1f1f55e73248 | 27 | // Constructor |
ansond | 0:1f1f55e73248 | 28 | Location::Location(const RawSerial *pc) { |
ansond | 0:1f1f55e73248 | 29 | this->m_pc = (RawSerial *)pc; |
ansond | 0:1f1f55e73248 | 30 | this->initBuffers(); |
ansond | 0:1f1f55e73248 | 31 | } |
ansond | 0:1f1f55e73248 | 32 | |
ansond | 0:1f1f55e73248 | 33 | // Copy Constructor |
ansond | 0:1f1f55e73248 | 34 | Location::Location(const Location &location) { |
ansond | 0:1f1f55e73248 | 35 | this->m_pc = location.m_pc; |
ansond | 0:1f1f55e73248 | 36 | memcpy(this->m_latitude,location.m_latitude,LOCATION_COORDINATE_LENGTH+1); |
ansond | 0:1f1f55e73248 | 37 | memcpy(this->m_longitude,location.m_longitude,LOCATION_COORDINATE_LENGTH+1); |
ansond | 0:1f1f55e73248 | 38 | memcpy(this->m_msl_altitude_m,location.m_msl_altitude_m,LOCATION_MSL_ALT_LENGTH+1); |
ansond | 0:1f1f55e73248 | 39 | memcpy(this->m_speed,location.m_speed,LOCATION_SPEED_LENGTH+1); |
ansond | 0:1f1f55e73248 | 40 | } |
ansond | 0:1f1f55e73248 | 41 | |
ansond | 0:1f1f55e73248 | 42 | // Destructor |
ansond | 0:1f1f55e73248 | 43 | Location::~Location() { |
ansond | 0:1f1f55e73248 | 44 | } |
ansond | 0:1f1f55e73248 | 45 | |
ansond | 0:1f1f55e73248 | 46 | // init the buffers |
ansond | 0:1f1f55e73248 | 47 | void Location::initBuffers() { |
ansond | 0:1f1f55e73248 | 48 | memset(this->m_latitude,0,LOCATION_COORDINATE_LENGTH+1); |
ansond | 0:1f1f55e73248 | 49 | memset(this->m_longitude,0,LOCATION_COORDINATE_LENGTH+1); |
ansond | 0:1f1f55e73248 | 50 | memset(this->m_msl_altitude_m,0,LOCATION_MSL_ALT_LENGTH+1); |
ansond | 0:1f1f55e73248 | 51 | memset(this->m_speed,0,LOCATION_SPEED_LENGTH+1); |
ansond | 0:1f1f55e73248 | 52 | } |
ansond | 0:1f1f55e73248 | 53 | |
ansond | 0:1f1f55e73248 | 54 | // get the latitude |
ansond | 0:1f1f55e73248 | 55 | char *Location::getLatitude() { |
ansond | 0:1f1f55e73248 | 56 | return this->m_latitude; |
ansond | 0:1f1f55e73248 | 57 | } |
ansond | 0:1f1f55e73248 | 58 | |
ansond | 0:1f1f55e73248 | 59 | // get the longitude |
ansond | 0:1f1f55e73248 | 60 | char *Location::getLongitude() { |
ansond | 0:1f1f55e73248 | 61 | return this->m_longitude; |
ansond | 0:1f1f55e73248 | 62 | } |
ansond | 0:1f1f55e73248 | 63 | |
ansond | 0:1f1f55e73248 | 64 | // get the MSL Altitude |
ansond | 0:1f1f55e73248 | 65 | char *Location::getMSLAltitude() { |
ansond | 0:1f1f55e73248 | 66 | return this->m_msl_altitude_m; |
ansond | 0:1f1f55e73248 | 67 | } |
ansond | 0:1f1f55e73248 | 68 | |
ansond | 0:1f1f55e73248 | 69 | // get the Speed |
ansond | 0:1f1f55e73248 | 70 | char *Location::getSpeed() { |
ansond | 0:1f1f55e73248 | 71 | return this->m_speed; |
ansond | 0:1f1f55e73248 | 72 | } |
ansond | 0:1f1f55e73248 | 73 | |
ansond | 0:1f1f55e73248 | 74 | }; |
ansond | 0:1f1f55e73248 | 75 |