forked from xuos/xiuos
change SensorQuantityRead with SensorQuantityReadValue for sensor framework
This commit is contained in:
@@ -44,20 +44,29 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/* Sensor ability */
|
||||
#define SENSOR_ABILITY_CO2 ((uint32_t)(1 << SENSOR_QUANTITY_CO2))
|
||||
#define SENSOR_ABILITY_TEMP ((uint32_t)(1 << SENSOR_QUANTITY_TEMP))
|
||||
#define SENSOR_ABILITY_HUMI ((uint32_t)(1 << SENSOR_QUANTITY_HUMI))
|
||||
#define SENSOR_ABILITY_HCHO ((uint32_t)(1 << SENSOR_QUANTITY_HCHO))
|
||||
#define SENSOR_ABILITY_CO ((uint32_t)(1 << SENSOR_QUANTITY_CO))
|
||||
#define SENSOR_ABILITY_PM ((uint32_t)(1 << SENSOR_QUANTITY_PM))
|
||||
#define SENSOR_ABILITY_VOICE ((uint32_t)(1 << SENSOR_QUANTITY_VOICE))
|
||||
#define SENSOR_ABILITY_CH4 ((uint32_t)(1 << SENSOR_QUANTITY_CH4))
|
||||
#define SENSOR_ABILITY_IAQ ((uint32_t)(1 << SENSOR_QUANTITY_IAQ))
|
||||
#define SENSOR_ABILITY_TVOC ((uint32_t)(1 << SENSOR_QUANTITY_TVOC))
|
||||
#define SENSOR_ABILITY_HCHO ((uint32_t)(1 << SENSOR_QUANTITY_HCHO))
|
||||
#define SENSOR_ABILITY_CO2 ((uint32_t)(1 << SENSOR_QUANTITY_CO2))
|
||||
#define SENSOR_ABILITY_TEMP ((uint32_t)(1 << SENSOR_QUANTITY_TEMP))
|
||||
#define SENSOR_ABILITY_HUMI ((uint32_t)(1 << SENSOR_QUANTITY_HUMI))
|
||||
#define SENSOR_ABILITY_HCHO ((uint32_t)(1 << SENSOR_QUANTITY_HCHO))
|
||||
#define SENSOR_ABILITY_CO ((uint32_t)(1 << SENSOR_QUANTITY_CO))
|
||||
#define SENSOR_ABILITY_PM ((uint32_t)(1 << SENSOR_QUANTITY_PM))
|
||||
#define SENSOR_ABILITY_VOICE ((uint32_t)(1 << SENSOR_QUANTITY_VOICE))
|
||||
#define SENSOR_ABILITY_CH4 ((uint32_t)(1 << SENSOR_QUANTITY_CH4))
|
||||
#define SENSOR_ABILITY_IAQ ((uint32_t)(1 << SENSOR_QUANTITY_IAQ))
|
||||
#define SENSOR_ABILITY_TVOC ((uint32_t)(1 << SENSOR_QUANTITY_TVOC))
|
||||
#define SENSOR_ABILITY_HCHO ((uint32_t)(1 << SENSOR_QUANTITY_HCHO))
|
||||
#define SENSOR_ABILITY_WINDSPEED ((uint32_t)(1 << SENSOR_QUANTITY_WINDSPEED))
|
||||
#define SENSOR_ABILITY_WINDDIRECTION ((uint32_t)(1 << SENSOR_QUANTITY_WINDDIRECTION))
|
||||
#define SENSOR_ABILITY_ALTITUDE ((uint32_t)(1 << SENSOR_QUANTITY_ALTITUDE))
|
||||
#define SENSOR_ABILITY_ALTITUDE ((uint32_t)(1 << SENSOR_QUANTITY_ALTITUDE))
|
||||
#define SENSOR_ABILITY_O3 ((uint32_t)(1 << SENSOR_QUANTITY_O3))
|
||||
#define SENSOR_ABILITY_O2 ((uint32_t)(1 << SENSOR_QUANTITY_O2))
|
||||
#define SENSOR_ABILITY_NO2 ((uint32_t)(1 << SENSOR_QUANTITY_NO2))
|
||||
#define SENSOR_ABILITY_SO2 ((uint32_t)(1 << SENSOR_QUANTITY_SO2))
|
||||
#define SENSOR_ABILITY_NH3 ((uint32_t)(1 << SENSOR_QUANTITY_NH3))
|
||||
#define SENSOR_ABILITY_CH20 ((uint32_t)(1 << SENSOR_QUANTITY_CH20))
|
||||
#define SENSOR_ABILITY_C2H5OH ((uint32_t)(1 << SENSOR_QUANTITY_C2H5OH))
|
||||
#define SENSOR_ABILITY_AQS ((uint32_t)(1 << SENSOR_QUANTITY_AQS))
|
||||
#define SENSOR_ABILITY_PM1 ((uint32_t)(1 << SENSOR_QUANTITY_PM1))
|
||||
|
||||
struct SensorProductInfo {
|
||||
uint32_t ability; /* Bitwise OR of sensor ability */
|
||||
@@ -76,16 +85,17 @@ struct SensorDone {
|
||||
};
|
||||
|
||||
struct SensorDevice {
|
||||
char *name; /* Name of sensor */
|
||||
struct SensorProductInfo *info; /* Sensor model info */
|
||||
char *name; /* Name of sensor */
|
||||
struct SensorProductInfo *info; /* Sensor model info */
|
||||
struct SensorDone *done;
|
||||
int fd; /* File descriptor */
|
||||
int status; /* Sensor work mode */
|
||||
int fd; /* File descriptor */
|
||||
int status; /* Sensor work mode */
|
||||
uint8_t buffer[SENSOR_RECEIVE_BUFFSIZE]; /* Buffer for read data */
|
||||
|
||||
int ref_cnt; /* Reference count */
|
||||
DoublelistType quant_list; /* Sensor quantity link */
|
||||
struct DoublelistNode link; /* Sensors link node */
|
||||
int ref_cnt; /* Reference count */
|
||||
DoublelistType quant_list; /* Sensor quantity link */
|
||||
struct DoublelistNode link; /* Sensors link node */
|
||||
void *private_data; /* user define private data */
|
||||
};
|
||||
|
||||
enum SensorQuantityType {
|
||||
@@ -102,7 +112,17 @@ enum SensorQuantityType {
|
||||
SENSOR_QUANTITY_WINDSPEED,
|
||||
SENSOR_QUANTITY_WINDDIRECTION,
|
||||
SENSOR_QUANTITY_ALTITUDE,
|
||||
SENSOR_QUANTITY_O3,
|
||||
SENSOR_QUANTITY_O2,
|
||||
SENSOR_QUANTITY_NO2,
|
||||
SENSOR_QUANTITY_SO2,
|
||||
SENSOR_QUANTITY_NH3,
|
||||
SENSOR_QUANTITY_CH20,
|
||||
SENSOR_QUANTITY_C2H5OH,
|
||||
SENSOR_QUANTITY_AQS,
|
||||
SENSOR_QUANTITY_PM1,
|
||||
/* ...... */
|
||||
SENSIR_QUANTITY_INTEGRATION,
|
||||
SENSOR_QUANTITY_END,
|
||||
};
|
||||
|
||||
@@ -122,6 +142,7 @@ struct SensorQuantity {
|
||||
struct SensorDevice *sdev;
|
||||
|
||||
int32_t (*ReadValue)(struct SensorQuantity *quant);
|
||||
int32_t (*ReadDecimalPoint)(struct SensorQuantity *quant);
|
||||
|
||||
struct DoublelistNode quant_link;
|
||||
struct DoublelistNode link;
|
||||
@@ -135,7 +156,8 @@ int SensorQuantityRegister(struct SensorQuantity *quant);
|
||||
int SensorQuantityUnregister(struct SensorQuantity *quant);
|
||||
int SensorQuantityOpen(struct SensorQuantity *quant);
|
||||
int SensorQuantityClose(struct SensorQuantity *quant);
|
||||
int SensorQuantityRead(struct SensorQuantity *quant);
|
||||
int SensorQuantityReadValue(struct SensorQuantity *quant);
|
||||
int SensorQuantityReadDecimalPoint(struct SensorQuantity *quant);
|
||||
int SensorQuantityControl(struct SensorQuantity *quant, int cmd);
|
||||
|
||||
uint32_t Crc16(uint8_t * data, uint8_t length);
|
||||
|
||||
Reference in New Issue
Block a user