mirror of
https://gitee.com/openharmony/sensors_sensor
synced 2024-12-04 04:31:52 +00:00
commit
1009177bb3
@ -31,6 +31,7 @@ namespace Sensors {
|
||||
namespace {
|
||||
constexpr int32_t STRING_LENGTH_MAX = 64;
|
||||
} // namespace
|
||||
static std::mutex g_sensorAttrListMutex;
|
||||
bool IsSameValue(const napi_env &env, const napi_value &lhs, const napi_value &rhs)
|
||||
{
|
||||
CALL_LOG_ENTER;
|
||||
@ -321,6 +322,7 @@ bool ConvertToSensorData(const napi_env &env, sptr<AsyncCallbackInfo> asyncCallb
|
||||
{
|
||||
CHKPF(asyncCallbackInfo);
|
||||
int32_t sensorTypeId = asyncCallbackInfo->data.sensorData.sensorTypeId;
|
||||
std::lock_guard<std::mutex> sensorAttrListLock(g_sensorAttrListMutex);
|
||||
CHKNCF(env, (g_sensorAttributeList.find(sensorTypeId) != g_sensorAttributeList.end()), "Invalid sensor type");
|
||||
if (sensorTypeId == SENSOR_TYPE_ID_WEAR_DETECTION && asyncCallbackInfo->type == SUBSCRIBE_CALLBACK) {
|
||||
return ConvertToBodyData(env, asyncCallbackInfo, result);
|
||||
|
Loading…
Reference in New Issue
Block a user