diff --git a/sensors/sensor/BUILD.gn b/sensors/sensor/BUILD.gn index 547484116..1eba42e25 100644 --- a/sensors/sensor/BUILD.gn +++ b/sensors/sensor/BUILD.gn @@ -14,7 +14,7 @@ import("//build/ohos.gni") import("//build/ohos/ndk/ndk.gni") -ohos_ndk_headers("sensor_native") { +ohos_ndk_headers("sensor_ndk_header") { dest_dir = "$ndk_headers_out_dir/sensors/sensor" sources = [ "./native_sensor.h", @@ -22,7 +22,7 @@ ohos_ndk_headers("sensor_native") { ] } -ohos_ndk_library("libsensor_native") { +ohos_ndk_library("libsensor_ndk") { ndk_description_file = "./libsensor.ndk.json" output_name = "libsensor_native" output_extension = "z.so" diff --git a/sensors/sensor/native_sensor_type.h b/sensors/sensor/native_sensor_type.h index b96256a98..9a131f7df 100644 --- a/sensors/sensor/native_sensor_type.h +++ b/sensors/sensor/native_sensor_type.h @@ -327,7 +327,6 @@ int32_t OH_Sensor_GetEventAccuracy(Sensor_SensorEvent* sensorEvent, Sensor_Senso */ int32_t OH_Sensor_GetSensorData(Sensor_SensorEvent* sensorEvent, float **data, size_t *length); -struct Sensor_SensorSubscribeId; /** * @brief 传感器订阅Id,唯一标识传感器。 * @syscap SystemCapability.Sensors.Sensor @@ -335,6 +334,14 @@ struct Sensor_SensorSubscribeId; */ typedef struct Sensor_SensorSubscribeId Sensor_SensorSubscribeId; +/** + * @brief 创建传感器订阅Id实例。 + * + * @return 如果创建成功,则返回指向{@link Sensor_SensorSubscribeId} 结构实例的指针,否则返回NULL. + * @since 11 + */ +Sensor_SensorSubscribeId *OH_Sensor_CreateSubscribeId(); + /** * @brief 获取传感器类型。 * @@ -355,7 +362,6 @@ int32_t OH_Sensor_GetSubscribeSensorType(Sensor_SensorSubscribeId* subscribeId, */ int32_t OH_Sensor_SetSubscribeSensorType(Sensor_SensorSubscribeId* subscribeId, const Sensor_SensorType sensorType); -struct Sensor_SubscribeAttribute; /** * @brief 传感器订阅属性。 * @syscap SystemCapability.Sensors.Sensor @@ -363,6 +369,14 @@ struct Sensor_SubscribeAttribute; */ typedef struct Sensor_SubscribeAttribute Sensor_SubscribeAttribute; +/** + * @brief 创建传感器订阅属性实例。 + * + * @return 如果创建成功,则返回指向{@link Sensor_SubscribeAttribute} 结构实例的指针,否则返回NULL. + * @since 11 + */ +Sensor_SubscribeAttribute *OH_Sensor_CreateAttribute(); + /** * @brief 设置上报时间间隔。 * @@ -390,7 +404,6 @@ int32_t OH_Sensor_GetSamplingInterval(Sensor_SubscribeAttribute* attribute, int6 */ typedef void (*Sensor_RecordSensorCallback)(Sensor_SensorEvent *event); -struct Sensor_SubscribeUser; /** * @brief 传感器订阅者信息。 * @syscap SystemCapability.Sensors.Sensor @@ -398,6 +411,14 @@ struct Sensor_SubscribeUser; */ typedef struct Sensor_SubscribeUser Sensor_SubscribeUser; +/** + * @brief 传感器订阅者实例。 + * + * @return 如果创建成功,则返回指向{@link Sensor_SubscribeUser} 结构实例的指针,否则返回NULL. + * @since 11 + */ +Sensor_SubscribeUser *OH_Sensor_CreateUser(); + /** * @brief 设置传感器数据的回调函数。 *