Added iOrp 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:25:24 +03:00 committed by Mihai Tudor Panu
parent a589f92cec
commit 2b36d30243
3 changed files with 61 additions and 1 deletions

View File

@ -0,0 +1,45 @@
/*
* Author: Mihai Stefanescu <mihai.stefanescu@rinftech.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 Oxidation/Reduction/Potential (ORP) Sensors
*/
class iOrp
{
public:
virtual ~iOrp() {}
/**
* Get computed ORP (in millivolts) value from the
* sensor.
*
* @return ORP value in millivolts
*/
virtual float getORPValue() = 0;
};
}

View File

@ -75,6 +75,12 @@ float DFRORP::getORP()
return dfrorp_get_orp(m_dfrorp);
}
float DFRORP::getORPValue()
{
DFRORP::update();
return DFRORP::getORP();
}
float DFRORP::getVolts()
{
return dfrorp_get_volts(m_dfrorp);

View File

@ -31,6 +31,7 @@
#include <string.h>
#include "dfrorp.h"
#include <interfaces/iOrp.hpp>
namespace upm {
/**
@ -70,7 +71,7 @@ namespace upm {
* @snippet dfrorp.cxx Interesting
*/
class DFRORP {
class DFRORP : virtual public iOrp {
public:
/**
@ -118,6 +119,14 @@ namespace upm {
*/
float getORP();
/**
* Get computed ORP (in millivolts) value from the
* sensor.
*
* @return ORP value in millivolts
*/
virtual float getORPValue();
/**
* Set the calibration offset for the device. This is
* determined by disconnecting the sensor probe (but leaving the