S - Indicates a sensor.D - Indicates sensor data.ICategoryBodyDataCallback, ICategoryEnvironmentDataCallback, ICategoryLightDataCallback, ICategoryMotionDataCallback, ICategoryOrientationDataCallback, ICategoryOtherDataCallbackpublic interface ISensorDataCallback<D extends SensorData<S>,S extends SensorBase>
This interface provides methods for receiving sensor data, including the basic data and accuracy data of sensors.
SystemCapability.Sensors#SENSOR| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
onAccuracyDataModified(S sensor,
int accuracy) |
Called when sensor accuracy data changes.
|
void |
onCommandCompleted(S sensor) |
Called when the sensor completes command execution.
|
void |
onSensorDataModified(D sensorData) |
Called when sensor data changes.
|
void onSensorDataModified(D sensorData)
This method is called by the application layer to process the basic data of sensors.
sensorData - Indicates the data generated by the sensors.void onAccuracyDataModified(S sensor, int accuracy)
This method is called by the application layer to process the accuracy data of the sensors.
sensor - Indicates the sensor whose accuracy data has changed.accuracy - Indicates the sensor accuracy data.void onCommandCompleted(S sensor)
This method is called by the application layer to process the command execution result of the sensor.
sensor - Indicates the sensor that has executed the command.