use TCP to connect to mbed connector

Fork of mbedConnectorInterfaceWithDM by Doug Anson

Committer:
Maggie17
Date:
Mon Nov 28 15:52:56 2016 +0000
Revision:
90:b738617379a6
Parent:
51:91fc5f5880fe
first release

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 33:1d0b855df5a5 1 /**
ansond 33:1d0b855df5a5 2 * @file Location.cpp
ansond 33:1d0b855df5a5 3 * @brief mbed CoAP Endpoint Location base class
ansond 33:1d0b855df5a5 4 * @author Doug Anson/Chris Paola
ansond 33:1d0b855df5a5 5 * @version 1.0
ansond 33:1d0b855df5a5 6 * @see
ansond 33:1d0b855df5a5 7 *
ansond 33:1d0b855df5a5 8 * Copyright (c) 2014
ansond 33:1d0b855df5a5 9 *
ansond 33:1d0b855df5a5 10 * Licensed under the Apache License, Version 2.0 (the "License");
ansond 33:1d0b855df5a5 11 * you may not use this file except in compliance with the License.
ansond 33:1d0b855df5a5 12 * You may obtain a copy of the License at
ansond 33:1d0b855df5a5 13 *
ansond 33:1d0b855df5a5 14 * http://www.apache.org/licenses/LICENSE-2.0
ansond 33:1d0b855df5a5 15 *
ansond 33:1d0b855df5a5 16 * Unless required by applicable law or agreed to in writing, software
ansond 33:1d0b855df5a5 17 * distributed under the License is distributed on an "AS IS" BASIS,
ansond 33:1d0b855df5a5 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ansond 33:1d0b855df5a5 19 * See the License for the specific language governing permissions and
ansond 33:1d0b855df5a5 20 * limitations under the License.
ansond 33:1d0b855df5a5 21 */
ansond 33:1d0b855df5a5 22
ansond 33:1d0b855df5a5 23 // Class support
ansond 33:1d0b855df5a5 24 #include "mbed-connector-interface/Location.h"
ansond 33:1d0b855df5a5 25
ansond 33:1d0b855df5a5 26 namespace Connector {
ansond 33:1d0b855df5a5 27
ansond 33:1d0b855df5a5 28 // Constructor
ansond 51:91fc5f5880fe 29 Location::Location() {
ansond 51:91fc5f5880fe 30 memset(this->m_latitude,0,LOCATION_COORDINATE_LENGTH+1);
ansond 51:91fc5f5880fe 31 memset(this->m_longitude,0,LOCATION_COORDINATE_LENGTH+1);
ansond 51:91fc5f5880fe 32 memset(this->m_msl_altitude_m,0,LOCATION_MSL_ALT_LENGTH+1);
ansond 51:91fc5f5880fe 33 memset(this->m_speed,0,LOCATION_SPEED_LENGTH+1);
ansond 33:1d0b855df5a5 34 }
ansond 0:1f1f55e73248 35
ansond 33:1d0b855df5a5 36 // Copy Constructor
ansond 33:1d0b855df5a5 37 Location::Location(const Location &location) {
ansond 33:1d0b855df5a5 38 memcpy(this->m_latitude,location.m_latitude,LOCATION_COORDINATE_LENGTH+1);
ansond 33:1d0b855df5a5 39 memcpy(this->m_longitude,location.m_longitude,LOCATION_COORDINATE_LENGTH+1);
ansond 33:1d0b855df5a5 40 memcpy(this->m_msl_altitude_m,location.m_msl_altitude_m,LOCATION_MSL_ALT_LENGTH+1);
ansond 33:1d0b855df5a5 41 memcpy(this->m_speed,location.m_speed,LOCATION_SPEED_LENGTH+1);
ansond 33:1d0b855df5a5 42 }
ansond 33:1d0b855df5a5 43
ansond 33:1d0b855df5a5 44 // Destructor
ansond 33:1d0b855df5a5 45 Location::~Location() {
ansond 33:1d0b855df5a5 46 }
ansond 33:1d0b855df5a5 47
ansond 33:1d0b855df5a5 48 // get the latitude
ansond 33:1d0b855df5a5 49 char *Location::getLatitude() {
ansond 33:1d0b855df5a5 50 return this->m_latitude;
ansond 33:1d0b855df5a5 51 }
ansond 33:1d0b855df5a5 52
ansond 33:1d0b855df5a5 53 // get the longitude
ansond 33:1d0b855df5a5 54 char *Location::getLongitude() {
ansond 33:1d0b855df5a5 55 return this->m_longitude;
ansond 33:1d0b855df5a5 56 }
ansond 33:1d0b855df5a5 57
ansond 33:1d0b855df5a5 58 // get the MSL Altitude
ansond 33:1d0b855df5a5 59 char *Location::getMSLAltitude() {
ansond 33:1d0b855df5a5 60 return this->m_msl_altitude_m;
ansond 33:1d0b855df5a5 61 }
ansond 33:1d0b855df5a5 62
ansond 33:1d0b855df5a5 63 // get the Speed
ansond 33:1d0b855df5a5 64 char *Location::getSpeed() {
ansond 33:1d0b855df5a5 65 return this->m_speed;
ansond 33:1d0b855df5a5 66 }
ansond 33:1d0b855df5a5 67
ansond 33:1d0b855df5a5 68 };
ansond 33:1d0b855df5a5 69