diff --git a/frameworks/native/sensor/include/sensor_data_channel.h b/frameworks/native/sensor/include/sensor_data_channel.h index ecf87bac672e816fa1cf0d4d350a88a7f9817c2d..f2d918a05dce305d790c8b8788c5dcca5fb86b01 100644 --- a/frameworks/native/sensor/include/sensor_data_channel.h +++ b/frameworks/native/sensor/include/sensor_data_channel.h @@ -30,23 +30,17 @@ class SensorDataChannel : public SensorBasicDataChannel { public: SensorDataChannel() = default; ~SensorDataChannel(); - static int32_t HandleEvent(int32_t fd, int32_t events, void *data); int32_t CreateSensorDataChannel(DataChannelCB callBack, void *data); int32_t DestroySensorDataChannel(); - bool IsThreadExit(); - bool IsThreadStart(); int32_t RestoreSensorDataChannel(); - int32_t test = 10; DataChannelCB dataCB_ = nullptr; void *privateData_ = nullptr; private: - static void ThreadProcessTask(SensorDataChannel *sensorChannel); int32_t InnerSensorDataChannel(); std::mutex eventRunnerMutex_; - static std::shared_ptr eventHandler_; - static std::shared_ptr eventRunner_; - static int32_t receiveFd_; + std::shared_ptr eventHandler_; + int32_t receiveFd_; }; } // namespace Sensors } // namespace OHOS diff --git a/frameworks/native/sensor/src/sensor_data_channel.cpp b/frameworks/native/sensor/src/sensor_data_channel.cpp index 501a6d0e0b9fcb558548b99623f3824ff5cc23db..b2f8e19a944e9453adb9e2161d5088ee7b3d6f6e 100644 --- a/frameworks/native/sensor/src/sensor_data_channel.cpp +++ b/frameworks/native/sensor/src/sensor_data_channel.cpp @@ -23,7 +23,6 @@ namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; using namespace OHOS::AppExecFwk; -std::shared_ptr SensorDataChannel::eventHandler_; namespace { constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorDataChannel" }; @@ -74,9 +73,8 @@ int32_t SensorDataChannel::InnerSensorDataChannel() int32_t SensorDataChannel::DestroySensorDataChannel() { std::lock_guard eventRunnerLock(eventRunnerMutex_); - CHKPL(eventHandler_); eventHandler_ = nullptr; - // destroy sensor basic channelx + // destroy sensor basic channel return DestroySensorBasicChannel(); } diff --git a/frameworks/native/sensor/src/sensor_file_descriptor_listener.cpp b/frameworks/native/sensor/src/sensor_file_descriptor_listener.cpp index 009ff6a4908ca46bf0bea5ba8f1a993d9b87b719..5baa89b9db511831c590b96fe5a1ecb65ecc3b8a 100644 --- a/frameworks/native/sensor/src/sensor_file_descriptor_listener.cpp +++ b/frameworks/native/sensor/src/sensor_file_descriptor_listener.cpp @@ -83,6 +83,7 @@ void SensorFileDescriptorListener::SetChannel(SensorDataChannel* channel) void SensorFileDescriptorListener::OnShutdown(int32_t fileDescriptor) { + SEN_HILOGI("On shut down fd:%{public}d", fileDescriptor); if (fileDescriptor < 0) { SEN_HILOGE("Invalid fd:%{public}d", fileDescriptor); } @@ -96,6 +97,7 @@ void SensorFileDescriptorListener::OnShutdown(int32_t fileDescriptor) void SensorFileDescriptorListener::OnException(int32_t fileDescriptor) { + SEN_HILOGE("exception fd:%{public}d", fileDescriptor); if (fileDescriptor < 0) { SEN_HILOGE("Invalid fd::%{public}d", fileDescriptor); }