From 4abfdaf5f50f882b214c7327743edaa7b9498463 Mon Sep 17 00:00:00 2001 From: songhuan Date: Fri, 16 May 2025 18:00:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E6=B8=85=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: songhuan Change-Id: I48baa681832cbceceb37e1c764bcf363a0b9e0ce --- frameworks/js/ani/src/sensor_ani.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/frameworks/js/ani/src/sensor_ani.cpp b/frameworks/js/ani/src/sensor_ani.cpp index 361c6e41..6871e423 100644 --- a/frameworks/js/ani/src/sensor_ani.cpp +++ b/frameworks/js/ani/src/sensor_ani.cpp @@ -63,7 +63,7 @@ std::map> g_sensorAttributeList = { { SENSOR_TYPE_ID_SAR, { "absorptionRatio" } } }; -std::unordered_map stringToNumberMap = { +static std::unordered_map stringToNumberMap = { {"ORIENTATION", 256}, }; @@ -74,9 +74,9 @@ static std::map g_samplingPeriod = { }; using ConvertDataFunc = bool(*)(sptr asyncCallbackInfo, std::vector &data); -bool ConvertToSensorData(sptr asyncCallbackInfo, std::vector &data); +static bool ConvertToSensorData(sptr asyncCallbackInfo, std::vector &data); -std::map g_convertfuncList = { +static std::map g_convertfuncList = { {ON_CALLBACK, ConvertToSensorData}, }; @@ -204,7 +204,7 @@ static bool SendEventToMainThread(const std::function func) return true; } -bool ValidateAndInitialize(sptr asyncCallbackInfo, ani_object &obj) +static bool ValidateAndInitialize(sptr asyncCallbackInfo, ani_object &obj) { CHKPF(asyncCallbackInfo); int32_t sensorTypeId = asyncCallbackInfo->data.sensorData.sensorTypeId; @@ -254,7 +254,7 @@ bool ValidateAndInitialize(sptr asyncCallbackInfo, ani_object return true; } -ani_enum_item GetEnumItem(ani_env *env, int32_t accuracy) +static ani_enum_item GetEnumItem(ani_env *env, int32_t accuracy) { ani_namespace ns; static const char *namespaceName = "L@ohos/sensor/sensor;"; @@ -290,7 +290,7 @@ ani_enum_item GetEnumItem(ani_env *env, int32_t accuracy) return nullptr; } -bool SetSensorPropertiesAndPushData(sptr asyncCallbackInfo, ani_object obj, +static bool SetSensorPropertiesAndPushData(sptr asyncCallbackInfo, ani_object obj, std::vector &data) { CALL_LOG_ENTER; @@ -325,7 +325,7 @@ bool SetSensorPropertiesAndPushData(sptr asyncCallbackInfo, a return true; } -bool ConvertToSensorData(sptr asyncCallbackInfo, std::vector &data) +static bool ConvertToSensorData(sptr asyncCallbackInfo, std::vector &data) { ani_object obj; if (!ValidateAndInitialize(asyncCallbackInfo, obj)) { @@ -411,17 +411,17 @@ static void EmitOnCallback(SensorEvent *event) } } -void DataCallbackImpl(SensorEvent *event) +static void DataCallbackImpl(SensorEvent *event) { CHKPV(event); EmitOnCallback(event); } -const SensorUser user = { +static const SensorUser user = { .callback = DataCallbackImpl }; -int32_t SubscribeSensor(int32_t sensorTypeId, int64_t interval, RecordSensorCallback callback) +static int32_t SubscribeSensor(int32_t sensorTypeId, int64_t interval, RecordSensorCallback callback) { CALL_LOG_ENTER; int32_t ret = SubscribeSensor(sensorTypeId, &user); @@ -487,7 +487,7 @@ static void UpdateCallbackInfos(ani_env *env, int32_t sensorTypeId, ani_object c g_onCallbackInfos[sensorTypeId] = callbackInfos; } -bool GetIntervalValue(ani_env *env, ani_object options, int64_t& interval) +static bool GetIntervalValue(ani_env *env, ani_object options, int64_t& interval) { ani_boolean isUndefined; env->Reference_IsUndefined(options, &isUndefined); @@ -628,7 +628,7 @@ static int32_t RemoveCallback(ani_env *env, int32_t sensorTypeId, ani_object cal return callbackInfos.size(); } -int32_t UnsubscribeSensor(int32_t sensorTypeId) +static int32_t UnsubscribeSensor(int32_t sensorTypeId) { int32_t ret = DeactivateSensor(sensorTypeId, &user); if (ret != ERR_OK) { -- Gitee