openharmony 鸿蒙 capi-oh-sensor-type-h

2026-08-25 浏览 (1)

oh_sensor_type.h

Overview

Declares the common sensor attributes.

Reference file: <sensors/oh_sensor_type.h>

Library: libohsensor.so

System capability: SystemCapability.Sensors.Sensor

Since: 11

Related module: Sensor

Summary

Structs

Nametypedef KeywordDescription
Sensor_InfoSensor_InfoDefines a struct for the sensor information.
Sensor_EventSensor_EventDefines a struct for the sensor data information.
Sensor_SubscriptionIdSensor_SubscriptionIdDefines a struct for the sensor subscription ID, which uniquely identifies a sensor.
Sensor_SubscriptionAttributeSensor_SubscriptionAttributeDefines a struct for the sensor subscription attribute.
Sensor_SubscriberSensor_SubscriberDefines a struct for the sensor subscriber information.

Enumeration

Nametypedef KeywordDescription
Sensor_TypeSensor_TypeEnumerates the sensor types.
Sensor_ResultSensor_ResultEnumerates the sensor result codes.
Sensor_AccuracySensor_AccuracyEnumerates the accuracy levels of data reported by a sensor.

Functions

Nametypedef KeywordDescription
Sensor_Info **OH_Sensor_CreateInfos(uint32_t count)-Creates an instance array using a given number. For details, see Sensor_Info.
int32_t OH_Sensor_DestroyInfos(Sensor_Info **sensors, uint32_t count)-Destroys the instance array and reclaims the memory. For details, see Sensor_Info.
int32_t OH_SensorInfo_GetName(Sensor_Info* sensor, char *sensorName, uint32_t *length)-Obtains the sensor name.
int32_t OH_SensorInfo_GetVendorName(Sensor_Info* sensor, char *vendorName, uint32_t *length)-Obtains the sensor's vendor name.
int32_t OH_SensorInfo_GetType(Sensor_Info* sensor, Sensor_Type *sensorType)-Obtains the sensor type.
int32_t OH_SensorInfo_GetResolution(Sensor_Info* sensor, float *resolution)-Obtains the sensor resolution.
int32_t OH_SensorInfo_GetMinSamplingInterval(Sensor_Info* sensor, int64_t *minSamplingInterval)-Obtains the minimum data reporting interval of a sensor.
int32_t OH_SensorInfo_GetMaxSamplingInterval(Sensor_Info* sensor, int64_t *maxSamplingInterval)-Obtains the maximum data reporting interval of a sensor.
int32_t OH_SensorEvent_GetType(Sensor_Event* sensorEvent, Sensor_Type *sensorType)-Obtains the sensor type.
int32_t OH_SensorEvent_GetTimestamp(Sensor_Event* sensorEvent, int64_t *timestamp)-Obtains the timestamp of sensor data.
int32_t OH_SensorEvent_GetAccuracy(Sensor_Event* sensorEvent, Sensor_Accuracy *accuracy)-Obtains the accuracy of sensor data.
int32_t OH_SensorEvent_GetData(Sensor_Event* sensorEvent, float **data, uint32_t *length)-Obtains sensor data. The data length and content depend on the sensor type. The format of the sensor data reported is as follows:
- SENSOR_TYPE_ACCELEROMETER: data[0], data[1], and data[2], indicating the acceleration around the x, y, and z axes of a device, respectively, in m/s². - SENSOR_TYPE_GYROSCOPE: data[0], data[1], and data[2], indicating the angular velocity of rotation around the x, y, and z axes of a device, respectively, in rad/s.
- SENSOR_TYPE_AMBIENT_LIGHT: data[0], indicating the ambient light intensity, in lux. Two additional data values are returned since API version 12. data[1] indicates the color temperature, in kelvin, and data[2] indicates the infrared luminance, in cd/m².
- SENSOR_TYPE_MAGNETIC_FIELD: data[0], data[1], and data[2], indicating the magnetic field strength around the x, y, and z axes of a device, respectively, in μT.
- SENSOR_TYPE_BAROMETER: data[0], indicating the atmospheric pressure, in hPa.
- SENSOR_TYPE_HALL: data[0], indicating the opening/closing state of the flip cover. The value 0 means that the flip cover is opened, and a value greater than 0 means that the flip cover is closed.
- SENSOR_TYPE_PROXIMITY: data[0], indicates the approaching state. The value 0 means the two objects are close to each other, and a value greater than 0 means that they are far away from each other.
- SENSOR_TYPE_ORIENTATION: data[0], data[1], and data[2], indicating the rotation angles of a device around the z, x, and y axes, respectively, in degree.
- SENSOR_TYPE_GRAVITY: data[0], data[1], and data[2], indicating the gravitational acceleration around the x, y, and z axes of a device, respectively, in m/s2.
- SENSOR_TYPE_ROTATION_VECTOR: data[0], data[1] and data[2], indicating the rotation angles of a device around the x, y, and z axes, respectively, in degree. data[3] indicates the rotation vector.
- SENSOR_TYPE_PEDOMETER_DETECTION: data[0], indicating the pedometer detection status. The value 1 means that the number of detected steps changes.
- SENSOR_TYPE_PEDOMETER: data[0], indicating the number of steps a user has walked.
- SENSOR_TYPE_HEART_RATE: data[0], indicating the heart rate value.
- SENSOR_TYPE_LINEAR_ACCELERATION: data[0], data[1], and data[2], indicating the linear acceleration of the device on the x, y, and z axes, respectively, in m/s2. This field is supported since API version 13.
- SENSOR_TYPE_GAME_ROTATION_VECTOR: data[0], data[1], and data[2], indicating the rotation angles of the device around the x, y, and z axes, respectively, in degree; data[3], indicating the rotation vector. This field is supported since API version 13.
Sensor_SubscriptionId *OH_Sensor_CreateSubscriptionId(void)-Creates a Sensor_SubscriptionId instance.
int32_t OH_Sensor_DestroySubscriptionId(Sensor_SubscriptionId *id)-Destroys a Sensor_SubscriptionId instance and reclaims the memory.
int32_t OH_SensorSubscriptionId_GetType(Sensor_SubscriptionId* id, Sensor_Type *sensorType)-Obtains the sensor type.
int32_t OH_SensorSubscriptionId_SetType(Sensor_SubscriptionId* id, const Sensor_Type sensorType)-Sets the sensor type.
Sensor_SubscriptionAttribute *OH_Sensor_CreateSubscriptionAttribute(void)-Creates a Sensor_SubscriptionAttribute instance.
int32_t OH_Sensor_DestroySubscriptionAttribute(Sensor_SubscriptionAttribute *attribute)-Destroys a Sensor_SubscriptionAttribute instance and reclaims the memory.
int32_t OH_SensorSubscriptionAttribute_SetSamplingInterval(Sensor_SubscriptionAttribute* attribute, const int64_t samplingInterval)-Sets the sensor data reporting interval.
int32_t OH_SensorSubscriptionAttribute_GetSamplingInterval(Sensor_SubscriptionAttribute* attribute, int64_t *samplingInterval)-Obtains the sensor data reporting interval.
typedef void (*Sensor_EventCallback)(Sensor_Event *event)Sensor_EventCallbackDefines the callback function used to report sensor data.
Sensor_Subscriber *OH_Sensor_CreateSubscriber(void)-Creates a Sensor_Subscriber instance.
int32_t OH_Sensor_DestroySubscriber(Sensor_Subscriber *subscriber)-Destroys a Sensor_Subscriber instance and reclaims the memory.
int32_t OH_SensorSubscriber_SetCallback(Sensor_Subscriber* subscriber, const Sensor_EventCallback callback)-Sets a callback function to report sensor data.
int32_t OH_SensorSubscriber_GetCallback(Sensor_Subscriber* subscriber, Sensor_EventCallback *callback)-Obtains the callback function used to report sensor data.

Enum Description

Sensor_Type

enum Sensor_Type

Description

Enumerates the sensor types.

Since: 11

Enum ItemDescription
SENSOR_TYPE_ACCELEROMETER = 1Acceleration sensor.
Since: 11
SENSOR_TYPE_GYROSCOPE = 2Gyroscope sensor.
Since: 11
SENSOR_TYPE_AMBIENT_LIGHT = 5Ambient light sensor.
Since: 11
SENSOR_TYPE_MAGNETIC_FIELD = 6Magnetic field sensor.
Since: 11
SENSOR_TYPE_BAROMETER = 8Barometer sensor
Since: 11
SENSOR_TYPE_HALL = 10Hall effect sensor.
Since: 11
SENSOR_TYPE_PROXIMITY = 12Proximity sensor.
Since: 11
SENSOR_TYPE_ORIENTATION = 256Orientation sensor.
Since: 11
SENSOR_TYPE_GRAVITY = 257Gravity sensor.
Since: 11
SENSOR_TYPE_LINEAR_ACCELERATION = 258Linear acceleration sensor.
Since: 13
SENSOR_TYPE_ROTATION_VECTOR = 259Rotation vector sensor.
Since: 11
SENSOR_TYPE_GAME_ROTATION_VECTOR = 262Game rotation vector sensor
Since: 13
SENSOR_TYPE_PEDOMETER_DETECTION = 265Pedometer detection sensor.
Since: 11
SENSOR_TYPE_PEDOMETER = 266Pedometer sensor.
Since: 11
SENSOR_TYPE_HEART_RATE = 278Heart rate sensor.
Since: 11

Sensor_Result

enum Sensor_Result

Description

Enumerates the sensor result codes.

Since: 11

Enum ItemDescription
SENSOR_SUCCESS = 0Operation success.
Since: 11
SENSOR_PERMISSION_DENIED = 201Permission verification failed.
Since: 11
SENSOR_PARAMETER_ERROR = 401An error occurs during parameter verification. For example, a mandatory parameter is not passed in, or the parameter type passed in is incorrect.
Since: 11
SENSOR_SERVICE_EXCEPTION = 14500101The sensor service is abnormal.
Since: 11

Sensor_Accuracy

enum Sensor_Accuracy

Description

Enumerates the accuracy levels of data reported by a sensor.

Since: 11

Enum ItemDescription
SENSOR_ACCURACY_UNRELIABLE = 0The sensor data is unreliable. It is possible that the sensor does not contact with the device to measure.
Since: 11
SENSOR_ACCURACY_LOW = 1The sensor data is at a low accuracy level. The data must be calibrated based on the environment before being used.
Since: 11
SENSOR_ACCURACY_MEDIUM = 2The sensor data is at a medium accuracy level. You are advised to calibrate the data based on the environment before using it.
Since: 11
SENSOR_ACCURACY_HIGH = 3The sensor data is at a high accuracy level. The data can be used directly.
Since: 11

Function Description

OH_Sensor_CreateInfos()

Sensor_Info **OH_Sensor_CreateInfos(uint32_t count)

Description

Creates an instance array using a given number. For details, see Sensor_Info.

Since: 11

Parameters

NameDescription
uint32_t countNumber of instances to be created. For details, see Sensor_Info.

Returns

TypeDescription
Sensor_Info **Double pointer to the Sensor_Info instance array if the operation is successful; NULL otherwise.

OH_Sensor_DestroyInfos()

int32_t OH_Sensor_DestroyInfos(Sensor_Info **sensors, uint32_t count)

Description

Destroys the sensor instance array and reclaims the memory. For details, see Sensor_Info.

Since: 11

Parameters

NameDescription
Sensor_Info **sensorsDouble pointer to the Sensor_Info instance array.
uint32_t countNumber of Sensor_Info instances to be destroyed.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

OH_SensorInfo_GetName()

int32_t OH_SensorInfo_GetName(Sensor_Info* sensor, char *sensorName, uint32_t *length)

Description

Obtains the sensor name.

Since: 11

Parameters

NameDescription
Sensor_Info* sensorPointer to the sensor information.
char *sensorNamePointer to the sensor data.
uint32_t *lengthPointer to the length, in bytes.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

OH_SensorInfo_GetVendorName()

int32_t OH_SensorInfo_GetVendorName(Sensor_Info* sensor, char *vendorName, uint32_t *length)

Description

Obtains the sensor's vendor name.

Since: 11

Parameters

NameDescription
Sensor_Info* sensorPointer to the sensor information.
char *vendorNamePointer to the vendor name.
uint32_t *lengthPointer to the length, in bytes.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

OH_SensorInfo_GetType()

int32_t OH_SensorInfo_GetType(Sensor_Info* sensor, Sensor_Type *sensorType)

Description

Obtains the sensor type.

Since: 11

Parameters

NameDescription
Sensor_Info* sensorPointer to the sensor information.
Sensor_Type *sensorTypePointer to the sensor type.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

OH_SensorInfo_GetResolution()

int32_t OH_SensorInfo_GetResolution(Sensor_Info* sensor, float *resolution)

Description

Obtains the sensor resolution.

Since: 11

Parameters

NameDescription
Sensor_Info* sensorPointer to the sensor information.
float *resolutionPointer to the sensor resolution Sensor_Accuracy.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

OH_SensorInfo_GetMinSamplingInterval()

int32_t OH_SensorInfo_GetMinSamplingInterval(Sensor_Info* sensor, int64_t *minSamplingInterval)

Description

Obtains the minimum data reporting interval of a sensor.

Since: 11

Parameters

NameDescription
Sensor_Info* sensorPointer to the sensor information.
int64_t *minSamplingIntervalPointer to the minimum data reporting interval, in nanoseconds.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

OH_SensorInfo_GetMaxSamplingInterval()

int32_t OH_SensorInfo_GetMaxSamplingInterval(Sensor_Info* sensor, int64_t *maxSamplingInterval)

Description

Obtains the maximum data reporting interval of a sensor.

Since: 11

Parameters

NameDescription
Sensor_Info* sensorPointer to the sensor information.
int64_t *maxSamplingIntervalPointer to the maximum data reporting interval, in nanoseconds.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

OH_SensorEvent_GetType()

int32_t OH_SensorEvent_GetType(Sensor_Event* sensorEvent, Sensor_Type *sensorType)

Description

Obtains the sensor type.

Since: 11

Parameters

NameDescription
Sensor_Event* sensorEventPointer to the sensor data information.
Sensor_Type *sensorTypePointer to the sensor type.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

OH_SensorEvent_GetTimestamp()

int32_t OH_SensorEvent_GetTimestamp(Sensor_Event* sensorEvent, int64_t *timestamp)

Description

Obtains the timestamp of sensor data.

Since: 11

Parameters

NameDescription
Sensor_Event* sensorEventPointer to the sensor data information.
int64_t *timestampPointer to the timestamp.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

OH_SensorEvent_GetAccuracy()

int32_t OH_SensorEvent_GetAccuracy(Sensor_Event* sensorEvent, Sensor_Accuracy *accuracy)

Description

Obtains the accuracy of sensor data.

Since: 11

Parameters

NameDescription
Sensor_Event* sensorEventPointer to the sensor data information.
Sensor_Accuracy *accuracyPointer to the accuracy.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

OH_SensorEvent_GetData()

int32_t OH_SensorEvent_GetData(Sensor_Event* sensorEvent, float **data, uint32_t *length)

Description

Obtains sensor data. The data length and content depend on the sensor type. The format of the sensor data reported is as follows:
- SENSOR_TYPE_ACCELEROMETER: data[0], data[1], and data[2], indicating the acceleration around the x, y, and z axes of a device, respectively, in m/s². - SENSOR_TYPE_GYROSCOPE: data[0], data[1], and data[2], indicating the angular velocity of rotation around the x, y, and z axes of a device, respectively, in rad/s.
- SENSOR_TYPE_AMBIENT_LIGHT: data[0], indicating the ambient light intensity, in lux. Two additional data values are returned since API version 12. data[1] indicates the color temperature, in kelvin, and data[2] indicates the infrared luminance, in cd/m².
- SENSOR_TYPE_MAGNETIC_FIELD: data[0], data[1], and data[2], indicating the magnetic field strength around the x, y, and z axes of a device, respectively, in μT.
- SENSOR_TYPE_BAROMETER: data[0], indicating the atmospheric pressure, in hPa.
- SENSOR_TYPE_HALL: data[0], indicating the opening/closing state of the flip cover. The value 0 means that the flip cover is opened, and a value greater than 0 means that the flip cover is closed.
- SENSOR_TYPE_PROXIMITY: data[0], indicates the approaching state. The value 0 means the two objects are close to each other, and a value greater than 0 means that they are far away from each other.
- SENSOR_TYPE_ORIENTATION: data[0], data[1], and data[2], indicating the rotation angles of a device around the z, x, and y axes, respectively, in degree.
- SENSOR_TYPE_GRAVITY: data[0], data[1], and data[2], indicating the gravitational acceleration around the x, y, and z axes of a device, respectively, in m/s2.
- SENSOR_TYPE_ROTATION_VECTOR: data[0], data[1] and data[2], indicating the rotation angles of a device around the x, y, and z axes, respectively, in degree. data[3] indicates the rotation vector.
- SENSOR_TYPE_PEDOMETER_DETECTION: data[0], indicating the pedometer detection status. The value 1 means that the number of detected steps changes.
- SENSOR_TYPE_PEDOMETER: data[0], indicating the number of steps a user has walked.
- SENSOR_TYPE_HEART_RATE: data[0], indicating the heart rate value.
- SENSOR_TYPE_LINEAR_ACCELERATION: data[0], data[1], and data[2], indicating the linear acceleration of the device on the x, y, and z axes, respectively, in m/s2. This field is supported since API version 13.
- SENSOR_TYPE_GAME_ROTATION_VECTOR: data[0], data[1], and data[2], indicating the rotation angles of the device around the x, y, and z axes, respectively, in degree; data[3], indicating the rotation vector. This field is supported since API version 13.

Since: 11

Parameters

NameDescription
Sensor_Event* sensorEventPointer to the sensor data information.
float **dataDouble pointer to the sensor data.
uint32_t *lengthPointer to the array length.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

OH_Sensor_CreateSubscriptionId()

Sensor_SubscriptionId *OH_Sensor_CreateSubscriptionId(void)

Description

Creates a Sensor_SubscriptionId instance.

Since: 11

Returns

TypeDescription
Sensor_SubscriptionId *Pointer to the Sensor_SubscriptionId instance if the operation is successful; NULL otherwise.

OH_Sensor_DestroySubscriptionId()

int32_t OH_Sensor_DestroySubscriptionId(Sensor_SubscriptionId *id)

Description

Destroys a Sensor_SubscriptionId instance and reclaims the memory.

Since: 11

Parameters

NameDescription
Sensor_SubscriptionId *idPointer to the Sensor_SubscriptionId instance.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

OH_SensorSubscriptionId_GetType()

int32_t OH_SensorSubscriptionId_GetType(Sensor_SubscriptionId* id, Sensor_Type *sensorType)

Description

Obtains the sensor type.

Since: 11

Parameters

NameDescription
Sensor_SubscriptionId* idPointer to the sensor subscription ID.
Sensor_Type *sensorTypePointer to the sensor type.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

OH_SensorSubscriptionId_SetType()

int32_t OH_SensorSubscriptionId_SetType(Sensor_SubscriptionId* id, const Sensor_Type sensorType)

Description

Sets the sensor type.

Since: 11

Parameters

NameDescription
Sensor_SubscriptionId* idPointer to the sensor subscription ID.
const Sensor_Type sensorTypeSensor type to set.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

OH_Sensor_CreateSubscriptionAttribute()

Sensor_SubscriptionAttribute *OH_Sensor_CreateSubscriptionAttribute(void)

Description

Creates a Sensor_SubscriptionAttribute instance.

Since: 11

Returns

TypeDescription
Sensor_SubscriptionAttribute *Pointer to the Sensor_SubscriptionAttribute instance if the operation is successful; NULL otherwise.

OH_Sensor_DestroySubscriptionAttribute()

int32_t OH_Sensor_DestroySubscriptionAttribute(Sensor_SubscriptionAttribute *attribute)

Description

Destroys a Sensor_SubscriptionAttribute instance and reclaims the memory.

Since: 11

Parameters

NameDescription
Sensor_SubscriptionAttribute *attributePointer to the Sensor_SubscriptionAttribute instance.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

OH_SensorSubscriptionAttribute_SetSamplingInterval()

int32_t OH_SensorSubscriptionAttribute_SetSamplingInterval(Sensor_SubscriptionAttribute* attribute, const int64_t samplingInterval)

Description

Sets the sensor data reporting interval.

Since: 11

Parameters

NameDescription
Sensor_SubscriptionAttribute* attributePointer to the sensor subscription attribute.
const int64_t samplingIntervalData reporting interval to set, in nanoseconds.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

OH_SensorSubscriptionAttribute_GetSamplingInterval()

int32_t OH_SensorSubscriptionAttribute_GetSamplingInterval(Sensor_SubscriptionAttribute* attribute, int64_t *samplingInterval)

Description

Obtains the sensor data reporting interval.

Since: 11

Parameters

NameDescription
Sensor_SubscriptionAttribute* attributePointer to the sensor subscription attribute.
int64_t *samplingIntervalPointer to the data reporting interval, in nanoseconds.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

Sensor_EventCallback()

typedef void (*Sensor_EventCallback)(Sensor_Event *event)

Description

Defines the callback function used to report sensor data.

Since: 11

Parameters

NameDescription
Sensor_Event* eventPointer to the sensor data information.

OH_Sensor_CreateSubscriber()

Sensor_Subscriber *OH_Sensor_CreateSubscriber(void)

Description

Creates a Sensor_Subscriber instance.

Since: 11

Returns

TypeDescription
Sensor_Subscriber *Pointer to the Sensor_Subscriber instance if the operation is successful; NULL otherwise.

OH_Sensor_DestroySubscriber()

int32_t OH_Sensor_DestroySubscriber(Sensor_Subscriber *subscriber)

Description

Destroys a Sensor_Subscriber instance and reclaims the memory.

Since: 11

Parameters

NameDescription
Sensor_Subscriber *subscriberPointer to the Sensor_Subscriber instance.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

OH_SensorSubscriber_SetCallback()

int32_t OH_SensorSubscriber_SetCallback(Sensor_Subscriber* subscriber, const Sensor_EventCallback callback)

Description

Sets a callback function to report sensor data.

Since: 11

Parameters

NameDescription
Sensor_Subscriber* subscriberPointer to the sensor subscriber information.
const Sensor_EventCallback callbackSets the callback function.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

OH_SensorSubscriber_GetCallback()

int32_t OH_SensorSubscriber_GetCallback(Sensor_Subscriber* subscriber, Sensor_EventCallback *callback)

Description

Obtains the callback function used to report sensor data.

Since: 11

Parameters

NameDescription
Sensor_Subscriber* subscriberPointer to the sensor subscriber information.
Sensor_EventCallback *callbackPointer to the callback function.

Returns

TypeDescription
int32_tSENSOR_SUCCESS if the operation is successful; an error code defined in Sensor_Result otherwise.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 js-apis-vibrator

openharmony 鸿蒙 capi-sensor-sensor-subscriptionid

openharmony 鸿蒙 capi-sensor-sensor-subscriptionattribute

openharmony 鸿蒙 capi-vibrator-h

openharmony 鸿蒙 Readme-EN

openharmony 鸿蒙 capi-vibrator-vibrator-filedescription

openharmony 鸿蒙 js-apis-sensor-sys

openharmony 鸿蒙 capi-oh-sensor-h

openharmony 鸿蒙 errorcode-sensor

openharmony 鸿蒙 js-apis-system-sensor

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/J0tPOyj2