Blynk library for embedded hardware. Works with Arduino, ESP8266, Raspberry Pi, Intel Edison/Galileo, LinkIt ONE, Particle Core/Photon, Energia, ARM mbed, etc. http://www.blynk.cc/

Dependents:   Blynk_RBL_BLE_Nano Blynk_MicroBit Blynk_Serial Blynk_RBL_BLE_Nano

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers WidgetGPS.h Source File

WidgetGPS.h

Go to the documentation of this file.
00001 /**
00002  * @file       WidgetGPS.h
00003  * @author     Volodymyr Shymanskyy
00004  * @license    This project is released under the MIT License (MIT)
00005  * @copyright  Copyright (c) 2015 Volodymyr Shymanskyy
00006  * @date       Oct 2016
00007  * @brief
00008  *
00009  */
00010 
00011 #ifndef WidgetGPS_h
00012 #define WidgetGPS_h
00013 
00014 #ifndef BLYNK_NO_FLOAT
00015 
00016 #include <Blynk/BlynkWidgetBase.h >
00017 
00018 class GpsParam
00019 {
00020 public:
00021 
00022     GpsParam(const BlynkParam& param)
00023         : mLat (0)
00024         , mLon (0)
00025         , mAlt (0)
00026         , mSpeed (0)
00027     {
00028         BlynkParam::iterator it = param.begin();
00029         if (it >= param.end())
00030             return;
00031 
00032         mLat = it.asDouble();
00033 
00034         if (++it >= param.end())
00035             return;
00036 
00037         mLon = it.asDouble();
00038 
00039         if (++it >= param.end())
00040             return;
00041 
00042         mAlt = it.asDouble();
00043 
00044         if (++it >= param.end())
00045             return;
00046 
00047         mSpeed = it.asDouble();
00048     }
00049 
00050 
00051     double getLat() const { return mLat; }
00052     double getLon() const { return mLon; }
00053     double getAltitude() const { return mAlt; }
00054     double getSpeed() const { return mSpeed; }
00055 
00056 private:
00057     double mLat;
00058     double mLon;
00059     double mAlt;
00060     double mSpeed;
00061 };
00062 
00063 #endif
00064 
00065 #endif