From edf0f1544fd7bcc515653d9ba44c5101b6738ec9 Mon Sep 17 00:00:00 2001 From: wuzhihuitmac Date: Wed, 3 Aug 2022 09:25:05 +0000 Subject: [PATCH] modify class name Signed-off-by: wuzhihuitmac Change-Id: Ia73fbc981bd138244e6d6762923f220176781971 --- frameworks/native/sensor/BUILD.gn | 4 ++-- .../sensor/include/sensor_data_channel.h | 4 ++-- ..._event_handler.h => sensor_event_handler.h} | 12 ++++++------ ...ner.h => sensor_file_descriptor_listener.h} | 12 ++++++------ .../native/sensor/src/sensor_data_channel.cpp | 8 ++++---- ...nt_handler.cpp => sensor_event_handler.cpp} | 6 +++--- ...cpp => sensor_file_descriptor_listener.cpp} | 18 +++++++++--------- 7 files changed, 32 insertions(+), 32 deletions(-) mode change 100644 => 100755 frameworks/native/sensor/BUILD.gn rename frameworks/native/sensor/include/{my_event_handler.h => sensor_event_handler.h} (75%) rename frameworks/native/sensor/include/{my_file_descriptor_listener.h => sensor_file_descriptor_listener.h} (77%) rename frameworks/native/sensor/src/{my_event_handler.cpp => sensor_event_handler.cpp} (77%) rename frameworks/native/sensor/src/{my_file_descriptor_listener.cpp => sensor_file_descriptor_listener.cpp} (80%) diff --git a/frameworks/native/sensor/BUILD.gn b/frameworks/native/sensor/BUILD.gn old mode 100644 new mode 100755 index 6e6057fe..71ce5427 --- a/frameworks/native/sensor/BUILD.gn +++ b/frameworks/native/sensor/BUILD.gn @@ -18,11 +18,11 @@ SUBSYSTEM_DIR = "//base/sensors" ############################################## ohos_shared_library("libsensor_native") { sources = [ - "src/my_event_handler.cpp", - "src/my_file_descriptor_listener.cpp", "src/sensor_agent_proxy.cpp", "src/sensor_client_stub.cpp", "src/sensor_data_channel.cpp", + "src/sensor_event_handler.cpp", + "src/sensor_file_descriptor_listener.cpp", "src/sensor_service_client.cpp", "src/sensor_service_proxy.cpp", ] diff --git a/frameworks/native/sensor/include/sensor_data_channel.h b/frameworks/native/sensor/include/sensor_data_channel.h index e3b3a15a..f224fea7 100644 --- a/frameworks/native/sensor/include/sensor_data_channel.h +++ b/frameworks/native/sensor/include/sensor_data_channel.h @@ -19,7 +19,7 @@ #include #include -#include "my_event_handler.h" +#include "sensor_event_handler.h" #include "sensor_basic_data_channel.h" namespace OHOS { @@ -43,7 +43,7 @@ private: static void threadProcessTask(SensorDataChannel *sensorChannel); int32_t InnerSensorDataChannel(); std::mutex eventRunnerMutex_; - static std::shared_ptr eventHandler_; + static std::shared_ptr eventHandler_; static std::shared_ptr eventRunner_; static int32_t receiveFd_; }; diff --git a/frameworks/native/sensor/include/my_event_handler.h b/frameworks/native/sensor/include/sensor_event_handler.h similarity index 75% rename from frameworks/native/sensor/include/my_event_handler.h rename to frameworks/native/sensor/include/sensor_event_handler.h index 3b89c93b..3975e2bb 100755 --- a/frameworks/native/sensor/include/my_event_handler.h +++ b/frameworks/native/sensor/include/sensor_event_handler.h @@ -13,18 +13,18 @@ * limitations under the License. */ -#ifndef MY_EVENT_HANDLER_H -#define MY_EVENT_HANDLER_H +#ifndef SENSOR_EVENT_HANDLER_H +#define SENSOR_EVENT_HANDLER_H #include "event_handler.h" #include "event_runner.h" namespace OHOS { namespace Sensors { -class MyEventHandler : public AppExecFwk::EventHandler { +class SensorEventHandler : public AppExecFwk::EventHandler { public: - explicit MyEventHandler(const std::shared_ptr &runner); - ~MyEventHandler() = default; + explicit SensorEventHandler(const std::shared_ptr &runner); + ~SensorEventHandler() = default; /** * Function: Process the event. Override the method of base class. @@ -34,4 +34,4 @@ public: }; } // namespace Sensors } // namespace OHOS -#endif // MY_EVENT_HANDLER_H \ No newline at end of file +#endif // SENSOR_EVENT_HANDLER_H \ No newline at end of file diff --git a/frameworks/native/sensor/include/my_file_descriptor_listener.h b/frameworks/native/sensor/include/sensor_file_descriptor_listener.h similarity index 77% rename from frameworks/native/sensor/include/my_file_descriptor_listener.h rename to frameworks/native/sensor/include/sensor_file_descriptor_listener.h index 65c78057..24dddccd 100644 --- a/frameworks/native/sensor/include/my_file_descriptor_listener.h +++ b/frameworks/native/sensor/include/sensor_file_descriptor_listener.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef MY_FILE_DESCRIPTOR_LISTENER_H -#define MY_FILE_DESCRIPTOR_LISTENER_H +#ifndef SENSOR_FILE_DESCRIPTOR_LISTENER_H +#define SENSOR_FILE_DESCRIPTOR_LISTENER_H #include @@ -23,11 +23,11 @@ namespace OHOS { namespace Sensors { -class MyFileDescriptorListener : public AppExecFwk::FileDescriptorListener { +class SensorFileDescriptorListener : public AppExecFwk::FileDescriptorListener { public: - explicit MyFileDescriptorListener(); + explicit SensorFileDescriptorListener(); - ~MyFileDescriptorListener(); + ~SensorFileDescriptorListener(); void OnReadable(int32_t fileDescriptor) override; @@ -45,4 +45,4 @@ private: }; } // namespace Sensors } // namespace OHOS -#endif // MY_FILE_DESCRIPTOR_LISTENER_H +#endif // SENSOR_FILE_DESCRIPTOR_LISTENER_H diff --git a/frameworks/native/sensor/src/sensor_data_channel.cpp b/frameworks/native/sensor/src/sensor_data_channel.cpp index 0cfa02f0..969966ce 100644 --- a/frameworks/native/sensor/src/sensor_data_channel.cpp +++ b/frameworks/native/sensor/src/sensor_data_channel.cpp @@ -16,14 +16,14 @@ #include "sensor_data_channel.h" #include "errors.h" -#include "my_file_descriptor_listener.h" +#include "sensor_file_descriptor_listener.h" #include "sensors_errors.h" namespace OHOS { namespace Sensors { using namespace OHOS::HiviewDFX; using namespace OHOS::AppExecFwk; -std::shared_ptr SensorDataChannel::eventHandler_; +std::shared_ptr SensorDataChannel::eventHandler_; namespace { constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorDataChannel" }; @@ -56,11 +56,11 @@ int32_t SensorDataChannel::InnerSensorDataChannel() SEN_HILOGE("create basic channel failed, ret : %{public}d", ret); return ret; } - auto listener = std::make_shared(); + auto listener = std::make_shared(); listener->SetChannel(this); auto myRunner = AppExecFwk::EventRunner::Create(true); CHKPR(myRunner, ERROR); - eventHandler_ = std::make_shared(myRunner); + eventHandler_ = std::make_shared(myRunner); CHKPR(eventHandler_, ERROR); int32_t receiveFd = GetReceiveDataFd(); auto inResult = eventHandler_->AddFileDescriptorListener(receiveFd, diff --git a/frameworks/native/sensor/src/my_event_handler.cpp b/frameworks/native/sensor/src/sensor_event_handler.cpp similarity index 77% rename from frameworks/native/sensor/src/my_event_handler.cpp rename to frameworks/native/sensor/src/sensor_event_handler.cpp index dd85ea8b..d62fcdc0 100755 --- a/frameworks/native/sensor/src/my_event_handler.cpp +++ b/frameworks/native/sensor/src/sensor_event_handler.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "my_event_handler.h" +#include "sensor_event_handler.h" namespace OHOS { namespace Sensors { @@ -22,12 +22,12 @@ using namespace OHOS::AppExecFwk; namespace { } // namespace -MyEventHandler::MyEventHandler(const std::shared_ptr &runner):EventHandler(runner){} +SensorEventHandler::SensorEventHandler(const std::shared_ptr &runner):EventHandler(runner) {} /** * Function: Process the event. Override the method of base class. * @param event The event need to be processed. */ -void MyEventHandler::ProcessEvent(const InnerEvent::Pointer &event){} +void SensorEventHandler::ProcessEvent(const InnerEvent::Pointer &event) {} } // namespace Sensors } // namespace OHOS \ No newline at end of file diff --git a/frameworks/native/sensor/src/my_file_descriptor_listener.cpp b/frameworks/native/sensor/src/sensor_file_descriptor_listener.cpp similarity index 80% rename from frameworks/native/sensor/src/my_file_descriptor_listener.cpp rename to frameworks/native/sensor/src/sensor_file_descriptor_listener.cpp index 15627d1a..37725ed1 100644 --- a/frameworks/native/sensor/src/my_file_descriptor_listener.cpp +++ b/frameworks/native/sensor/src/sensor_file_descriptor_listener.cpp @@ -13,7 +13,7 @@ * limitations under the License. */ -#include "my_file_descriptor_listener.h" +#include "sensor_file_descriptor_listener.h" #include "sensor_agent_type.h" #include "sensor_basic_data_channel.h" #include "sensors_errors.h" @@ -25,11 +25,11 @@ using namespace OHOS::HiviewDFX; using namespace OHOS::AppExecFwk; namespace { -constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "MyFileDescriptorListener" }; +constexpr HiLogLabel LABEL = { LOG_CORE, SENSOR_LOG_DOMAIN, "SensorFileDescriptorListener" }; constexpr int32_t RECEIVE_DATA_SIZE = 100; } // namespace -MyFileDescriptorListener::MyFileDescriptorListener() +SensorFileDescriptorListener::SensorFileDescriptorListener() { channel_ = nullptr; receiveDataBuff_ = @@ -37,7 +37,7 @@ MyFileDescriptorListener::MyFileDescriptorListener() CHKPL(receiveDataBuff_); } -MyFileDescriptorListener::~MyFileDescriptorListener() +SensorFileDescriptorListener::~SensorFileDescriptorListener() { CALL_LOG_ENTER; if (receiveDataBuff_ != nullptr) { @@ -46,7 +46,7 @@ MyFileDescriptorListener::~MyFileDescriptorListener() } } -void MyFileDescriptorListener::OnReadable(int32_t fileDescriptor) +void SensorFileDescriptorListener::OnReadable(int32_t fileDescriptor) { if (fileDescriptor < 0) { SEN_HILOGE("fileDescriptor: %{public}d", fileDescriptor); @@ -78,14 +78,14 @@ void MyFileDescriptorListener::OnReadable(int32_t fileDescriptor) } } -void MyFileDescriptorListener::OnWritable(int32_t fileDescriptor){} +void SensorFileDescriptorListener::OnWritable(int32_t fileDescriptor) {} -void MyFileDescriptorListener::SetChannel(SensorDataChannel* channel) +void SensorFileDescriptorListener::SetChannel(SensorDataChannel* channel) { channel_ = channel; } -void MyFileDescriptorListener::OnShutdown(int32_t fileDescriptor) +void SensorFileDescriptorListener::OnShutdown(int32_t fileDescriptor) { if (fileDescriptor < 0) { SEN_HILOGE("param is error: %{public}d", fileDescriptor); @@ -98,7 +98,7 @@ void MyFileDescriptorListener::OnShutdown(int32_t fileDescriptor) } } -void MyFileDescriptorListener::OnException(int32_t fileDescriptor) +void SensorFileDescriptorListener::OnException(int32_t fileDescriptor) { if (fileDescriptor < 0) { SEN_HILOGE("param is error: %{public}d", fileDescriptor); -- Gitee