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:
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?

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 58:5b53d462d311 28 Location::Location(const RawSerial *pc)
ansond 58:5b53d462d311 29 {
ansond 58:5b53d462d311 30 this->m_pc = (RawSerial *)pc;
ansond 58:5b53d462d311 31 this->initBuffers();
ansond 58:5b53d462d311 32 }
ansond 58:5b53d462d311 33
ansond 58:5b53d462d311 34 // Copy Constructor
ansond 58:5b53d462d311 35 Location::Location(const Location &logger)
ansond 58:5b53d462d311 36 {
ansond 58:5b53d462d311 37 this->m_pc = logger.m_pc;
ansond 58:5b53d462d311 38 memcpy(this->m_latitude,logger.m_latitude,LOCATION_COORDINATE_LENGTH+1);
ansond 58:5b53d462d311 39 memcpy(this->m_longitude,logger.m_longitude,LOCATION_COORDINATE_LENGTH+1);
ansond 58:5b53d462d311 40 memcpy(this->m_msl_altitude_m,logger.m_msl_altitude_m,LOCATION_MSL_ALT_LENGTH+1);
ansond 58:5b53d462d311 41 }
ansond 58:5b53d462d311 42
ansond 58:5b53d462d311 43 // Destructor
ansond 58:5b53d462d311 44 Location::~Location()
ansond 58:5b53d462d311 45 {
ansond 58:5b53d462d311 46 }
ansond 58:5b53d462d311 47
ansond 58:5b53d462d311 48 // init the buffers
ansond 58:5b53d462d311 49 void Location::initBuffers() {
ansond 58:5b53d462d311 50 memset(this->m_latitude,0,LOCATION_COORDINATE_LENGTH+1);
ansond 58:5b53d462d311 51 memset(this->m_longitude,0,LOCATION_COORDINATE_LENGTH+1);
ansond 58:5b53d462d311 52 memset(this->m_msl_altitude_m,0,LOCATION_MSL_ALT_LENGTH+1);
ansond 58:5b53d462d311 53 }
ansond 58:5b53d462d311 54
ansond 58:5b53d462d311 55 };