From ed0add8a8b9ec7c2c9e5dfb89b65e724207cc040 Mon Sep 17 00:00:00 2001 From: hellohyh001 Date: Mon, 4 Dec 2023 13:29:02 +0000 Subject: [PATCH 1/2] upate Signed-off-by: hellohyh001 Change-Id: I86ea89dd9e2ab2641102b51a2abaf1d12014dcce --- frameworks/native/src/native_sensor.cpp | 32 +++--- interfaces/kits/c/libsensor.ndk.json | 32 +++--- interfaces/kits/c/oh_sensor_type.h | 32 +++--- .../interfaces/kits/sensor_native_test.cpp | 108 +++++++++--------- 4 files changed, 102 insertions(+), 102 deletions(-) diff --git a/frameworks/native/src/native_sensor.cpp b/frameworks/native/src/native_sensor.cpp index e872e902..f05eb049 100644 --- a/frameworks/native/src/native_sensor.cpp +++ b/frameworks/native/src/native_sensor.cpp @@ -93,7 +93,7 @@ int32_t OH_Sensor_DestroyInfos(Sensor_Info **sensors, uint32_t count) return SENSOR_SUCCESS; } -int32_t OH_Sensor_Info_GetName(Sensor_Info* sensor, char *sensorName, uint32_t *length) +int32_t OH_SensorInfo_GetName(Sensor_Info* sensor, char *sensorName, uint32_t *length) { if (sensor == nullptr || sensorName == nullptr || length == nullptr) { SEN_HILOGE("Parameter error"); @@ -112,7 +112,7 @@ int32_t OH_Sensor_Info_GetName(Sensor_Info* sensor, char *sensorName, uint32_t * return SENSOR_SUCCESS; } -int32_t OH_Sensor_Info_GetVendorName(Sensor_Info* sensor, char *vendorName, uint32_t *length) +int32_t OH_SensorInfo_GetVendorName(Sensor_Info* sensor, char *vendorName, uint32_t *length) { if (sensor == nullptr || vendorName == nullptr || length == nullptr) { SEN_HILOGE("Parameter error"); @@ -131,7 +131,7 @@ int32_t OH_Sensor_Info_GetVendorName(Sensor_Info* sensor, char *vendorName, uint return SENSOR_SUCCESS; } -int32_t OH_Sensor_Info_GetType(Sensor_Info* sensor, Sensor_Type *sensorType) +int32_t OH_SensorInfo_GetType(Sensor_Info* sensor, Sensor_Type *sensorType) { if (sensor == nullptr || sensorType == nullptr) { SEN_HILOGE("Parameter error"); @@ -141,7 +141,7 @@ int32_t OH_Sensor_Info_GetType(Sensor_Info* sensor, Sensor_Type *sensorType) return SENSOR_SUCCESS; } -int32_t OH_Sensor_Info_GetResolution(Sensor_Info* sensor, float *resolution) +int32_t OH_SensorInfo_GetResolution(Sensor_Info* sensor, float *resolution) { if (sensor == nullptr || resolution == nullptr) { SEN_HILOGE("Parameter error"); @@ -151,7 +151,7 @@ int32_t OH_Sensor_Info_GetResolution(Sensor_Info* sensor, float *resolution) return SENSOR_SUCCESS; } -int32_t OH_Sensor_Info_GetMinSamplingInterval(Sensor_Info* sensor, int64_t *minSamplePeriod) +int32_t OH_SensorInfo_GetMinSamplingInterval(Sensor_Info* sensor, int64_t *minSamplePeriod) { if (sensor == nullptr || minSamplePeriod == nullptr) { SEN_HILOGE("Parameter error"); @@ -161,7 +161,7 @@ int32_t OH_Sensor_Info_GetMinSamplingInterval(Sensor_Info* sensor, int64_t *minS return SENSOR_SUCCESS; } -int32_t OH_Sensor_Info_GetMaxSamplingInterval(Sensor_Info* sensor, int64_t *maxSamplePeriod) +int32_t OH_SensorInfo_GetMaxSamplingInterval(Sensor_Info* sensor, int64_t *maxSamplePeriod) { if (sensor == nullptr || maxSamplePeriod == nullptr) { SEN_HILOGE("Parameter error"); @@ -211,7 +211,7 @@ Sensor_Result OH_Sensor_Unsubscribe(const Sensor_SubscriptionId *id, return static_cast(UnsubscribeSensor(sensorType, sensorUser)); } -int32_t OH_Sensor_Event_GetType(Sensor_Event* sensorEvent, Sensor_Type *sensorType) +int32_t OH_SensorEvent_GetType(Sensor_Event* sensorEvent, Sensor_Type *sensorType) { if (sensorEvent == nullptr || sensorType == nullptr) { SEN_HILOGE("Parameter error"); @@ -221,7 +221,7 @@ int32_t OH_Sensor_Event_GetType(Sensor_Event* sensorEvent, Sensor_Type *sensorTy return SENSOR_SUCCESS; } -int32_t OH_Sensor_Event_GetTimestamp(Sensor_Event* sensorEvent, int64_t *timestamp) +int32_t OH_SensorEvent_GetTimestamp(Sensor_Event* sensorEvent, int64_t *timestamp) { if (sensorEvent == nullptr || timestamp == nullptr) { SEN_HILOGE("Parameter error"); @@ -231,7 +231,7 @@ int32_t OH_Sensor_Event_GetTimestamp(Sensor_Event* sensorEvent, int64_t *timesta return SENSOR_SUCCESS; } -int32_t OH_Sensor_Event_GetAccuracy(Sensor_Event* sensorEvent, Sensor_Accuracy *accuracy) +int32_t OH_SensorEvent_GetAccuracy(Sensor_Event* sensorEvent, Sensor_Accuracy *accuracy) { if (sensorEvent == nullptr || accuracy == nullptr) { SEN_HILOGE("Parameter error"); @@ -241,7 +241,7 @@ int32_t OH_Sensor_Event_GetAccuracy(Sensor_Event* sensorEvent, Sensor_Accuracy * return SENSOR_SUCCESS; } -int32_t OH_Sensor_Event_GetData(Sensor_Event* sensorEvent, float **data, uint32_t *length) +int32_t OH_SensorEvent_GetData(Sensor_Event* sensorEvent, float **data, uint32_t *length) { if (sensorEvent == nullptr || data == nullptr || length == nullptr) { SEN_HILOGE("Parameter error"); @@ -252,7 +252,7 @@ int32_t OH_Sensor_Event_GetData(Sensor_Event* sensorEvent, float **data, uint32_ return SENSOR_SUCCESS; } -int32_t OH_Sensor_SubscriptionId_GetType(Sensor_SubscriptionId* id, Sensor_Type *sensorType) +int32_t OH_SensorSubscriptionId_GetType(Sensor_SubscriptionId* id, Sensor_Type *sensorType) { if (id == nullptr || sensorType == nullptr) { SEN_HILOGE("Parameter error"); @@ -262,7 +262,7 @@ int32_t OH_Sensor_SubscriptionId_GetType(Sensor_SubscriptionId* id, Sensor_Type return SENSOR_SUCCESS; } -int32_t OH_Sensor_SubscriptionId_SetType(Sensor_SubscriptionId* id, const Sensor_Type sensorType) +int32_t OH_SensorSubscriptionId_SetType(Sensor_SubscriptionId* id, const Sensor_Type sensorType) { if (id == nullptr) { SEN_HILOGE("Parameter error"); @@ -272,7 +272,7 @@ int32_t OH_Sensor_SubscriptionId_SetType(Sensor_SubscriptionId* id, const Sensor return SENSOR_SUCCESS; } -int32_t OH_Sensor_SubscriptionAttribute_SetSamplingInterval(Sensor_SubscriptionAttribute* attribute, +int32_t OH_SensorSubscriptionAttribute_SetSamplingInterval(Sensor_SubscriptionAttribute* attribute, const int64_t samplingInterval) { if (attribute == nullptr || samplingInterval < 0) { @@ -283,7 +283,7 @@ int32_t OH_Sensor_SubscriptionAttribute_SetSamplingInterval(Sensor_SubscriptionA return SENSOR_SUCCESS; } -int32_t OH_Sensor_SubscriptionAttribute_GetSamplingInterval(Sensor_SubscriptionAttribute* attribute, +int32_t OH_SensorSubscriptionAttribute_GetSamplingInterval(Sensor_SubscriptionAttribute* attribute, int64_t *samplingInterval) { if (attribute == nullptr || samplingInterval == nullptr) { @@ -294,7 +294,7 @@ int32_t OH_Sensor_SubscriptionAttribute_GetSamplingInterval(Sensor_SubscriptionA return SENSOR_SUCCESS; } -int32_t OH_Sensor_Subscriber_SetCallback(Sensor_Subscriber* user, const Sensor_EventCallback callback) +int32_t OH_SensorSubscriber_SetCallback(Sensor_Subscriber* user, const Sensor_EventCallback callback) { if (user == nullptr || callback == nullptr) { SEN_HILOGE("Parameter error"); @@ -304,7 +304,7 @@ int32_t OH_Sensor_Subscriber_SetCallback(Sensor_Subscriber* user, const Sensor_E return SENSOR_SUCCESS; } -int32_t OH_Sensor_Subscriber_GetCallback(Sensor_Subscriber* user, Sensor_EventCallback *callback) +int32_t OH_SensorSubscriber_GetCallback(Sensor_Subscriber* user, Sensor_EventCallback *callback) { if (user == nullptr || callback == nullptr) { SEN_HILOGE("Parameter error"); diff --git a/interfaces/kits/c/libsensor.ndk.json b/interfaces/kits/c/libsensor.ndk.json index 17acb13e..a3d5e8f8 100644 --- a/interfaces/kits/c/libsensor.ndk.json +++ b/interfaces/kits/c/libsensor.ndk.json @@ -9,52 +9,52 @@ "name": "OH_Sensor_Unsubscribe" }, { - "name": "OH_Sensor_Info_GetName" + "name": "OH_SensorInfo_GetName" }, { - "name": "OH_Sensor_Info_GetVendorName" + "name": "OH_SensorInfo_GetVendorName" }, { - "name": "OH_Sensor_Info_GetType" + "name": "OH_SensorInfo_GetType" }, { - "name": "OH_Sensor_Info_GetResolution" + "name": "OH_SensorInfo_GetResolution" }, { - "name": "OH_Sensor_Info_GetMinSamplingInterval" + "name": "OH_SensorInfo_GetMinSamplingInterval" }, { - "name": "OH_Sensor_Info_GetMaxSamplingInterval" + "name": "OH_SensorInfo_GetMaxSamplingInterval" }, { - "name": "OH_Sensor_Event_GetType" + "name": "OH_SensorEvent_GetType" }, { - "name": "OH_Sensor_Event_GetTimestamp" + "name": "OH_SensorEvent_GetTimestamp" }, { - "name": "OH_Sensor_Event_GetAccuracy" + "name": "OH_SensorEvent_GetAccuracy" }, { - "name": "OH_Sensor_Event_GetData" + "name": "OH_SensorEvent_GetData" }, { - "name": "OH_Sensor_SubscriptionId_GetType" + "name": "OH_SensorSubscriptionId_GetType" }, { - "name": "OH_Sensor_SubscriptionId_SetType" + "name": "OH_SensorSubscriptionId_SetType" }, { - "name": "OH_Sensor_SubscriptionAttribute_SetSamplingInterval" + "name": "OH_SensorSubscriptionAttribute_SetSamplingInterval" }, { - "name": "OH_Sensor_SubscriptionAttribute_GetSamplingInterval" + "name": "OH_SensorSubscriptionAttribute_GetSamplingInterval" }, { - "name": "OH_Sensor_Subscriber_SetCallback" + "name": "OH_SensorSubscriber_SetCallback" }, { - "name": "OH_Sensor_Subscriber_GetCallback" + "name": "OH_SensorSubscriber_GetCallback" }, { "name": "OH_Sensor_CreateInfos" diff --git a/interfaces/kits/c/oh_sensor_type.h b/interfaces/kits/c/oh_sensor_type.h index 8c55a40c..16f05c98 100644 --- a/interfaces/kits/c/oh_sensor_type.h +++ b/interfaces/kits/c/oh_sensor_type.h @@ -210,7 +210,7 @@ int32_t OH_Sensor_DestroyInfos(Sensor_Info **sensors, uint32_t count); * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_Sensor_Info_GetName(Sensor_Info* sensor, char *sensorName, uint32_t *length); +int32_t OH_SensorInfo_GetName(Sensor_Info* sensor, char *sensorName, uint32_t *length); /** * @brief Obtains the sensor's vendor name. @@ -222,7 +222,7 @@ int32_t OH_Sensor_Info_GetName(Sensor_Info* sensor, char *sensorName, uint32_t * * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_Sensor_Info_GetVendorName(Sensor_Info* sensor, char *vendorName, uint32_t *length); +int32_t OH_SensorInfo_GetVendorName(Sensor_Info* sensor, char *vendorName, uint32_t *length); /** * @brief Obtains the sensor type. @@ -233,7 +233,7 @@ int32_t OH_Sensor_Info_GetVendorName(Sensor_Info* sensor, char *vendorName, uint * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_Sensor_Info_GetType(Sensor_Info* sensor, Sensor_Type *sensorType); +int32_t OH_SensorInfo_GetType(Sensor_Info* sensor, Sensor_Type *sensorType); /** * @brief Obtains the sensor resolution. @@ -244,7 +244,7 @@ int32_t OH_Sensor_Info_GetType(Sensor_Info* sensor, Sensor_Type *sensorType); * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_Sensor_Info_GetResolution(Sensor_Info* sensor, float *resolution); +int32_t OH_SensorInfo_GetResolution(Sensor_Info* sensor, float *resolution); /** * @brief Obtains the minimum data reporting interval of a sensor. @@ -255,7 +255,7 @@ int32_t OH_Sensor_Info_GetResolution(Sensor_Info* sensor, float *resolution); * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_Sensor_Info_GetMinSamplingInterval(Sensor_Info* sensor, int64_t *minSamplingInterval); +int32_t OH_SensorInfo_GetMinSamplingInterval(Sensor_Info* sensor, int64_t *minSamplingInterval); /** * @brief Obtains the maximum data reporting interval of a sensor. @@ -266,7 +266,7 @@ int32_t OH_Sensor_Info_GetMinSamplingInterval(Sensor_Info* sensor, int64_t *minS * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_Sensor_Info_GetMaxSamplingInterval(Sensor_Info* sensor, int64_t *maxSamplingInterval); +int32_t OH_SensorInfo_GetMaxSamplingInterval(Sensor_Info* sensor, int64_t *maxSamplingInterval); /** * @brief Defines the sensor data information. @@ -283,7 +283,7 @@ typedef struct Sensor_Event Sensor_Event; * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_Sensor_Event_GetType(Sensor_Event* Sensor_Event, Sensor_Type *sensorType); +int32_t OH_SensorEvent_GetType(Sensor_Event* Sensor_Event, Sensor_Type *sensorType); /** * @brief Obtains the timestamp of sensor data. @@ -294,7 +294,7 @@ int32_t OH_Sensor_Event_GetType(Sensor_Event* Sensor_Event, Sensor_Type *sensorT * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_Sensor_Event_GetTimestamp(Sensor_Event* Sensor_Event, int64_t *timestamp); +int32_t OH_SensorEvent_GetTimestamp(Sensor_Event* Sensor_Event, int64_t *timestamp); /** * @brief Obtains the accuracy of sensor data. @@ -305,7 +305,7 @@ int32_t OH_Sensor_Event_GetTimestamp(Sensor_Event* Sensor_Event, int64_t *timest * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_Sensor_Event_GetAccuracy(Sensor_Event* Sensor_Event, Sensor_Accuracy *accuracy); +int32_t OH_SensorEvent_GetAccuracy(Sensor_Event* Sensor_Event, Sensor_Accuracy *accuracy); /** * @brief Obtains sensor data. The data length and content depend on the sensor type. @@ -340,7 +340,7 @@ int32_t OH_Sensor_Event_GetAccuracy(Sensor_Event* Sensor_Event, Sensor_Accuracy * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_Sensor_Event_GetData(Sensor_Event* Sensor_Event, float **data, uint32_t *length); +int32_t OH_SensorEvent_GetData(Sensor_Event* Sensor_Event, float **data, uint32_t *length); /** * @brief Defines the sensor subscription ID, which uniquely identifies a sensor. @@ -376,7 +376,7 @@ int32_t OH_Sensor_DestroySubscriptionId(Sensor_SubscriptionId *id); * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_Sensor_SubscriptionId_GetType(Sensor_SubscriptionId* id, Sensor_Type *sensorType); +int32_t OH_SensorSubscriptionId_GetType(Sensor_SubscriptionId* id, Sensor_Type *sensorType); /** * @brief Sets the sensor type. @@ -387,7 +387,7 @@ int32_t OH_Sensor_SubscriptionId_GetType(Sensor_SubscriptionId* id, Sensor_Type * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_Sensor_SubscriptionId_SetType(Sensor_SubscriptionId* id, const Sensor_Type sensorType); +int32_t OH_SensorSubscriptionId_SetType(Sensor_SubscriptionId* id, const Sensor_Type sensorType); /** * @brief Defines the sensor subscription attribute. @@ -423,7 +423,7 @@ int32_t OH_Sensor_DestroySubscriptionAttribute(Sensor_SubscriptionAttribute *att * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_Sensor_SubscriptionAttribute_SetSamplingInterval(Sensor_SubscriptionAttribute* attribute, +int32_t OH_SensorSubscriptionAttribute_SetSamplingInterval(Sensor_SubscriptionAttribute* attribute, const int64_t samplingInterval); /** @@ -435,7 +435,7 @@ int32_t OH_Sensor_SubscriptionAttribute_SetSamplingInterval(Sensor_SubscriptionA * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_Sensor_SubscriptionAttribute_GetSamplingInterval(Sensor_SubscriptionAttribute* attribute, +int32_t OH_SensorSubscriptionAttribute_GetSamplingInterval(Sensor_SubscriptionAttribute* attribute, int64_t *samplingInterval); /** @@ -478,7 +478,7 @@ int32_t OH_Sensor_DestroySubscriber(Sensor_Subscriber *subscriber); * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_Sensor_Subscriber_SetCallback(Sensor_Subscriber* subscriber, const Sensor_EventCallback callback); +int32_t OH_SensorSubscriber_SetCallback(Sensor_Subscriber* subscriber, const Sensor_EventCallback callback); /** * @brief Obtains the callback function used to report sensor data. @@ -489,7 +489,7 @@ int32_t OH_Sensor_Subscriber_SetCallback(Sensor_Subscriber* subscriber, const Se * returns an error code defined in {@link Sensor_Result} otherwise. * @since 11 */ -int32_t OH_Sensor_Subscriber_GetCallback(Sensor_Subscriber* subscriber, Sensor_EventCallback *callback); +int32_t OH_SensorSubscriber_GetCallback(Sensor_Subscriber* subscriber, Sensor_EventCallback *callback); #ifdef __cplusplus } #endif diff --git a/test/unittest/interfaces/kits/sensor_native_test.cpp b/test/unittest/interfaces/kits/sensor_native_test.cpp index 757057dd..1755d6c2 100755 --- a/test/unittest/interfaces/kits/sensor_native_test.cpp +++ b/test/unittest/interfaces/kits/sensor_native_test.cpp @@ -119,17 +119,17 @@ void SensorDataCallbackImpl(Sensor_Event *event) return; } int64_t timestamp = INVALID_VALUE; - int32_t ret = OH_Sensor_Event_GetTimestamp(event, ×tamp); + int32_t ret = OH_SensorEvent_GetTimestamp(event, ×tamp); ASSERT_EQ(ret, SENSOR_SUCCESS); Sensor_Type sensorType; - ret = OH_Sensor_Event_GetType(event, &sensorType); + ret = OH_SensorEvent_GetType(event, &sensorType); ASSERT_EQ(ret, SENSOR_SUCCESS); Sensor_Accuracy accuracy = SENSOR_ACCURACY_UNRELIABLE; - ret = OH_Sensor_Event_GetAccuracy(event, &accuracy); + ret = OH_SensorEvent_GetAccuracy(event, &accuracy); ASSERT_EQ(ret, SENSOR_SUCCESS); float *data = nullptr; uint32_t length = 0; - ret = OH_Sensor_Event_GetData(event, &data, &length); + ret = OH_SensorEvent_GetData(event, &data, &length); ASSERT_EQ(ret, SENSOR_SUCCESS); SEN_HILOGI("sensorType:%{public}d, dataLen:%{public}d, accuracy:%{public}d" "x:%{public}f, y:%{public}f, z:%{public}f", sensorType, length, accuracy, @@ -149,23 +149,23 @@ HWTEST_F(SensorAgentTest, OH_Sensor_GetInfos_001, TestSize.Level1) for (uint32_t i = 0; i < count; ++i) { char sensorName[SENSOR_NAME_LENGTH_MAX] = {}; uint32_t length = SENSOR_NAME_LENGTH_MAX; - ret = OH_Sensor_Info_GetName(sensors[i], sensorName, &length); + ret = OH_SensorInfo_GetName(sensors[i], sensorName, &length); ASSERT_EQ(ret, SENSOR_SUCCESS); char vendorName[SENSOR_NAME_LENGTH_MAX] = {}; length = SENSOR_NAME_LENGTH_MAX; - ret = OH_Sensor_Info_GetVendorName(sensors[i], vendorName, &length); + ret = OH_SensorInfo_GetVendorName(sensors[i], vendorName, &length); ASSERT_EQ(ret, SENSOR_SUCCESS); Sensor_Type sensorType; - ret = OH_Sensor_Info_GetType(sensors[i], &sensorType); + ret = OH_SensorInfo_GetType(sensors[i], &sensorType); ASSERT_EQ(ret, SENSOR_SUCCESS); float resolution = INVALID_RESOLUTION; - ret = OH_Sensor_Info_GetResolution(sensors[i], &resolution); + ret = OH_SensorInfo_GetResolution(sensors[i], &resolution); ASSERT_EQ(ret, SENSOR_SUCCESS); int64_t minSamplePeriod = INVALID_VALUE; - ret = OH_Sensor_Info_GetMinSamplingInterval(sensors[i], &minSamplePeriod); + ret = OH_SensorInfo_GetMinSamplingInterval(sensors[i], &minSamplePeriod); ASSERT_EQ(ret, SENSOR_SUCCESS); int64_t maxSamplePeriod = INVALID_VALUE; - ret = OH_Sensor_Info_GetMaxSamplingInterval(sensors[i], &maxSamplePeriod); + ret = OH_SensorInfo_GetMaxSamplingInterval(sensors[i], &maxSamplePeriod); ASSERT_EQ(ret, SENSOR_SUCCESS); SEN_HILOGI("sensorType:%{public}d, sensorName:%{public}s, vendorName:%{public}s," "resolution:%{public}f, minSamplePeriod:%{public}" PRId64 "maxSamplePeriod:%{public}" PRId64, @@ -188,15 +188,15 @@ HWTEST_F(SensorAgentTest, OH_Sensor_Subscribe_001, TestSize.Level1) { SEN_HILOGI("OH_Sensor_Subscribe_001 in"); g_user = OH_Sensor_CreateSubscriber(); - int32_t ret = OH_Sensor_Subscriber_SetCallback(g_user, SensorDataCallbackImpl); + int32_t ret = OH_SensorSubscriber_SetCallback(g_user, SensorDataCallbackImpl); ASSERT_EQ(ret, SENSOR_SUCCESS); Sensor_SubscriptionId *id = OH_Sensor_CreateSubscriptionId(); - ret = OH_Sensor_SubscriptionId_SetType(id, SENSOR_ID); + ret = OH_SensorSubscriptionId_SetType(id, SENSOR_ID); ASSERT_EQ(ret, SENSOR_SUCCESS); Sensor_SubscriptionAttribute *attr = OH_Sensor_CreateSubscriptionAttribute(); - ret = OH_Sensor_SubscriptionAttribute_SetSamplingInterval(attr, SENSOR_SAMPLE_PERIOD); + ret = OH_SensorSubscriptionAttribute_SetSamplingInterval(attr, SENSOR_SAMPLE_PERIOD); ASSERT_EQ(ret, SENSOR_SUCCESS); ret = OH_Sensor_Subscribe(id, attr, g_user); @@ -221,11 +221,11 @@ HWTEST_F(SensorAgentTest, OH_Sensor_Subscribe_002, TestSize.Level1) { SEN_HILOGI("OH_Sensor_Subscribe_002 in"); Sensor_SubscriptionId *id = OH_Sensor_CreateSubscriptionId(); - int32_t ret = OH_Sensor_SubscriptionId_SetType(id, SENSOR_ID); + int32_t ret = OH_SensorSubscriptionId_SetType(id, SENSOR_ID); ASSERT_EQ(ret, SENSOR_SUCCESS); Sensor_SubscriptionAttribute *attr = OH_Sensor_CreateSubscriptionAttribute(); - ret = OH_Sensor_SubscriptionAttribute_SetSamplingInterval(attr, SENSOR_SAMPLE_PERIOD); + ret = OH_SensorSubscriptionAttribute_SetSamplingInterval(attr, SENSOR_SAMPLE_PERIOD); ASSERT_EQ(ret, SENSOR_SUCCESS); ret = OH_Sensor_Subscribe(id, attr, nullptr); @@ -242,11 +242,11 @@ HWTEST_F(SensorAgentTest, OH_Sensor_Subscribe_003, TestSize.Level1) { SEN_HILOGI("OH_Sensor_Subscribe_003 in"); g_user = OH_Sensor_CreateSubscriber(); - int32_t ret = OH_Sensor_Subscriber_SetCallback(g_user, SensorDataCallbackImpl); + int32_t ret = OH_SensorSubscriber_SetCallback(g_user, SensorDataCallbackImpl); ASSERT_EQ(ret, SENSOR_SUCCESS); Sensor_SubscriptionAttribute *attr = OH_Sensor_CreateSubscriptionAttribute(); - ret = OH_Sensor_SubscriptionAttribute_SetSamplingInterval(attr, SENSOR_SAMPLE_PERIOD); + ret = OH_SensorSubscriptionAttribute_SetSamplingInterval(attr, SENSOR_SAMPLE_PERIOD); ASSERT_EQ(ret, SENSOR_SUCCESS); ret = OH_Sensor_Subscribe(nullptr, attr, g_user); @@ -264,11 +264,11 @@ HWTEST_F(SensorAgentTest, OH_Sensor_Subscribe_004, TestSize.Level1) { SEN_HILOGI("OH_Sensor_Subscribe_004 in"); g_user = OH_Sensor_CreateSubscriber(); - int32_t ret = OH_Sensor_Subscriber_SetCallback(g_user, SensorDataCallbackImpl); + int32_t ret = OH_SensorSubscriber_SetCallback(g_user, SensorDataCallbackImpl); ASSERT_EQ(ret, SENSOR_SUCCESS); Sensor_SubscriptionId *id = OH_Sensor_CreateSubscriptionId(); - ret = OH_Sensor_SubscriptionId_SetType(id, SENSOR_ID); + ret = OH_SensorSubscriptionId_SetType(id, SENSOR_ID); ASSERT_EQ(ret, SENSOR_SUCCESS); ret = OH_Sensor_Subscribe(id, nullptr, g_user); @@ -286,7 +286,7 @@ HWTEST_F(SensorAgentTest, OH_Sensor_Unsubscribe_001, TestSize.Level1) { SEN_HILOGI("OH_Sensor_Unsubscribe_001 in"); g_user = OH_Sensor_CreateSubscriber(); - int32_t ret = OH_Sensor_Subscriber_SetCallback(g_user, SensorDataCallbackImpl); + int32_t ret = OH_SensorSubscriber_SetCallback(g_user, SensorDataCallbackImpl); ASSERT_EQ(ret, SENSOR_SUCCESS); ret = OH_Sensor_Unsubscribe(nullptr, g_user); @@ -301,7 +301,7 @@ HWTEST_F(SensorAgentTest, OH_Sensor_Unsubscribe_002, TestSize.Level1) { SEN_HILOGI("OH_Sensor_Unsubscribe_002 in"); Sensor_SubscriptionId *id = OH_Sensor_CreateSubscriptionId(); - int32_t ret = OH_Sensor_SubscriptionId_SetType(id, SENSOR_ID); + int32_t ret = OH_SensorSubscriptionId_SetType(id, SENSOR_ID); ASSERT_EQ(ret, SENSOR_SUCCESS); ret = OH_Sensor_Unsubscribe(id, nullptr); @@ -311,103 +311,103 @@ HWTEST_F(SensorAgentTest, OH_Sensor_Unsubscribe_002, TestSize.Level1) } } -HWTEST_F(SensorAgentTest, OH_Sensor_SubscriptionId_SetType_001, TestSize.Level1) +HWTEST_F(SensorAgentTest, OH_SensorSubscriptionId_SetType_001, TestSize.Level1) { - SEN_HILOGI("OH_Sensor_SubscriptionId_SetType_001 in"); - int32_t ret = OH_Sensor_SubscriptionId_SetType(nullptr, SENSOR_ID); + SEN_HILOGI("OH_SensorSubscriptionId_SetType_001 in"); + int32_t ret = OH_SensorSubscriptionId_SetType(nullptr, SENSOR_ID); ASSERT_EQ(ret, SENSOR_PARAMETER_ERROR); } -HWTEST_F(SensorAgentTest, OH_Sensor_SubscriptionId_GetType_001, TestSize.Level1) +HWTEST_F(SensorAgentTest, OH_SensorSubscriptionId_GetType_001, TestSize.Level1) { - SEN_HILOGI("OH_Sensor_SubscriptionId_GetType_001 in"); + SEN_HILOGI("OH_SensorSubscriptionId_GetType_001 in"); Sensor_Type type; - int32_t ret = OH_Sensor_SubscriptionId_GetType(nullptr, &type); + int32_t ret = OH_SensorSubscriptionId_GetType(nullptr, &type); ASSERT_EQ(ret, SENSOR_PARAMETER_ERROR); } -HWTEST_F(SensorAgentTest, OH_Sensor_SubscriptionId_GetType_002, TestSize.Level1) +HWTEST_F(SensorAgentTest, OH_SensorSubscriptionId_GetType_002, TestSize.Level1) { - SEN_HILOGI("OH_Sensor_SubscriptionId_GetType_002 in"); + SEN_HILOGI("OH_SensorSubscriptionId_GetType_002 in"); Sensor_SubscriptionId *id = OH_Sensor_CreateSubscriptionId(); - int32_t ret = OH_Sensor_SubscriptionId_GetType(id, nullptr); + int32_t ret = OH_SensorSubscriptionId_GetType(id, nullptr); ASSERT_EQ(ret, SENSOR_PARAMETER_ERROR); if (id != nullptr) { OH_Sensor_DestroySubscriptionId(id); } } -HWTEST_F(SensorAgentTest, OH_Sensor_SubscriptionAttribute_SetSamplingInterval_001, +HWTEST_F(SensorAgentTest, OH_SensorSubscriptionAttribute_SetSamplingInterval_001, TestSize.Level1) { - SEN_HILOGI("OH_Sensor_SubscriptionAttribute_SetSamplingInterval_001 in"); - int32_t ret = OH_Sensor_SubscriptionAttribute_SetSamplingInterval(nullptr, + SEN_HILOGI("OH_SensorSubscriptionAttribute_SetSamplingInterval_001 in"); + int32_t ret = OH_SensorSubscriptionAttribute_SetSamplingInterval(nullptr, SENSOR_SAMPLE_PERIOD); ASSERT_EQ(ret, SENSOR_PARAMETER_ERROR); } -HWTEST_F(SensorAgentTest, OH_Sensor_SubscriptionAttribute_SetSamplingInterval_002, +HWTEST_F(SensorAgentTest, OH_SensorSubscriptionAttribute_SetSamplingInterval_002, TestSize.Level1) { - SEN_HILOGI("OH_Sensor_SubscriptionAttribute_SetSamplingInterval_002 in"); + SEN_HILOGI("OH_SensorSubscriptionAttribute_SetSamplingInterval_002 in"); Sensor_SubscriptionAttribute *attr = OH_Sensor_CreateSubscriptionAttribute(); - int32_t ret = OH_Sensor_SubscriptionAttribute_SetSamplingInterval(attr, INVALID_VALUE); + int32_t ret = OH_SensorSubscriptionAttribute_SetSamplingInterval(attr, INVALID_VALUE); ASSERT_EQ(ret, SENSOR_PARAMETER_ERROR); if (attr != nullptr) { OH_Sensor_DestroySubscriptionAttribute(attr); } } -HWTEST_F(SensorAgentTest, OH_Sensor_SubscriptionAttribute_GetSamplingInterval_001, +HWTEST_F(SensorAgentTest, OH_SensorSubscriptionAttribute_GetSamplingInterval_001, TestSize.Level1) { - SEN_HILOGI("OH_Sensor_SubscriptionAttribute_GetSamplingInterval_001 in"); + SEN_HILOGI("OH_SensorSubscriptionAttribute_GetSamplingInterval_001 in"); int64_t samplingInterval = 0; - int32_t ret = OH_Sensor_SubscriptionAttribute_GetSamplingInterval(nullptr, + int32_t ret = OH_SensorSubscriptionAttribute_GetSamplingInterval(nullptr, &samplingInterval); ASSERT_EQ(ret, SENSOR_PARAMETER_ERROR); } -HWTEST_F(SensorAgentTest, OH_Sensor_SubscriptionAttribute_GetSamplingInterval_002, +HWTEST_F(SensorAgentTest, OH_SensorSubscriptionAttribute_GetSamplingInterval_002, TestSize.Level1) { - SEN_HILOGI("OH_Sensor_SubscriptionAttribute_GetSamplingInterval_002 in"); + SEN_HILOGI("OH_SensorSubscriptionAttribute_GetSamplingInterval_002 in"); Sensor_SubscriptionAttribute *attr = OH_Sensor_CreateSubscriptionAttribute(); - int32_t ret = OH_Sensor_SubscriptionAttribute_GetSamplingInterval(attr, nullptr); + int32_t ret = OH_SensorSubscriptionAttribute_GetSamplingInterval(attr, nullptr); ASSERT_EQ(ret, SENSOR_PARAMETER_ERROR); if (attr != nullptr) { OH_Sensor_DestroySubscriptionAttribute(attr); } } -HWTEST_F(SensorAgentTest, OH_Sensor_Subscriber_SetCallback_001, TestSize.Level1) +HWTEST_F(SensorAgentTest, OH_SensorSubscriber_SetCallback_001, TestSize.Level1) { - SEN_HILOGI("OH_Sensor_Subscriber_SetCallback_001 in"); - int32_t ret = OH_Sensor_Subscriber_SetCallback(nullptr, SensorDataCallbackImpl); + SEN_HILOGI("OH_SensorSubscriber_SetCallback_001 in"); + int32_t ret = OH_SensorSubscriber_SetCallback(nullptr, SensorDataCallbackImpl); ASSERT_EQ(ret, SENSOR_PARAMETER_ERROR); } -HWTEST_F(SensorAgentTest, OH_Sensor_Subscriber_SetCallback_002, TestSize.Level1) +HWTEST_F(SensorAgentTest, OH_SensorSubscriber_SetCallback_002, TestSize.Level1) { - SEN_HILOGI("OH_Sensor_Subscriber_SetCallback_002 in"); + SEN_HILOGI("OH_SensorSubscriber_SetCallback_002 in"); g_user = OH_Sensor_CreateSubscriber(); - int32_t ret = OH_Sensor_Subscriber_SetCallback(g_user, nullptr); + int32_t ret = OH_SensorSubscriber_SetCallback(g_user, nullptr); ASSERT_EQ(ret, SENSOR_PARAMETER_ERROR); } -HWTEST_F(SensorAgentTest, OH_Sensor_Subscriber_GetCallback_001, TestSize.Level1) +HWTEST_F(SensorAgentTest, OH_SensorSubscriber_GetCallback_001, TestSize.Level1) { - SEN_HILOGI("OH_Sensor_Subscriber_GetCallback_001 in"); + SEN_HILOGI("OH_SensorSubscriber_GetCallback_001 in"); Sensor_EventCallback callback; - int32_t ret = OH_Sensor_Subscriber_GetCallback(nullptr, &callback); + int32_t ret = OH_SensorSubscriber_GetCallback(nullptr, &callback); ASSERT_EQ(ret, SENSOR_PARAMETER_ERROR); } -HWTEST_F(SensorAgentTest, OH_Sensor_Subscriber_GetCallback_002, TestSize.Level1) +HWTEST_F(SensorAgentTest, OH_SensorSubscriber_GetCallback_002, TestSize.Level1) { - SEN_HILOGI("OH_Sensor_Subscriber_GetCallback_002 in"); + SEN_HILOGI("OH_SensorSubscriber_GetCallback_002 in"); g_user = OH_Sensor_CreateSubscriber(); - int32_t ret = OH_Sensor_Subscriber_GetCallback(g_user, nullptr); + int32_t ret = OH_SensorSubscriber_GetCallback(g_user, nullptr); ASSERT_EQ(ret, SENSOR_PARAMETER_ERROR); if (g_user != nullptr) { OH_Sensor_DestroySubscriber(g_user); -- Gitee From f2dfa446feecd5b64b255e7ca49adb48b7beb9c2 Mon Sep 17 00:00:00 2001 From: hellohyh001 Date: Thu, 7 Dec 2023 07:30:00 +0000 Subject: [PATCH 2/2] update Signed-off-by: hellohyh001 Change-Id: I2d5e2a6c8cf1b07383f476223267097fb2337d99 --- interfaces/kits/c/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/kits/c/BUILD.gn b/interfaces/kits/c/BUILD.gn index aca02c5c..8a12ddf2 100644 --- a/interfaces/kits/c/BUILD.gn +++ b/interfaces/kits/c/BUILD.gn @@ -15,7 +15,7 @@ import("//build/ohos.gni") import("//build/ohos/ndk/ndk.gni") ohos_ndk_headers("sensor_ndk_header") { - dest_dir = "$ndk_headers_out_dir/sensors/sensor" + dest_dir = "$ndk_headers_out_dir/sensors" sources = [ "./oh_sensor.h", "./oh_sensor_type.h", -- Gitee