Added iGps interface

Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
Stefan Andritoiu 2018-06-20 18:34:33 +03:00 committed by Mihai Tudor Panu
parent 1949916a8e
commit b058d341c0
2 changed files with 56 additions and 3 deletions

View File

@ -0,0 +1,52 @@
/*
* Author: Stefan Andritoiu <stefan.andritoiu@gmail.com>
* 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;
};
}

View File

@ -37,6 +37,7 @@
#include <vector>
#include "nmea_gps.h"
#include <interfaces/iGps.hpp>
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