Doug Anson / mbedConnectorInterfaceV3
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Location.h Source File

Location.h

Go to the documentation of this file.
00001 /**
00002  * @file    Location.h
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 #ifndef __LOCATION_H__
00024 #define __LOCATION_H__
00025 
00026 // mbed API
00027 #include "mbed.h"
00028 
00029 // Max length of a coordinate:  -XXX.YYYYYY
00030 #define LOCATION_COORDINATE_LENGTH 12
00031 
00032 // Max length of the MSL altitude (m): ZZZZZZ.Z
00033 #define LOCATION_MSL_ALT_LENGTH    9
00034 
00035 // Max length of the speed (km/h): ZZZZZZ.Z
00036 #define LOCATION_SPEED_LENGTH      9
00037 
00038 namespace Connector {
00039     
00040 /** Location class
00041  */
00042 class Location
00043 {
00044 protected:
00045     RawSerial *m_pc;
00046     char      m_latitude[LOCATION_COORDINATE_LENGTH+1];
00047     char      m_longitude[LOCATION_COORDINATE_LENGTH+1];
00048     char      m_msl_altitude_m[LOCATION_MSL_ALT_LENGTH+1];
00049     char      m_speed[LOCATION_SPEED_LENGTH+1];
00050     
00051 public:
00052     /**
00053     Default constructor
00054     @param pc input BufferedSerial instance for debugging (if NULL, no debugging output will occur in the library)
00055     */
00056     Location(const RawSerial *pc);
00057 
00058     /**
00059     Copy constructor
00060     @param logger input Location instance to deep copy
00061     */
00062     Location(const Location &location);
00063 
00064     /**
00065     Destructor
00066     */
00067     virtual ~Location();
00068 
00069     /**
00070     Update the current location (pure virtual)
00071     */
00072     virtual void updateLocation() = 0;
00073     
00074     /**
00075     Get latest Latitude
00076     */
00077     virtual char *getLatitude();
00078     
00079     /**
00080     Get latest Longitude
00081     */
00082     virtual char *getLongitude();
00083     
00084     /**
00085     Get latest MSL Altitude (m)
00086     */
00087     char *getMSLAltitude();
00088     
00089     /**
00090     Get latest Speed (km/h) (pure virtual)
00091     */
00092     char *getSpeed();
00093     
00094 protected:
00095     /**
00096     Init buffers
00097     */
00098     void initBuffers();
00099 };
00100 
00101 };
00102 
00103 #endif // __LOCATION_H__
00104