From 093cf1b51498686086889b01cac6f0e14c3aa95b Mon Sep 17 00:00:00 2001 From: cff-gite Date: Tue, 12 Sep 2023 02:36:00 +0000 Subject: [PATCH 01/11] =?UTF-8?q?=E8=A7=A3=E5=86=B3sensor=5Flite=E9=83=A8?= =?UTF-8?q?=E4=BB=B6=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cff-gite Change-Id: Iefd2a0ab08f79817d4b5dcab1f9134bf448845ad --- bundle.json | 9 +++++---- sensor_lite.gni | 22 ++++++++++++++++++++++ services/BUILD.gn | 5 ++++- services/src/sensor_service.c | 2 ++ services/src/sensor_service_impl.c | 10 ++++++++++ 5 files changed, 43 insertions(+), 5 deletions(-) mode change 100644 => 100755 bundle.json create mode 100755 sensor_lite.gni mode change 100644 => 100755 services/BUILD.gn mode change 100644 => 100755 services/src/sensor_service.c mode change 100644 => 100755 services/src/sensor_service_impl.c diff --git a/bundle.json b/bundle.json old mode 100644 new mode 100755 index f240097..0d3714a --- a/bundle.json +++ b/bundle.json @@ -16,12 +16,13 @@ "ram": "~200KB", "deps": { "components": [ - "samgr_lite", + "drivers_peripheral_sensor", + "hilog_lite", "ipc", - "utils_base", - "hdi_sensor" + "samgr_lite", + "utils_lite" ], - "third_party": [] + "third_party": [ "bounds_checking_function" ] }, "build": { "sub_component": [ diff --git a/sensor_lite.gni b/sensor_lite.gni new file mode 100755 index 0000000..6434ac7 --- /dev/null +++ b/sensor_lite.gni @@ -0,0 +1,22 @@ +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") + +if (!defined(global_parts_info) || + defined(global_parts_info.sensors_hdi_sensor)) { + has_hdi_sensor_part = true + sensor_default_defines += [ "-DHAS_HDI_SENSOR_LITE_PRAT" ] +} else { + has_hdi_sensor_part = false +} diff --git a/services/BUILD.gn b/services/BUILD.gn old mode 100644 new mode 100755 index a70fa4c..6e9c8b8 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -37,8 +37,11 @@ executable("sensor_service") { ] deps = [ - "//drivers/peripheral/sensor/hal:hdi_sensor", "//foundation/communication/ipc/interfaces/innerkits/c/ipc:ipc_single", "//foundation/systemabilitymgr/samgr_lite/samgr:samgr", ] + + if (has_hdi_sensor_part) { + deps += [ "//drivers/peripheral/sensor/hal:hdi_sensor" ] + } } diff --git a/services/src/sensor_service.c b/services/src/sensor_service.c old mode 100644 new mode 100755 index 1bfd09d..df75ecc --- a/services/src/sensor_service.c +++ b/services/src/sensor_service.c @@ -228,7 +228,9 @@ static void Init(void) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); +#ifdef HAS_HDI_SENSOR_LITE_PRAT SAMGR_GetInstance()->RegisterService((Service *)&g_sensorService); SAMGR_GetInstance()->RegisterDefaultFeatureApi(SENSOR_SERVICE, GET_IUNKNOWN(g_sensorService)); +#ifdef HAS_HDI_SENSOR_LITE_PRAT } SYSEX_SERVICE_INIT(Init); \ No newline at end of file diff --git a/services/src/sensor_service_impl.c b/services/src/sensor_service_impl.c old mode 100644 new mode 100755 index 2477b38..485c70f --- a/services/src/sensor_service_impl.c +++ b/services/src/sensor_service_impl.c @@ -89,6 +89,7 @@ void SetSvcIdentity(IpcIo *req, const IpcIo *reply) g_svcIdentity.token = sid.token; } +#ifdef HAS_HDI_SENSOR_LITE_PRAT BOOL Initialize(Service *service, Identity identity) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); @@ -99,6 +100,7 @@ BOOL Initialize(Service *service, Identity identity) } return TRUE; } +#endif BOOL MessageHandle(Service *service, Request *msg) { @@ -148,6 +150,7 @@ int32_t ActivateSensorImpl(int32_t sensorId, const SensorUser *user) SENSOR_SERVICE, __func__); return SENSOR_ERROR_INVALID_PARAM; } +#ifdef HAS_HDI_SENSOR_LITE_PRAT if (g_sensorDevice == NULL) { HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s g_sensorDevice is NULL", SENSOR_SERVICE, __func__); @@ -159,6 +162,7 @@ int32_t ActivateSensorImpl(int32_t sensorId, const SensorUser *user) SENSOR_SERVICE, __func__, ret); return ret; } +#endif return SENSOR_OK; } @@ -176,6 +180,7 @@ int32_t DeactivateSensorImpl(int32_t sensorId, const SensorUser *user) SENSOR_SERVICE, __func__); return SENSOR_ERROR_INVALID_PARAM; } +#ifdef HAS_HDI_SENSOR_LITE_PRAT if (g_sensorDevice == NULL) { HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s g_sensorDevice is NULL", SENSOR_SERVICE, __func__); @@ -187,6 +192,7 @@ int32_t DeactivateSensorImpl(int32_t sensorId, const SensorUser *user) SENSOR_SERVICE, __func__, ret); return ret; } +#endif return SENSOR_OK; } @@ -222,6 +228,7 @@ int32_t SubscribeSensorImpl(int32_t sensorId, const SensorUser *user) SENSOR_SERVICE, __func__); return SENSOR_ERROR_INVALID_PARAM; } +#ifdef HAS_HDI_SENSOR_LITE_PRAT if (g_sensorDevice == NULL) { HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s g_sensorDevice is NULL", SENSOR_SERVICE, __func__); @@ -233,6 +240,7 @@ int32_t SubscribeSensorImpl(int32_t sensorId, const SensorUser *user) SENSOR_SERVICE, __func__, ret); return SENSOR_ERROR_INVALID_PARAM; } +#endif return SENSOR_OK; } @@ -250,6 +258,7 @@ int32_t UnsubscribeSensorImpl(int32_t sensorId, const SensorUser *user) SENSOR_SERVICE, __func__); return SENSOR_ERROR_INVALID_PARAM; } +#ifdef HAS_HDI_SENSOR_LITE_PRAT if (g_sensorDevice == NULL) { HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s g_sensorDevice is NULL", SENSOR_SERVICE, __func__); @@ -261,6 +270,7 @@ int32_t UnsubscribeSensorImpl(int32_t sensorId, const SensorUser *user) SENSOR_SERVICE, __func__, ret); return SENSOR_ERROR_INVALID_PARAM; } +#endif return SENSOR_OK; } -- Gitee From 9d1ab6e3aebb1565d4ac44896eecd355efbfc27b Mon Sep 17 00:00:00 2001 From: cff-gite Date: Tue, 12 Sep 2023 02:45:43 +0000 Subject: [PATCH 02/11] =?UTF-8?q?=E8=A7=A3=E5=86=B3sensor=5Flite=E9=83=A8?= =?UTF-8?q?=E4=BB=B6=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cff-gite Change-Id: Ief8ee6ec3c5851560a0ec20a006854ef00f64907 --- bundle.json | 0 sensor_lite.gni | 0 services/BUILD.gn | 0 services/src/sensor_service.c | 2 +- services/src/sensor_service_impl.c | 0 5 files changed, 1 insertion(+), 1 deletion(-) mode change 100755 => 100644 bundle.json mode change 100755 => 100644 sensor_lite.gni mode change 100755 => 100644 services/BUILD.gn mode change 100755 => 100644 services/src/sensor_service_impl.c diff --git a/bundle.json b/bundle.json old mode 100755 new mode 100644 diff --git a/sensor_lite.gni b/sensor_lite.gni old mode 100755 new mode 100644 diff --git a/services/BUILD.gn b/services/BUILD.gn old mode 100755 new mode 100644 diff --git a/services/src/sensor_service.c b/services/src/sensor_service.c index df75ecc..9e901a8 100755 --- a/services/src/sensor_service.c +++ b/services/src/sensor_service.c @@ -231,6 +231,6 @@ static void Init(void) #ifdef HAS_HDI_SENSOR_LITE_PRAT SAMGR_GetInstance()->RegisterService((Service *)&g_sensorService); SAMGR_GetInstance()->RegisterDefaultFeatureApi(SENSOR_SERVICE, GET_IUNKNOWN(g_sensorService)); -#ifdef HAS_HDI_SENSOR_LITE_PRAT +#endif } SYSEX_SERVICE_INIT(Init); \ No newline at end of file diff --git a/services/src/sensor_service_impl.c b/services/src/sensor_service_impl.c old mode 100755 new mode 100644 -- Gitee From c0f2b580a244cf9335f9c27674a40dc29f29d070 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Tue, 12 Sep 2023 02:55:01 +0000 Subject: [PATCH 03/11] =?UTF-8?q?=E8=A7=A3=E5=86=B3sensor=5Flite=E9=83=A8?= =?UTF-8?q?=E4=BB=B6=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cff-gite Change-Id: I8c461da8e62d4e5f863f6b1a200a351dfe4d9cc3 --- sensor_lite.gni | 2 +- services/src/sensor_service.c | 2 +- services/src/sensor_service_impl.c | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) mode change 100644 => 100755 sensor_lite.gni mode change 100644 => 100755 services/src/sensor_service_impl.c diff --git a/sensor_lite.gni b/sensor_lite.gni old mode 100644 new mode 100755 index 6434ac7..8e101b9 --- a/sensor_lite.gni +++ b/sensor_lite.gni @@ -16,7 +16,7 @@ import("//build/ohos.gni") if (!defined(global_parts_info) || defined(global_parts_info.sensors_hdi_sensor)) { has_hdi_sensor_part = true - sensor_default_defines += [ "-DHAS_HDI_SENSOR_LITE_PRAT" ] + sensor_default_defines += [ "HAS_HDI_SENSOR_LITE_PRAT" ] } else { has_hdi_sensor_part = false } diff --git a/services/src/sensor_service.c b/services/src/sensor_service.c index 9e901a8..7216b27 100755 --- a/services/src/sensor_service.c +++ b/services/src/sensor_service.c @@ -231,6 +231,6 @@ static void Init(void) #ifdef HAS_HDI_SENSOR_LITE_PRAT SAMGR_GetInstance()->RegisterService((Service *)&g_sensorService); SAMGR_GetInstance()->RegisterDefaultFeatureApi(SENSOR_SERVICE, GET_IUNKNOWN(g_sensorService)); -#endif +#endif // HAS_HDI_SENSOR_LITE_PRAT } SYSEX_SERVICE_INIT(Init); \ No newline at end of file diff --git a/services/src/sensor_service_impl.c b/services/src/sensor_service_impl.c old mode 100644 new mode 100755 index 485c70f..759efef --- a/services/src/sensor_service_impl.c +++ b/services/src/sensor_service_impl.c @@ -100,7 +100,7 @@ BOOL Initialize(Service *service, Identity identity) } return TRUE; } -#endif +#endif // HAS_HDI_SENSOR_LITE_PRAT BOOL MessageHandle(Service *service, Request *msg) { @@ -162,7 +162,7 @@ int32_t ActivateSensorImpl(int32_t sensorId, const SensorUser *user) SENSOR_SERVICE, __func__, ret); return ret; } -#endif +#endif // HAS_HDI_SENSOR_LITE_PRAT return SENSOR_OK; } @@ -192,7 +192,7 @@ int32_t DeactivateSensorImpl(int32_t sensorId, const SensorUser *user) SENSOR_SERVICE, __func__, ret); return ret; } -#endif +#endif // HAS_HDI_SENSOR_LITE_PRAT return SENSOR_OK; } @@ -240,7 +240,7 @@ int32_t SubscribeSensorImpl(int32_t sensorId, const SensorUser *user) SENSOR_SERVICE, __func__, ret); return SENSOR_ERROR_INVALID_PARAM; } -#endif +#endif // HAS_HDI_SENSOR_LITE_PRAT return SENSOR_OK; } @@ -270,7 +270,7 @@ int32_t UnsubscribeSensorImpl(int32_t sensorId, const SensorUser *user) SENSOR_SERVICE, __func__, ret); return SENSOR_ERROR_INVALID_PARAM; } -#endif +#endif // HAS_HDI_SENSOR_LITE_PRAT return SENSOR_OK; } -- Gitee From 9cb95ca2347265319435aa13ed35a363d4a26cfc Mon Sep 17 00:00:00 2001 From: cff-gite Date: Thu, 14 Sep 2023 02:19:44 +0000 Subject: [PATCH 04/11] =?UTF-8?q?=E8=A7=A3=E5=86=B3sensor=5Flite=E9=83=A8?= =?UTF-8?q?=E4=BB=B6=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cff-gite Change-Id: Icd1d97ebeef4570b73cade47f0805985ae94c842 --- sensor_lite.gni | 8 +++++--- services/BUILD.gn | 3 +++ services/src/sensor_service.c | 2 -- services/src/sensor_service_impl.c | 0 4 files changed, 8 insertions(+), 5 deletions(-) mode change 100644 => 100755 services/BUILD.gn mode change 100755 => 100644 services/src/sensor_service_impl.c diff --git a/sensor_lite.gni b/sensor_lite.gni index 8e101b9..4e7dbe2 100755 --- a/sensor_lite.gni +++ b/sensor_lite.gni @@ -13,10 +13,12 @@ import("//build/ohos.gni") +sensor_default_defines = [] + if (!defined(global_parts_info) || - defined(global_parts_info.sensors_hdi_sensor)) { - has_hdi_sensor_part = true + defined(global_parts_info.hdf_drivers_peripheral_sensor)) { + has_drivers_peripheral_sensor_part = true sensor_default_defines += [ "HAS_HDI_SENSOR_LITE_PRAT" ] } else { - has_hdi_sensor_part = false + has_drivers_peripheral_sensor_part = false } diff --git a/services/BUILD.gn b/services/BUILD.gn old mode 100644 new mode 100755 index 6e9c8b8..0d2fa1e --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -12,6 +12,7 @@ # limitations under the License. import("//build/lite/config/component/lite_component.gni") +import("../sensor_lite.gni") executable("sensor_service") { sources = [ @@ -36,6 +37,8 @@ executable("sensor_service") { "//base/sensors/sensor_lite/frameworks/include", ] + defines = sensor_default_defines + deps = [ "//foundation/communication/ipc/interfaces/innerkits/c/ipc:ipc_single", "//foundation/systemabilitymgr/samgr_lite/samgr:samgr", diff --git a/services/src/sensor_service.c b/services/src/sensor_service.c index 7216b27..1bfd09d 100755 --- a/services/src/sensor_service.c +++ b/services/src/sensor_service.c @@ -228,9 +228,7 @@ static void Init(void) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); -#ifdef HAS_HDI_SENSOR_LITE_PRAT SAMGR_GetInstance()->RegisterService((Service *)&g_sensorService); SAMGR_GetInstance()->RegisterDefaultFeatureApi(SENSOR_SERVICE, GET_IUNKNOWN(g_sensorService)); -#endif // HAS_HDI_SENSOR_LITE_PRAT } SYSEX_SERVICE_INIT(Init); \ No newline at end of file diff --git a/services/src/sensor_service_impl.c b/services/src/sensor_service_impl.c old mode 100755 new mode 100644 -- Gitee From dcee3b5074751d7af17e41c167587158e378c300 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Thu, 14 Sep 2023 02:22:05 +0000 Subject: [PATCH 05/11] =?UTF-8?q?=E8=A7=A3=E5=86=B3sensor=5Flite=E9=83=A8?= =?UTF-8?q?=E4=BB=B6=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cff-gite Change-Id: If2b2ec728b09af26f72d1134030339bab1c3dc1f --- services/BUILD.gn | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 services/BUILD.gn diff --git a/services/BUILD.gn b/services/BUILD.gn old mode 100755 new mode 100644 -- Gitee From 0f485bafa9565b983649927933507d7ebd5f6583 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Thu, 14 Sep 2023 02:23:40 +0000 Subject: [PATCH 06/11] =?UTF-8?q?=E8=A7=A3=E5=86=B3sensor=5Flite=E9=83=A8?= =?UTF-8?q?=E4=BB=B6=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cff-gite Change-Id: Ib165ed8af14f7e7608f7f6cfaba4f9e4e63a1d96 --- sensor_lite.gni | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 sensor_lite.gni diff --git a/sensor_lite.gni b/sensor_lite.gni old mode 100755 new mode 100644 -- Gitee From ee10a45030a979c9beccb4f0c42e6a90d7f19541 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Thu, 14 Sep 2023 02:32:11 +0000 Subject: [PATCH 07/11] =?UTF-8?q?=E8=A7=A3=E5=86=B3sensor=5Flite=E9=83=A8?= =?UTF-8?q?=E4=BB=B6=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cff-gite Change-Id: If7729acd9190139fda7cd6926ceca81ef86dd282 --- services/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 services/BUILD.gn diff --git a/services/BUILD.gn b/services/BUILD.gn old mode 100644 new mode 100755 index 0d2fa1e..3dd46de --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -44,7 +44,7 @@ executable("sensor_service") { "//foundation/systemabilitymgr/samgr_lite/samgr:samgr", ] - if (has_hdi_sensor_part) { + if (has_drivers_peripheral_sensor_part) { deps += [ "//drivers/peripheral/sensor/hal:hdi_sensor" ] } } -- Gitee From 46c7f97d72394a136760c17e5dcebbe5ae7e1081 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Thu, 14 Sep 2023 02:42:41 +0000 Subject: [PATCH 08/11] =?UTF-8?q?=E8=A7=A3=E5=86=B3sensor=5Flite=E9=83=A8?= =?UTF-8?q?=E4=BB=B6=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cff-gite Change-Id: I772cb2336d198a417664bba28ad6218bee77d4ea --- sensor_lite.gni | 48 ++++++++++++++++++++++++----------------------- services/BUILD.gn | 0 2 files changed, 25 insertions(+), 23 deletions(-) mode change 100644 => 100755 sensor_lite.gni mode change 100755 => 100644 services/BUILD.gn diff --git a/sensor_lite.gni b/sensor_lite.gni old mode 100644 new mode 100755 index 4e7dbe2..fc7567a --- a/sensor_lite.gni +++ b/sensor_lite.gni @@ -1,24 +1,26 @@ -# Copyright (c) 2023 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and +# Copyright (c) 2023 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and # limitations under the License. - -import("//build/ohos.gni") - -sensor_default_defines = [] - -if (!defined(global_parts_info) || - defined(global_parts_info.hdf_drivers_peripheral_sensor)) { - has_drivers_peripheral_sensor_part = true - sensor_default_defines += [ "HAS_HDI_SENSOR_LITE_PRAT" ] -} else { - has_drivers_peripheral_sensor_part = false -} + +import("//build/ohos.gni") + +sensor_default_defines = [] + +if (!defined(global_parts_info) || + defined(global_parts_info.hdf_drivers_peripheral_sensor)) { + has_drivers_peripheral_sensor_part = true + print("cfffffffffffffff has_drivers_peripheral_sensor_part = true") + sensor_default_defines += [ "HAS_HDI_SENSOR_LITE_PRAT" ] +} else { + has_drivers_peripheral_sensor_part = false + print("cfffffffffffffff has_drivers_peripheral_sensor_part = false") +} diff --git a/services/BUILD.gn b/services/BUILD.gn old mode 100755 new mode 100644 -- Gitee From a1fd7760d85455db2254a06aba83f250df79336b Mon Sep 17 00:00:00 2001 From: cff-gite Date: Thu, 14 Sep 2023 08:02:41 +0000 Subject: [PATCH 09/11] =?UTF-8?q?=E8=A7=A3=E5=86=B3sensor=5Flite=E9=83=A8?= =?UTF-8?q?=E4=BB=B6=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cff-gite Change-Id: I11c2a5f453cfeb975cea68a2b2d03aeb5fa40d7b --- sensor_lite.gni | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sensor_lite.gni b/sensor_lite.gni index fc7567a..c69a7f4 100755 --- a/sensor_lite.gni +++ b/sensor_lite.gni @@ -9,7 +9,7 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and -# limitations under the License. +# limitations under the License. import("//build/ohos.gni") @@ -18,9 +18,7 @@ sensor_default_defines = [] if (!defined(global_parts_info) || defined(global_parts_info.hdf_drivers_peripheral_sensor)) { has_drivers_peripheral_sensor_part = true - print("cfffffffffffffff has_drivers_peripheral_sensor_part = true") sensor_default_defines += [ "HAS_HDI_SENSOR_LITE_PRAT" ] } else { has_drivers_peripheral_sensor_part = false - print("cfffffffffffffff has_drivers_peripheral_sensor_part = false") } -- Gitee From d46ca5cd8208788f2969dad9617423b22aedf90f Mon Sep 17 00:00:00 2001 From: cff-gite Date: Fri, 15 Sep 2023 03:04:49 +0000 Subject: [PATCH 10/11] =?UTF-8?q?=E8=A7=A3=E5=86=B3sensor=5Flite=E9=83=A8?= =?UTF-8?q?=E4=BB=B6=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cff-gite Change-Id: I88d57fb0f1ebb8da858c84bbf7e8a9d5d7411801 --- sensor_lite.gni | 0 services/src/sensor_service_impl.c | 6 ++++-- 2 files changed, 4 insertions(+), 2 deletions(-) mode change 100755 => 100644 sensor_lite.gni mode change 100644 => 100755 services/src/sensor_service_impl.c diff --git a/sensor_lite.gni b/sensor_lite.gni old mode 100755 new mode 100644 diff --git a/services/src/sensor_service_impl.c b/services/src/sensor_service_impl.c old mode 100644 new mode 100755 index 759efef..f3f7cb8 --- a/services/src/sensor_service_impl.c +++ b/services/src/sensor_service_impl.c @@ -33,6 +33,7 @@ static SvcIdentity g_svcIdentity = { int32_t InitSensorList() { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); +#ifdef HAS_HDI_SENSOR_LITE_PRAT if (g_sensorDevice == NULL) { HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s g_sensorDevice is NULL", SENSOR_SERVICE, __func__); @@ -44,6 +45,7 @@ int32_t InitSensorList() SENSOR_SERVICE, __func__, ret); return SENSOR_ERROR_INVALID_PARAM; } +#endif // HAS_HDI_SENSOR_LITE_PRAT return SENSOR_OK; } @@ -89,18 +91,18 @@ void SetSvcIdentity(IpcIo *req, const IpcIo *reply) g_svcIdentity.token = sid.token; } -#ifdef HAS_HDI_SENSOR_LITE_PRAT BOOL Initialize(Service *service, Identity identity) { HILOG_DEBUG(HILOG_MODULE_APP, "[SERVICE:%s]: %s begin", SENSOR_SERVICE, __func__); +#ifdef HAS_HDI_SENSOR_LITE_PRAT g_sensorDevice = NewSensorInterfaceInstance(); if (g_sensorDevice == NULL) { HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s g_sensorDevice is NULL", SENSOR_SERVICE, __func__); } +#endif // HAS_HDI_SENSOR_LITE_PRAT return TRUE; } -#endif // HAS_HDI_SENSOR_LITE_PRAT BOOL MessageHandle(Service *service, Request *msg) { -- Gitee From 60bad7d4c77e0a490a3c727fc1a242a4365db4e0 Mon Sep 17 00:00:00 2001 From: cff-gite Date: Fri, 15 Sep 2023 03:20:46 +0000 Subject: [PATCH 11/11] =?UTF-8?q?=E8=A7=A3=E5=86=B3sensor=5Flite=E9=83=A8?= =?UTF-8?q?=E4=BB=B6=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cff-gite Change-Id: Id3d25e0c115da4d6b7a741984e9af2b01a46e1ab --- services/BUILD.gn | 2 +- services/src/sensor_service_impl.c | 0 2 files changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 services/BUILD.gn mode change 100755 => 100644 services/src/sensor_service_impl.c diff --git a/services/BUILD.gn b/services/BUILD.gn old mode 100644 new mode 100755 index 3dd46de..8fb43ab --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -33,7 +33,6 @@ executable("sensor_service") { "//foundation/communication/ipc/interfaces/innerkits/c/ipc/include", "//foundation/communication/ipc/ipc/native/c/manager/include", "//foundation/communication/ipc/services/dbinder/c/include", - "//drivers/peripheral/sensor/interfaces/include", "//base/sensors/sensor_lite/frameworks/include", ] @@ -46,5 +45,6 @@ executable("sensor_service") { if (has_drivers_peripheral_sensor_part) { deps += [ "//drivers/peripheral/sensor/hal:hdi_sensor" ] + include_dirs += [ "//drivers/peripheral/sensor/interfaces/include" ] } } diff --git a/services/src/sensor_service_impl.c b/services/src/sensor_service_impl.c old mode 100755 new mode 100644 -- Gitee