diff --git a/include/interfaces/iGps.hpp b/include/interfaces/iGps.hpp new file mode 100644 index 00000000..d9a34a47 --- /dev/null +++ b/include/interfaces/iGps.hpp @@ -0,0 +1,52 @@ +/* + * Author: Stefan Andritoiu + * Copyright (c) 2018 Intel Corporation. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#pragma once + +namespace upm +{ +/** + * @brief Interface for GPS modules +*/ + class iGps + { + public: + virtual ~iGps() {} + + /** + * Enable or disable the device. + * + * @param enable true to enable the device, false otherwise. + */ + virtual void enable(bool enable) = 0; + + /** + * Set the baudrate of the device. + * + * @param baudrate The baud rate to set for the device. + */ + virtual void setBaudrate(unsigned int baudrate) = 0; + + }; +} diff --git a/src/nmea_gps/nmea_gps.hpp b/src/nmea_gps/nmea_gps.hpp index b16bde8f..0962e60f 100644 --- a/src/nmea_gps/nmea_gps.hpp +++ b/src/nmea_gps/nmea_gps.hpp @@ -37,6 +37,7 @@ #include #include "nmea_gps.h" +#include namespace upm { /** @@ -192,7 +193,7 @@ namespace upm { std::string __str__(); }; - class NMEAGPS { + class NMEAGPS : virtual public iGps { public: /** @@ -254,7 +255,7 @@ namespace upm { * * @param enable true to enable the device, false otherwise. */ - void enable(bool enable); + virtual void enable(bool enable); /** * Set the baudrate of the device. By default, the constructor @@ -263,7 +264,7 @@ namespace upm { * * @param baudrate The baud rate to set for the device. */ - void setBaudrate(unsigned int baudrate); + virtual void setBaudrate(unsigned int baudrate); /** * Determine whether there is data available to be read. In the