mirror of
https://github.com/eclipse/upm.git
synced 2025-07-26 21:51:16 +03:00
Added iGas interface
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:

committed by
Mihai Tudor Panu

parent
f28a6d2561
commit
e4f106a0c7
@ -2,4 +2,5 @@ set (libname "cwlsxxa")
|
||||
set (libdescription "Veris CWLSXXA CO2/Temperature/Humidity Transmitter")
|
||||
set (module_src ${libname}.cxx)
|
||||
set (module_hpp ${libname}.hpp)
|
||||
set (module_iface iGas.hpp iHumidity.hpp iTemperature.hpp)
|
||||
upm_module_init(mraa)
|
||||
|
@ -160,8 +160,15 @@ float CWLSXXA::getTemperature(bool fahrenheit)
|
||||
return m_temperature;
|
||||
}
|
||||
|
||||
float CWLSXXA::getTemperature()
|
||||
{
|
||||
update();
|
||||
return m_temperature;
|
||||
}
|
||||
|
||||
float CWLSXXA::getHumidity()
|
||||
{
|
||||
update();
|
||||
return m_humidity;
|
||||
}
|
||||
|
||||
@ -170,6 +177,12 @@ float CWLSXXA::getCO2()
|
||||
return m_co2;
|
||||
}
|
||||
|
||||
float CWLSXXA::getConcentration()
|
||||
{
|
||||
update();
|
||||
return m_co2;
|
||||
}
|
||||
|
||||
int CWLSXXA::average(mraa::Aio *aio, int samples)
|
||||
{
|
||||
if (samples <= 0)
|
||||
|
@ -26,6 +26,10 @@
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include <interfaces/iGas.hpp>
|
||||
#include <interfaces/iHumidity.hpp>
|
||||
#include <interfaces/iTemperature.hpp>
|
||||
|
||||
#include <mraa/aio.hpp>
|
||||
|
||||
// Unlikey to be changable without external circuitry (voltage divider)
|
||||
@ -85,7 +89,7 @@ namespace upm {
|
||||
* @snippet cwlsxxa.cxx Interesting
|
||||
*/
|
||||
|
||||
class CWLSXXA {
|
||||
class CWLSXXA: virtual public iGas, virtual public iHumidity, virtual public iTemperature {
|
||||
public:
|
||||
|
||||
/**
|
||||
@ -134,7 +138,8 @@ namespace upm {
|
||||
* The default is false (degrees Celsius).
|
||||
* @return The last temperature reading in Celsius or Fahrenheit
|
||||
*/
|
||||
float getTemperature(bool fahrenheit=false);
|
||||
float getTemperature(bool fahrenheit);
|
||||
float getTemperature();
|
||||
|
||||
/**
|
||||
* Get the current relative humidity. update() must have been called
|
||||
@ -154,6 +159,14 @@ namespace upm {
|
||||
*/
|
||||
float getCO2();
|
||||
|
||||
/**
|
||||
* Get the current CO2 concentration in Parts Per Million (PPM).
|
||||
* update() must have been called prior to calling this method.
|
||||
*
|
||||
* @return The last CO2 reading
|
||||
*/
|
||||
float getConcentration();
|
||||
|
||||
|
||||
protected:
|
||||
// CO2 reporting is always supported
|
||||
|
@ -1,7 +1,17 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="upm") cwlsxxa
|
||||
#endif
|
||||
|
||||
%import "interfaces/interfaces.i"
|
||||
|
||||
%include "../common_top.i"
|
||||
|
||||
/* BEGIN Java syntax ------------------------------------------------------- */
|
||||
#ifdef SWIGJAVA
|
||||
%typemap(javaimports) SWIGTYPE %{
|
||||
import upm_interfaces.*;
|
||||
%}
|
||||
|
||||
JAVA_JNI_LOADLIBRARY(javaupm_cwlsxxa)
|
||||
#endif
|
||||
/* END Java syntax */
|
||||
|
Reference in New Issue
Block a user