1# oh_sensor.h 2 3 4## Overview 5 6The **oh_sensor.h** file declares the APIs for operating sensors, including obtaining sensor information and subscribing to and unsubscribing from sensor data. 7 8**Library**: libohsensor.so 9 10**System capability**: SystemCapability.Sensors.Sensor 11 12**Since**: 11 13 14**Related module**: [Sensor](_sensor.md) 15 16 17## Summary 18 19 20### Functions 21 22| Name| Description| 23| -------- | -------- | 24| [OH_Sensor_GetInfos](_sensor.md#oh_sensor_getinfos)([Sensor_Info](_sensor.md#sensor_info) \*\*infos, uint32_t \*count) | Obtains information about all sensors on the device. | 25| [OH_Sensor_Subscribe](_sensor.md#oh_sensor_subscribe)(const [Sensor_SubscriptionId](_sensor.md#sensor_subscriptionid) \*id, const [Sensor_SubscriptionAttribute](_sensor.md#sensor_subscriptionattribute) \*attribute, const [Sensor_Subscriber](_sensor.md#sensor_subscriber) \*subscriber) | Subscribe to sensor data. The system will report sensor data to the subscriber at the specified frequency.<br>To subscribe to data of acceleration sensors, request the **ohos.permission.ACCELEROMETER** permission.<br>To subscribe to data of gyroscope sensors, request the **ohos.permission.GYROSCOPE** permission.<br>To subscribe to data of pedometer-related sensors, request the **ohos.permission.ACTIVITY_MOTION** permission.<br>To subscribe to data of health-related sensors, such as heart rate sensors, request the **ohos.permission.READ_HEALTH_DATA** permission. Otherwise, the subscription fails. You do not need to request any permission to subscribe to data of other types of sensors.| 26| [OH_Sensor_Unsubscribe](_sensor.md#oh_sensor_unsubscribe)(const [Sensor_SubscriptionId](_sensor.md#sensor_subscriptionid) \*id, const [Sensor_Subscriber](_sensor.md#sensor_subscriber) \*subscriber) | Unsubscribes from sensor data.<br>To unsubscribe from data of acceleration sensors, request the **ohos.permission.ACCELEROMETER** permission.<br>To unsubscribe from data of gyroscope sensors, request the **ohos.permission.GYROSCOPE** permission.<br>To unsubscribe from data of pedometer-related sensors, request the **ohos.permission.ACTIVITY_MOTION** permission.<br>To unsubscribe from data of health-related sensors, request the **ohos.permission.READ_HEALTH_DATA** permission. Otherwise, the unsubscription fails. You do not need to request any permission to unsubscribe from data of other types of sensors.| 27