Added iOrp interface
ADD
include/interfaces/iOrp.hpp
+/*
+ * 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;
+ };
+}

MODIFY
src/dfrorp/dfrorp.cxx
src/dfrorp/dfrorp.cxx
@@ -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);

MODIFY
src/dfrorp/dfrorp.hpp
src/dfrorp/dfrorp.hpp
#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

Added iOrp interface

Signed-off-by: Stefan Andritoiu <stefan.andritoiu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>