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

Committer:
ansond
Date:
Sun Sep 06 03:16:02 2015 +0000
Revision:
61:143beb6d8800
Parent:
59:3b99f4901e85
fixes to observation configuration/toggle switch issues.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 58:5b53d462d311 1 /**
ansond 58:5b53d462d311 2 * @file Location.cpp
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 #include "Location.h"
ansond 58:5b53d462d311 24
ansond 58:5b53d462d311 25 namespace Connector {
ansond 58:5b53d462d311 26
ansond 58:5b53d462d311 27 // Constructor
ansond 59:3b99f4901e85 28 Location::Location(const RawSerial *pc) {
ansond 58:5b53d462d311 29 this->m_pc = (RawSerial *)pc;
ansond 58:5b53d462d311 30 this->initBuffers();
ansond 58:5b53d462d311 31 }
ansond 58:5b53d462d311 32
ansond 58:5b53d462d311 33 // Copy Constructor
ansond 59:3b99f4901e85 34 Location::Location(const Location &location) {
ansond 59:3b99f4901e85 35 this->m_pc = location.m_pc;
ansond 59:3b99f4901e85 36 memcpy(this->m_latitude,location.m_latitude,LOCATION_COORDINATE_LENGTH+1);
ansond 59:3b99f4901e85 37 memcpy(this->m_longitude,location.m_longitude,LOCATION_COORDINATE_LENGTH+1);
ansond 59:3b99f4901e85 38 memcpy(this->m_msl_altitude_m,location.m_msl_altitude_m,LOCATION_MSL_ALT_LENGTH+1);
ansond 59:3b99f4901e85 39 memcpy(this->m_speed,location.m_speed,LOCATION_SPEED_LENGTH+1);
ansond 58:5b53d462d311 40 }
ansond 58:5b53d462d311 41
ansond 58:5b53d462d311 42 // Destructor
ansond 59:3b99f4901e85 43 Location::~Location() {
ansond 58:5b53d462d311 44 }
ansond 58:5b53d462d311 45
ansond 58:5b53d462d311 46 // init the buffers
ansond 58:5b53d462d311 47 void Location::initBuffers() {
ansond 58:5b53d462d311 48 memset(this->m_latitude,0,LOCATION_COORDINATE_LENGTH+1);
ansond 58:5b53d462d311 49 memset(this->m_longitude,0,LOCATION_COORDINATE_LENGTH+1);
ansond 58:5b53d462d311 50 memset(this->m_msl_altitude_m,0,LOCATION_MSL_ALT_LENGTH+1);
ansond 59:3b99f4901e85 51 memset(this->m_speed,0,LOCATION_SPEED_LENGTH+1);
ansond 59:3b99f4901e85 52 }
ansond 59:3b99f4901e85 53
ansond 59:3b99f4901e85 54 // get the latitude
ansond 59:3b99f4901e85 55 char *Location::getLatitude() {
ansond 59:3b99f4901e85 56 return this->m_latitude;
ansond 59:3b99f4901e85 57 }
ansond 59:3b99f4901e85 58
ansond 59:3b99f4901e85 59 // get the longitude
ansond 59:3b99f4901e85 60 char *Location::getLongitude() {
ansond 59:3b99f4901e85 61 return this->m_longitude;
ansond 59:3b99f4901e85 62 }
ansond 59:3b99f4901e85 63
ansond 59:3b99f4901e85 64 // get the MSL Altitude
ansond 59:3b99f4901e85 65 char *Location::getMSLAltitude() {
ansond 59:3b99f4901e85 66 return this->m_msl_altitude_m;
ansond 59:3b99f4901e85 67 }
ansond 59:3b99f4901e85 68
ansond 59:3b99f4901e85 69 // get the Speed
ansond 59:3b99f4901e85 70 char *Location::getSpeed() {
ansond 59:3b99f4901e85 71 return this->m_speed;
ansond 58:5b53d462d311 72 }
ansond 58:5b53d462d311 73
ansond 58:5b53d462d311 74 };