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:
Serban Waltter
2018-10-08 16:43:42 +03:00
committed by Mihai Tudor Panu
parent f28a6d2561
commit e4f106a0c7
33 changed files with 267 additions and 21 deletions

View File

@ -2,4 +2,5 @@ set (libname "mhz16")
set (libdescription "CO2 Sensor")
set (module_src ${libname}.cxx)
set (module_hpp ${libname}.hpp)
set (module_iface iGas.hpp)
upm_module_init(mraa)

View File

@ -244,8 +244,15 @@ int MHZ16::getGas()
return gas;
}
int MHZ16::getTemperature()
float MHZ16::getConcentration()
{
getData();
return gas;
}
float MHZ16::getTemperature()
{
getData();
return temp;
}

View File

@ -38,6 +38,9 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <interfaces/iTemperature.hpp>
#include <interfaces/iGas.hpp>
#include <mraa/uart.h>
namespace upm {
@ -67,7 +70,7 @@ namespace upm {
* @image html mhz16.jpg
* @snippet mhz16.cxx Interesting
*/
class MHZ16 {
class MHZ16: virtual public iGas, virtual public iTemperature {
public:
@ -151,13 +154,14 @@ namespace upm {
* @return Gas concentration
*/
int getGas();
float getConcentration();
/**
* Returns the temperature data.
*
* @return Temperature in Celsius
*/
int getTemperature();
float getTemperature();
/**
* Sets the zero point of the sensor

View File

@ -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.*;
%}
%include "arrays_java.i";
%include "../java_buffer.i"