diff --git a/frameworks/native/sensor/BUILD.gn b/frameworks/native/sensor/BUILD.gn old mode 100644 new mode 100755 index 6e6057fe9c9a3e382bf0f1bc472abc63599b672c..71ce54274a543d58f5d4eac01f6bd583cc5615a5 --- 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 e3b3a15ae9a8e9e3cb79acda88e9d7de417ce9d4..f224fea7892ac43ed68423c5eabab1eb36f7b862 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 3b89c93bd67ecff4c538200a48e6626567e81d2b..3975e2bb5f271b59949e5f82462fcad6aa12ec17 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 65c780571e5333d733db16d92c6e9113359f1a76..24dddccd1154e89f78f7f4037d16142052f28217 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 0cfa02f02895437e0d296799add9a10621ee331f..969966ce90d8a7429439c6f9c2f532fabfd625eb 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 dd85ea8b4fee45dc79177d0c4c941485def19d51..d62fcdc0c39f4aedfc4f8f233894251d0a40f348 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 15627d1aac375a534093292a3c32d71c80c887ab..37725ed11bea982519512917de835f078938e8ac 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);