Doug Anson / mbedConnectorInterface

Dependents:   IoT_LED_demo ServoTest uWater_Project hackathon ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Location.cpp Source File

Location.cpp

Go to the documentation of this file.
00001 /**
00002  * @file    Location.cpp
00003  * @brief   mbed CoAP Endpoint Location base class
00004  * @author  Doug Anson/Chris Paola
00005  * @version 1.0
00006  * @see
00007  *
00008  * Copyright (c) 2014
00009  *
00010  * Licensed under the Apache License, Version 2.0 (the "License");
00011  * you may not use this file except in compliance with the License.
00012  * You may obtain a copy of the License at
00013  *
00014  *     http://www.apache.org/licenses/LICENSE-2.0
00015  *
00016  * Unless required by applicable law or agreed to in writing, software
00017  * distributed under the License is distributed on an "AS IS" BASIS,
00018  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00019  * See the License for the specific language governing permissions and
00020  * limitations under the License.
00021  */
00022 
00023 #include "Location.h"
00024 
00025 namespace Connector {
00026     
00027 // Constructor
00028 Location::Location(const RawSerial *pc) {
00029     this->m_pc = (RawSerial *)pc;
00030     this->initBuffers();
00031 }
00032 
00033 // Copy Constructor
00034 Location::Location(const Location &location) {
00035     this->m_pc = location.m_pc;
00036     memcpy(this->m_latitude,location.m_latitude,LOCATION_COORDINATE_LENGTH+1);
00037     memcpy(this->m_longitude,location.m_longitude,LOCATION_COORDINATE_LENGTH+1);
00038     memcpy(this->m_msl_altitude_m,location.m_msl_altitude_m,LOCATION_MSL_ALT_LENGTH+1);
00039     memcpy(this->m_speed,location.m_speed,LOCATION_SPEED_LENGTH+1);
00040 }
00041 
00042 // Destructor
00043 Location::~Location() {
00044 }
00045 
00046 // init the buffers
00047 void Location::initBuffers() {
00048     memset(this->m_latitude,0,LOCATION_COORDINATE_LENGTH+1);
00049     memset(this->m_longitude,0,LOCATION_COORDINATE_LENGTH+1);
00050     memset(this->m_msl_altitude_m,0,LOCATION_MSL_ALT_LENGTH+1);
00051     memset(this->m_speed,0,LOCATION_SPEED_LENGTH+1);
00052 }
00053 
00054 // get the latitude
00055 char *Location::getLatitude() {
00056     return this->m_latitude;
00057 } 
00058  
00059 // get the longitude
00060 char *Location::getLongitude() {
00061     return this->m_longitude;
00062 }
00063  
00064 // get the MSL Altitude
00065 char *Location::getMSLAltitude() {
00066     return this->m_msl_altitude_m;
00067 }
00068  
00069 // get the Speed
00070 char *Location::getSpeed() {
00071     return this->m_speed;
00072 }
00073 
00074 };