change SensorQuantityRead with SensorQuantityReadValue for sensor framework

This commit is contained in:
Liu_Weichao
2022-08-31 10:54:54 +08:00
parent f55022fc46
commit b5b3cb9ca7
17 changed files with 81 additions and 36 deletions

View File

@@ -314,7 +314,7 @@ int SensorQuantityClose(struct SensorQuantity *quant)
* @param quant - sensor quantity pointer
* @return quantity value
*/
int SensorQuantityRead(struct SensorQuantity *quant)
int SensorQuantityReadValue(struct SensorQuantity *quant)
{
if (!quant)
return -1;
@@ -332,6 +332,29 @@ int SensorQuantityRead(struct SensorQuantity *quant)
return result;
}
/**
* @description: Read quantity decimal point
* @param quant - sensor quantity pointer
* @return decimal point num, 0: 0 1: 0.1 2: 0.01 3: 0.001
*/
int SensorQuantityReadDecimalPoint(struct SensorQuantity *quant)
{
if (!quant)
return -1;
int decimal_point = 0;
struct SensorDevice *sdev = quant->sdev;
if (!sdev)
return -1;
if (quant->ReadValue != NULL) {
decimal_point = quant->ReadDecimalPoint(quant);
}
return decimal_point;
}
/**
* @description: Configure quantity mode
* @param quant - sensor quantity pointer