From 2cbbaa744821b288423f36d75a50bb607cf137b0 Mon Sep 17 00:00:00 2001 From: hellohyh001 Date: Wed, 2 Mar 2022 15:06:00 +0800 Subject: [PATCH] Signed-off-by:hellohyh001 Signed-off-by: hellohyh001 --- .../native/sensor/src/sensor_agent_proxy.cpp | 23 ++-- interfaces/native/include/sensor_agent_type.h | 12 +- interfaces/plugin/include/sensor_napi_utils.h | 2 +- interfaces/plugin/src/sensor_js.cpp | 5 +- interfaces/plugin/src/sensor_napi_utils.cpp | 23 ++-- .../adapter/src/compatible_connection.cpp | 11 +- .../adapter/src/hdi_connection.cpp | 11 +- services/sensor/src/sensor_dump.cpp | 6 +- utils/include/sensor.h | 43 ++++-- utils/src/sensor.cpp | 128 +++++++++++------- 10 files changed, 168 insertions(+), 96 deletions(-) mode change 100755 => 100644 frameworks/native/sensor/src/sensor_agent_proxy.cpp mode change 100755 => 100644 services/sensor/src/sensor_dump.cpp mode change 100755 => 100644 utils/include/sensor.h mode change 100755 => 100644 utils/src/sensor.cpp diff --git a/frameworks/native/sensor/src/sensor_agent_proxy.cpp b/frameworks/native/sensor/src/sensor_agent_proxy.cpp old mode 100755 new mode 100644 index ff9edf93..ca3a1861 --- a/frameworks/native/sensor/src/sensor_agent_proxy.cpp +++ b/frameworks/native/sensor/src/sensor_agent_proxy.cpp @@ -331,29 +331,36 @@ int32_t SensorAgentProxy::GetAllSensors(SensorInfo **sensorInfo, int32_t *count) HiLog::Error(LABEL, "%{public}s malloc sensorInfo failed", __func__); return OHOS::Sensors::ERROR; } - for (int32_t index = 0; index < *count; index++) { - errno_t ret = strcpy_s((*sensorInfo + index)->sensorName, SENSOR_NAME_MAX_LEN2, - sensorList_[index].GetName().c_str()); + for (int32_t index = 0; index < *count; ++index) { + errno_t ret = strcpy_s((*sensorInfo + index)->sensorName, NAME_MAX_LEN, + sensorList_[index].GetSensorName().c_str()); if (ret != EOK) { HiLog::Error(LABEL, "%{public}s strcpy sensorName failed", __func__); return OHOS::Sensors::ERROR; } - ret = strcpy_s((*sensorInfo + index)->vendorName, SENSOR_NAME_MAX_LEN2, sensorList_[index].GetVendor().c_str()); + ret = strcpy_s((*sensorInfo + index)->vendorName, NAME_MAX_LEN, + sensorList_[index].GetVendorName().c_str()); if (ret != EOK) { HiLog::Error(LABEL, "%{public}s strcpy vendorName failed", __func__); return OHOS::Sensors::ERROR; } - std::string version = std::to_string(sensorList_[index].GetVersion()); - ret = strcpy_s((*sensorInfo + index)->hardwareVersion, VERSION_MAX_LEN, version.c_str()); + ret = strcpy_s((*sensorInfo + index)->hardwareVersion, VERSION_MAX_LEN, + sensorList_[index].GetHardwareVersion().c_str()); + if (ret != EOK) { + HiLog::Error(LABEL, "%{public}s strcpy hardwareVersion failed", __func__); + return OHOS::Sensors::ERROR; + } + ret = strcpy_s((*sensorInfo + index)->firmwareVersion, VERSION_MAX_LEN, + sensorList_[index].GetFirmwareVersion().c_str()); if (ret != EOK) { HiLog::Error(LABEL, "%{public}s strcpy hardwareVersion failed", __func__); return OHOS::Sensors::ERROR; } (*sensorInfo + index)->sensorId = static_cast(sensorList_[index].GetSensorId()); - (*sensorInfo + index)->sensorTypeId = static_cast(sensorList_[index].GetSensorId()); + (*sensorInfo + index)->sensorTypeId = static_cast(sensorList_[index].GetSensorTypeId()); (*sensorInfo + index)->maxRange = sensorList_[index].GetMaxRange(); (*sensorInfo + index)->precision = sensorList_[index].GetResolution(); - (*sensorInfo + index)->power = 0.0f; + (*sensorInfo + index)->power = sensorList_[index].GetPower(); } return OHOS::Sensors::SUCCESS; } diff --git a/interfaces/native/include/sensor_agent_type.h b/interfaces/native/include/sensor_agent_type.h index 323b2f76..82cafee8 100644 --- a/interfaces/native/include/sensor_agent_type.h +++ b/interfaces/native/include/sensor_agent_type.h @@ -46,9 +46,9 @@ extern "C" { #endif /** Maximum length of the sensor name */ -#ifndef SENSOR_NAME_MAX_LEN2 -#define SENSOR_NAME_MAX_LEN2 48 -#endif /* SENSOR_NAME_MAX_LEN */ +#ifndef NAME_MAX_LEN +#define NAME_MAX_LEN 48 +#endif /* NAME_MAX_LEN */ /** Size of sensor data */ #ifndef SENSOR_USER_DATA_SIZE #define SENSOR_USER_DATA_SIZE 104 @@ -102,8 +102,8 @@ typedef enum SensorTypeId { * @since 5 */ typedef struct SensorInfo { - char sensorName[SENSOR_NAME_MAX_LEN2]; /**< Sensor name */ - char vendorName[SENSOR_NAME_MAX_LEN2]; /**< Sensor vendor */ + char sensorName[NAME_MAX_LEN]; /**< Sensor name */ + char vendorName[NAME_MAX_LEN]; /**< Sensor vendor */ char firmwareVersion[VERSION_MAX_LEN]; /**< Sensor firmware version */ char hardwareVersion[VERSION_MAX_LEN]; /**< Sensor hardware version */ int32_t sensorTypeId; /**< Sensor type ID */ @@ -150,7 +150,7 @@ typedef struct UserData { * @since 5 */ typedef struct SensorUser { - char name[SENSOR_NAME_MAX_LEN2]; /**< Name of the sensor data subscriber */ + char name[NAME_MAX_LEN]; /**< Name of the sensor data subscriber */ RecordSensorCallback callback; /**< Callback for reporting sensor data */ UserData *userData; /**< Reserved field for the sensor data subscriber */ } SensorUser; diff --git a/interfaces/plugin/include/sensor_napi_utils.h b/interfaces/plugin/include/sensor_napi_utils.h index 47175c7a..ecc8ad7f 100644 --- a/interfaces/plugin/include/sensor_napi_utils.h +++ b/interfaces/plugin/include/sensor_napi_utils.h @@ -110,7 +110,7 @@ bool GetCppBool(napi_value value, napi_env env); void EmitAsyncCallbackWork(AsyncCallbackInfo *async_callback_info); -void EmitUvEventLoop(AsyncCallbackInfo *async_callback_info); +void EmitUvEventLoop(AsyncCallbackInfo **async_callback_info); int64_t GetCppInt64(napi_value value, napi_env env); diff --git a/interfaces/plugin/src/sensor_js.cpp b/interfaces/plugin/src/sensor_js.cpp index e23255e3..5d4bbd11 100644 --- a/interfaces/plugin/src/sensor_js.cpp +++ b/interfaces/plugin/src/sensor_js.cpp @@ -62,7 +62,7 @@ static void DataCallbackImpl(SensorEvent *event) return; } onCallbackInfo->type = ON_CALLBACK; - EmitUvEventLoop((struct AsyncCallbackInfo *)(onCallbackInfo)); + EmitUvEventLoop(&g_onCallbackInfos[sensorTypeId]); } if (g_onceCallbackInfos.find(sensorTypeId) == g_onceCallbackInfos.end()) { @@ -79,7 +79,7 @@ static void DataCallbackImpl(SensorEvent *event) return; } onceCallbackInfo->type = ONCE_CALLBACK; - EmitUvEventLoop((struct AsyncCallbackInfo *)(onceCallbackInfo)); + EmitUvEventLoop(&g_onceCallbackInfos[sensorTypeId]); if (g_onCallbackInfos.find(sensorTypeId) == g_onCallbackInfos.end()) { HiLog::Debug(LABEL, "%{public}s no subscription to change sensor data, need to cancel registration", __func__); UnsubscribeSensor(sensorTypeId); @@ -861,7 +861,6 @@ static napi_value CreateEnumSensorType(napi_env env, napi_value exports) } EXTERN_C_START - static napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor desc[] = { diff --git a/interfaces/plugin/src/sensor_napi_utils.cpp b/interfaces/plugin/src/sensor_napi_utils.cpp index 34eb1113..047a15cc 100644 --- a/interfaces/plugin/src/sensor_napi_utils.cpp +++ b/interfaces/plugin/src/sensor_napi_utils.cpp @@ -405,11 +405,15 @@ void EmitAsyncCallbackWork(AsyncCallbackInfo *asyncCallbackInfo) HiLog::Debug(LABEL, "%{public}s end", __func__); } -void EmitUvEventLoop(AsyncCallbackInfo *asyncCallbackInfo) +void EmitUvEventLoop(AsyncCallbackInfo **asyncCallbackInfo) { uv_loop_s *loop(nullptr); - HiLog::Error(LABEL, "%{public}s env: %{public}p", __func__, asyncCallbackInfo->env); - napi_get_uv_event_loop(asyncCallbackInfo->env, &loop); + if (asyncCallbackInfo == nullptr || *asyncCallbackInfo == nullptr + || (*asyncCallbackInfo)->env == nullptr) { + HiLog::Error(LABEL, "%{public}s asyncCallbackInfo is null", __func__); + return; + } + napi_get_uv_event_loop((*asyncCallbackInfo)->env, &loop); if (loop == nullptr) { HiLog::Error(LABEL, "%{public}s loop is null", __func__); return; @@ -421,19 +425,16 @@ void EmitUvEventLoop(AsyncCallbackInfo *asyncCallbackInfo) } work->data = reinterpret_cast(asyncCallbackInfo); uv_queue_work(loop, work, [] (uv_work_t *work) { }, [] (uv_work_t *work, int status) { - AsyncCallbackInfo *asyncCallbackInfo = reinterpret_cast(work->data); - if (asyncCallbackInfo == nullptr) { + AsyncCallbackInfo *asyncCallbackInfo = *reinterpret_cast(work->data); + if (asyncCallbackInfo == nullptr || asyncCallbackInfo->env == nullptr + || asyncCallbackInfo->callback[0] == nullptr) { HiLog::Error(LABEL, "%{public}s asyncCallbackInfo is null", __func__); return; } napi_env env = asyncCallbackInfo->env; - napi_value undefined; + napi_value undefined = nullptr; napi_get_undefined(env, &undefined); - if (asyncCallbackInfo->callback[0] == nullptr) { - HiLog::Error(LABEL, "%{public}s callback is null", __func__); - return; - } - napi_value callback; + napi_value callback = nullptr; napi_get_reference_value(env, asyncCallbackInfo->callback[0], &callback); napi_value callResult = nullptr; napi_value result[2] = {0}; diff --git a/services/sensor/hdi_connection/adapter/src/compatible_connection.cpp b/services/sensor/hdi_connection/adapter/src/compatible_connection.cpp index 05c4999c..add28f3a 100644 --- a/services/sensor/hdi_connection/adapter/src/compatible_connection.cpp +++ b/services/sensor/hdi_connection/adapter/src/compatible_connection.cpp @@ -47,13 +47,20 @@ int32_t CompatibleConnection::GetSensorList(std::vector& sensorList) for (int32_t i = 0; i < static_cast(sensorInfos.size()); i++) { const std::string sensorName(sensorInfos[i].sensorName); const std::string vendorName(sensorInfos[i].vendorName); + const std::string firmwareVersion(sensorInfos[i].firmwareVersion); + const std::string hardwareVersion(sensorInfos[i].hardwareVersion); const int32_t sensorId = sensorInfos[i].sensorId; const float maxRange = sensorInfos[i].maxRange; Sensor sensor; sensor.SetSensorId(sensorId); + sensor.SetSensorTypeId(sensorId); + sensor.SetFirmwareVersion(firmwareVersion.c_str()); + sensor.SetHardwareVersion(hardwareVersion.c_str()); sensor.SetMaxRange(maxRange); - sensor.SetName(sensorName.c_str()); - sensor.SetVendor(vendorName.c_str()); + sensor.SetSensorName(sensorName.c_str()); + sensor.SetVendorName(vendorName.c_str()); + sensor.SetResolution(sensorInfos[i].accuracy); + sensor.SetPower(sensorInfos[i].power); sensorList.push_back(sensor); } return ERR_OK; diff --git a/services/sensor/hdi_connection/adapter/src/hdi_connection.cpp b/services/sensor/hdi_connection/adapter/src/hdi_connection.cpp index f16b3f20..4315873b 100644 --- a/services/sensor/hdi_connection/adapter/src/hdi_connection.cpp +++ b/services/sensor/hdi_connection/adapter/src/hdi_connection.cpp @@ -82,13 +82,20 @@ int32_t HdiConnection::GetSensorList(std::vector& sensorList) for (int32_t i = 0; i < static_cast(sensorInfos.size()); i++) { const std::string sensorName(sensorInfos[i].sensorName); const std::string vendorName(sensorInfos[i].vendorName); + const std::string firmwareVersion(sensorInfos[i].firmwareVersion); + const std::string hardwareVersion(sensorInfos[i].hardwareVersion); const int32_t sensorId = sensorInfos[i].sensorId; const float maxRange = sensorInfos[i].maxRange; Sensor sensor; sensor.SetSensorId(sensorId); + sensor.SetSensorTypeId(sensorId); + sensor.SetFirmwareVersion(firmwareVersion.c_str()); + sensor.SetHardwareVersion(hardwareVersion.c_str()); sensor.SetMaxRange(maxRange); - sensor.SetName(sensorName.c_str()); - sensor.SetVendor(vendorName.c_str()); + sensor.SetSensorName(sensorName.c_str()); + sensor.SetVendorName(vendorName.c_str()); + sensor.SetResolution(sensorInfos[i].accuracy); + sensor.SetPower(sensorInfos[i].power); sensorList.push_back(sensor); } return ERR_OK; diff --git a/services/sensor/src/sensor_dump.cpp b/services/sensor/src/sensor_dump.cpp old mode 100755 new mode 100644 index 1d04e2dd..6ef5503a --- a/services/sensor/src/sensor_dump.cpp +++ b/services/sensor/src/sensor_dump.cpp @@ -143,9 +143,9 @@ bool SensorDump::DumpSensorList(int32_t fd, const std::vector &sensors, for (const auto &sensor : sensors) { auto sensorId = sensor.GetSensorId(); dprintf(fd, - "sensorId:%8u | sensorType:%s | name:%s | vendor:%s | maxRange:%f | fifoMaxEventCount:%d " - "| minSamplePeriodNs:%lld | maxSamplePeriodNs:%lld\n", - sensorId, sensorMap_[sensorId].c_str(), sensor.GetName().c_str(), sensor.GetVendor().c_str(), + "sensorId:%8u | sensorType:%s | sensorName:%s | vendorName:%s | maxRange:%f" + "| fifoMaxEventCount:%d | minSamplePeriodNs:%lld | maxSamplePeriodNs:%lld\n", + sensorId, sensorMap_[sensorId].c_str(), sensor.GetSensorName().c_str(), sensor.GetVendorName().c_str(), sensor.GetMaxRange(), sensor.GetFifoMaxEventCount(), (long long) { sensor.GetMinSamplePeriodNs() }, (long long) { sensor.GetMaxSamplePeriodNs() }); } diff --git a/utils/include/sensor.h b/utils/include/sensor.h old mode 100755 new mode 100644 index 5e86c073..7d139cf1 --- a/utils/include/sensor.h +++ b/utils/include/sensor.h @@ -29,42 +29,61 @@ public: virtual ~Sensor() = default; uint32_t GetSensorId() const; void SetSensorId(uint32_t sensorId); - std::string GetName() const; - void SetName(const std::string &name); - std::string GetVendor() const; - void SetVendor(const std::string &vendor); - uint32_t GetVersion() const; - void SetVersion(uint32_t version); + + uint32_t GetSensorTypeId() const; + void SetSensorTypeId(uint32_t sensorTypeId); + + std::string GetSensorName() const; + void SetSensorName(const std::string &sensorName); + + std::string GetVendorName() const; + void SetVendorName(const std::string &vendorName); + + std::string GetHardwareVersion() const; + void SetHardwareVersion(const std::string &hardwareVersion); + + std::string GetFirmwareVersion() const; + void SetFirmwareVersion(const std::string &firmwareVersion); + float GetMaxRange() const; void SetMaxRange(float maxRange); + float GetResolution() const; void SetResolution(float resolution); + + float GetPower() const; + void SetPower(float power); + uint32_t GetFlags() const; void SetFlags(uint32_t flags); + int32_t GetFifoMaxEventCount() const; void SetFifoMaxEventCount(int32_t fifoMaxEventCount); + int64_t GetMinSamplePeriodNs() const; void SetMinSamplePeriodNs(int64_t minSamplePeriodNs); + int64_t GetMaxSamplePeriodNs() const; void SetMaxSamplePeriodNs(int64_t maxSamplePeriodNs); - std::vector GetReserved() const; - void SetReserved(const std::vector &reserved); + bool ReadFromParcel(Parcel &parcel); static std::unique_ptr Unmarshalling(Parcel &parcel); virtual bool Marshalling(Parcel &parcel) const override; private: uint32_t sensorId_; - std::string name_; - std::string vendor_; - uint32_t version_; + uint32_t sensorTypeId_; + std::string sensorName_; + std::string vendorName_; + std::string firmwareVersion_; + std::string hardwareVersion_; float maxRange_; float resolution_; + float power_; uint32_t flags_; int32_t fifoMaxEventCount_; int64_t minSamplePeriodNs_; int64_t maxSamplePeriodNs_; - std::vector reserved_; }; } // namespace Sensors } // namespace OHOS diff --git a/utils/src/sensor.cpp b/utils/src/sensor.cpp old mode 100755 new mode 100644 index 84e4129e..e5f59806 --- a/utils/src/sensor.cpp +++ b/utils/src/sensor.cpp @@ -27,9 +27,14 @@ constexpr HiLogLabel LABEL = { LOG_CORE, SensorsLogDomain::SENSOR_UTILS, "Sensor Sensor::Sensor() : sensorId_(0), - version_(0), + sensorTypeId_(0), + sensorName_(""), + vendorName_(""), + firmwareVersion_(""), + hardwareVersion_(""), maxRange_(0.0), resolution_(0.0), + power_(0.0), flags_(0), fifoMaxEventCount_(0), minSamplePeriodNs_(0), @@ -46,34 +51,54 @@ void Sensor::SetSensorId(uint32_t sensorId) sensorId_ = sensorId; } -std::string Sensor::GetName() const +uint32_t Sensor::GetSensorTypeId() const { - return name_; + return sensorTypeId_; } -void Sensor::SetName(const std::string &name) +void Sensor::SetSensorTypeId(uint32_t sensorTypeId) { - name_ = name; + sensorTypeId_ = sensorTypeId; } -std::string Sensor::GetVendor() const +std::string Sensor::GetSensorName() const { - return vendor_; + return sensorName_; } -void Sensor::SetVendor(const std::string &vendor) +void Sensor::SetSensorName(const std::string &sensorName) { - vendor_ = vendor; + sensorName_ = sensorName; } -uint32_t Sensor::GetVersion() const +std::string Sensor::GetVendorName() const { - return version_; + return vendorName_; } -void Sensor::SetVersion(uint32_t version) +void Sensor::SetVendorName(const std::string &vendorName) { - version_ = version; + vendorName_ = vendorName; +} + +std::string Sensor::GetHardwareVersion() const +{ + return hardwareVersion_; +} + +void Sensor::SetHardwareVersion(const std::string &hardwareVersion) +{ + hardwareVersion_ = hardwareVersion; +} + +std::string Sensor::GetFirmwareVersion() const +{ + return firmwareVersion_; +} + +void Sensor::SetFirmwareVersion(const std::string &firmwareVersion) +{ + firmwareVersion_ = firmwareVersion; } float Sensor::GetMaxRange() const @@ -96,7 +121,17 @@ void Sensor::SetResolution(float resolution) resolution_ = resolution; } -uint32_t Sensor::GetFlags() const +float Sensor::GetPower() const +{ + return power_; +} + +void Sensor::SetPower(float power) +{ + power_ = power; +} + +uint32_t Sensor::Sensor::GetFlags() const { return flags_; } @@ -136,66 +171,60 @@ void Sensor::SetMaxSamplePeriodNs(int64_t maxSamplePeriodNs) maxSamplePeriodNs_ = maxSamplePeriodNs; } -std::vector Sensor::GetReserved() const -{ - return reserved_; -} - -void Sensor::SetReserved(const std::vector &reserved) -{ - auto reservedCount = reserved.size(); - for (size_t i = 0; i < reservedCount; i++) { - reserved_[i] = reserved[i]; - } -} - bool Sensor::Marshalling(Parcel &parcel) const { if (!parcel.WriteUint32(sensorId_)) { HiLog::Error(LABEL, "%{public}s failed, write sensorId failed", __func__); return false; } - if (!parcel.WriteString(name_)) { - HiLog::Error(LABEL, "%{public}s failed, write name_ failed", __func__); + if (!parcel.WriteUint32(sensorTypeId_)) { + HiLog::Error(LABEL, "%{public}s failed, write sensorTypeId failed", __func__); + return false; + } + if (!parcel.WriteString(sensorName_)) { + HiLog::Error(LABEL, "%{public}s failed, write sensorName failed", __func__); return false; } - if (!parcel.WriteString(vendor_)) { - HiLog::Error(LABEL, "%{public}s failed, write vendor_ failed", __func__); + if (!parcel.WriteString(vendorName_)) { + HiLog::Error(LABEL, "%{public}s failed, write vendorName failed", __func__); return false; } - if (!parcel.WriteUint32(version_)) { - HiLog::Error(LABEL, "%{public}s failed, write version_ failed", __func__); + if (!parcel.WriteString(firmwareVersion_)) { + HiLog::Error(LABEL, "%{public}s failed, write firmwareVersion failed", __func__); + return false; + } + if (!parcel.WriteString(hardwareVersion_)) { + HiLog::Error(LABEL, "%{public}s failed, write hardwareVersion failed", __func__); return false; } if (!parcel.WriteFloat(maxRange_)) { - HiLog::Error(LABEL, "%{public}s failed, write maxRange_ failed", __func__); + HiLog::Error(LABEL, "%{public}s failed, write maxRange failed", __func__); return false; } if (!parcel.WriteFloat(resolution_)) { - HiLog::Error(LABEL, "%{public}s failed, write resolution_ failed", __func__); + HiLog::Error(LABEL, "%{public}s failed, write resolution failed", __func__); + return false; + } + if (!parcel.WriteFloat(power_)) { + HiLog::Error(LABEL, "%{public}s failed, write power failed", __func__); return false; } if (!parcel.WriteUint32(flags_)) { - HiLog::Error(LABEL, "%{public}s failed, write flags_ failed", __func__); + HiLog::Error(LABEL, "%{public}s failed, write flags failed", __func__); return false; } if (!parcel.WriteInt32(fifoMaxEventCount_)) { - HiLog::Error(LABEL, "%{public}s failed, write fifoMaxEventCount_ failed", __func__); + HiLog::Error(LABEL, "%{public}s failed, write fifoMaxEventCount failed", __func__); return false; } if (!parcel.WriteInt64(minSamplePeriodNs_)) { - HiLog::Error(LABEL, "%{public}s failed, write minSamplePeriodNs_ failed", __func__); + HiLog::Error(LABEL, "%{public}s failed, write minSamplePeriodNs failed", __func__); return false; } if (!parcel.WriteInt64(maxSamplePeriodNs_)) { - HiLog::Error(LABEL, "%{public}s failed, write maxSamplePeriodNs_ failed", __func__); + HiLog::Error(LABEL, "%{public}s failed, write maxSamplePeriodNs failed", __func__); return false; } - if (!parcel.WriteUInt32Vector(reserved_)) { - HiLog::Error(LABEL, "%{public}s failed, write reserved_ failed", __func__); - return false; - } - return true; } @@ -217,16 +246,19 @@ std::unique_ptr Sensor::Unmarshalling(Parcel &parcel) bool Sensor::ReadFromParcel(Parcel &parcel) { sensorId_ = parcel.ReadUint32(); - name_ = parcel.ReadString(); - vendor_ = parcel.ReadString(); - version_ = parcel.ReadUint32(); + sensorTypeId_ = parcel.ReadUint32(); + sensorName_ = parcel.ReadString(); + vendorName_ = parcel.ReadString(); + firmwareVersion_ = parcel.ReadString(); + hardwareVersion_ = parcel.ReadString(); + power_ = parcel.ReadFloat(); maxRange_ = parcel.ReadFloat(); resolution_ = parcel.ReadFloat(); flags_ = parcel.ReadUint32(); fifoMaxEventCount_ = parcel.ReadInt32(); minSamplePeriodNs_ = parcel.ReadInt64(); maxSamplePeriodNs_ = parcel.ReadInt64(); - return parcel.ReadUInt32Vector(&reserved_); + return true; } } // namespace Sensors } // namespace OHOS -- Gitee