-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathDev_THSensorInterface.h
64 lines (56 loc) · 1.84 KB
/
Dev_THSensorInterface.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* @file Dev_THSensorInterface.h
*
* The interface needed by THSensor for getting data.
*
* @author Wu Pengfei (email:<[email protected]>)
* @date 2014/11/19
* @copyright
* Copyright (C) 2013-2014 ITEAD Intelligent Systems Co., Ltd. \n
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*/
#ifndef __THSENSORINTERFACE_H__
#define __THSENSORINTERFACE_H__
#include <Arduino.h>
#include "IoTgo_error.h"
/**
* Abstract class, declares the unified interface to
* read temperature and humidity from Temperature & Humidity Sensor.
*
* @ingroup THSensorInterface
*/
class THSensorInterface
{
public: /* public methods */
/**
* Initialize Temperature & Humidity Sensor.
*
* @retval 0 - success.
* @retval ERR_INIT_DEVICE_FAILED - if initialization failed!
*/
virtual int32_t begin(void) = 0;
/**
* Read temperature and humidity from device.
*
* @param temp_c - the pointer storing temperature by Celsius.
* @param temp_f - the pointer storing temperature by Fahrenheit.
* @param hum - the pointer stroing humidigy in percentage.
*
* @retval 0 - success and the data stored in pointers.
* @retval ERR_READ_DEVICE_FAILED - if device cannot be read.
*
* @note temp_c, temp_f and hum can be NULL, if you need no anyone of them.
*/
virtual int32_t getData(float *temp_c, float *temp_f, float *hum) = 0;
/**
* Close Temperature & Humidity Sensor.
*
* @retval 0 - success.
* @retval ERR_CLOSE_DEVICE_FAILED - if device cannot be closed.
*/
virtual int32_t end(void) = 0;
};
#endif /* #ifndef __THSENSORINTERFACE_H__ */