From 617dfe39755af0c6523faa5ef99d36bc23d1b831 Mon Sep 17 00:00:00 2001 From: hui1975 Date: Wed, 18 Oct 2023 08:36:51 +0000 Subject: [PATCH 1/2] =?UTF-8?q?napi=E5=B1=82=E5=B1=8F=E8=94=BDlight1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: hui1975 Change-Id: I01c002c01975edab679706eeb49f1bc00ac3f6f0 --- interfaces/plugin/src/sensor_js.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/interfaces/plugin/src/sensor_js.cpp b/interfaces/plugin/src/sensor_js.cpp index 0b3b279b..e8aacab2 100644 --- a/interfaces/plugin/src/sensor_js.cpp +++ b/interfaces/plugin/src/sensor_js.cpp @@ -947,6 +947,10 @@ static napi_value GetSensorList(napi_env env, napi_callback_info info) asyncCallbackInfo->error.code = ret; } else { for (int32_t i = 0; i < count; ++i) { + if (sensorInfos[i].sensorTypeId == SENSOR_TYPE_ID_AMBIENT_LIGHT1) { + SEN_HILOGD("This sensor is secondary ambient light"); + continue; + } asyncCallbackInfo->sensorInfos.push_back(*(sensorInfos + i)); } } -- Gitee From 1bbb9cfd817db592eb19975c6d39b15682ad58a7 Mon Sep 17 00:00:00 2001 From: hui1975 Date: Wed, 18 Oct 2023 08:48:09 +0000 Subject: [PATCH 2/2] update Signed-off-by: hui1975 Change-Id: I7fd6d4668080b85cc4e6067dc71b4d7a07c375dd --- interfaces/plugin/src/sensor_js.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/interfaces/plugin/src/sensor_js.cpp b/interfaces/plugin/src/sensor_js.cpp index e8aacab2..92bfedb6 100644 --- a/interfaces/plugin/src/sensor_js.cpp +++ b/interfaces/plugin/src/sensor_js.cpp @@ -988,6 +988,10 @@ static napi_value GetSingleSensor(napi_env env, napi_callback_info info) asyncCallbackInfo->error.code = ret; } else { for (int32_t i = 0; i < count; ++i) { + if (sensorInfos[i].sensorTypeId == SENSOR_TYPE_ID_AMBIENT_LIGHT1) { + SEN_HILOGD("This sensor is secondary ambient light"); + continue; + } if (sensorInfos[i].sensorTypeId == sensorTypeId) { asyncCallbackInfo->sensorInfos.push_back(*(sensorInfos + i)); break; -- Gitee