From 84a72c9182db86b51566c2386b2051c8d07d4582 Mon Sep 17 00:00:00 2001 From: xxxx Date: Thu, 17 Nov 2022 21:35:30 +0800 Subject: [PATCH] Description:reviewbot amend Match-id-93bf6599eace7b34dd5ca7f2ef538df320e22404 --- common/include/input_hub.cpp | 12 +- dfx_utils/include/hidumper.h | 14 +-- dfx_utils/src/hidumper.cpp | 34 +++--- .../include/distributed_input_handler.h | 12 +- .../src/distributed_input_handler.cpp | 2 +- .../add_white_list_infos_call_back_proxy.h | 5 +- .../add_white_list_infos_call_back_stub.h | 2 +- .../del_white_list_infos_call_back_proxy.h | 5 +- .../del_white_list_infos_call_back_stub.h | 2 +- .../ipc/include/distributed_input_client.h | 30 ++--- .../include/distributed_input_sink_proxy.h | 15 ++- .../ipc/include/distributed_input_sink_stub.h | 5 +- .../include/distributed_input_source_proxy.h | 50 ++++---- .../include/distributed_input_source_stub.h | 5 +- .../get_sink_screen_infos_call_back_proxy.h | 5 +- .../get_sink_screen_infos_call_back_stub.h | 2 +- .../ipc/include/input_node_listener_proxy.h | 7 +- .../ipc/include/input_node_listener_stub.h | 2 +- .../include/prepare_d_input_call_back_proxy.h | 5 +- .../include/prepare_d_input_call_back_stub.h | 2 +- .../register_d_input_call_back_proxy.h | 5 +- .../include/register_d_input_call_back_stub.h | 2 +- .../ipc/include/sharing_dhid_listener_proxy.h | 7 +- .../ipc/include/sharing_dhid_listener_stub.h | 2 +- .../include/simulation_event_listener_proxy.h | 5 +- .../include/simulation_event_listener_stub.h | 2 +- .../include/start_d_input_call_back_proxy.h | 3 +- .../include/start_d_input_call_back_stub.h | 2 +- .../start_stop_d_inputs_call_back_proxy.h | 4 +- .../start_stop_d_inputs_call_back_stub.h | 2 +- .../start_stop_result_call_back_proxy.h | 6 +- .../start_stop_result_call_back_stub.h | 2 +- .../include/stop_d_input_call_back_proxy.h | 5 +- .../ipc/include/stop_d_input_call_back_stub.h | 2 +- .../unprepare_d_input_call_back_proxy.h | 5 +- .../unprepare_d_input_call_back_stub.h | 2 +- .../unregister_d_input_call_back_proxy.h | 5 +- .../unregister_d_input_call_back_stub.h | 2 +- .../ipc/src/distributed_input_client.cpp | 2 +- .../include/dinput_sink_trans_callback.h | 24 ++-- .../include/dinput_source_trans_callback.h | 34 +++--- .../distributed_input_sink_event_handler.h | 4 +- .../include/distributed_input_sink_manager.h | 58 ++++----- .../src/distributed_input_sink_manager.cpp | 64 +++++----- .../distributed_input_sink_transport.h | 4 +- .../src/distributed_input_sink_transport.cpp | 24 ++-- .../include/distributed_input_inject.h | 3 - .../inputinject/include/virtual_device.h | 2 +- .../inputinject/include/virtual_keyboard.h | 4 +- .../inputinject/include/virtual_mouse.h | 4 +- .../inputinject/include/virtual_touchpad.h | 4 +- .../inputinject/include/virtual_touchscreen.h | 2 +- .../src/distributed_input_node_manager.cpp | 10 +- .../source/inputinject/src/virtual_device.cpp | 8 +- .../inputinject/src/virtual_touchpad.cpp | 4 +- .../inputinject/src/virtual_touchscreen.cpp | 8 +- .../distributed_input_source_event_handler.h | 4 +- .../distributed_input_source_manager.h | 113 +++++++++--------- .../distributed_input_source_sa_cli_mgr.h | 2 +- .../src/distributed_input_source_manager.cpp | 96 +++++++-------- .../distributed_input_source_transport.cpp | 38 +++--- .../include/distributed_input_sink_handler.h | 2 +- 62 files changed, 389 insertions(+), 408 deletions(-) diff --git a/common/include/input_hub.cpp b/common/include/input_hub.cpp index fc1dea6..0ff177c 100644 --- a/common/include/input_hub.cpp +++ b/common/include/input_hub.cpp @@ -629,14 +629,14 @@ int32_t InputHub::QueryLocalTouchScreenInfo(int fd) info.localAbsInfo.absXMax = absInfo.maximum; info.localAbsInfo.absMtPositionXMin = absInfo.minimum; info.localAbsInfo.absMtPositionXMax = absInfo.maximum; - info.sinkPhyWidth = (uint32_t)(absInfo.maximum + 1); + info.sinkPhyWidth = static_cast(absInfo.maximum + 1); ioctl(fd, EVIOCGABS(ABS_MT_POSITION_Y), &absInfo); info.localAbsInfo.absYMin = absInfo.minimum; info.localAbsInfo.absYMax = absInfo.maximum; info.localAbsInfo.absMtPositionYMin = absInfo.minimum; info.localAbsInfo.absMtPositionYMax = absInfo.maximum; - info.sinkPhyHeight = (uint32_t)(absInfo.maximum + 1); + info.sinkPhyHeight = static_cast(absInfo.maximum + 1); ioctl(fd, EVIOCGABS(ABS_PRESSURE), &absInfo); info.localAbsInfo.absPressureMin = absInfo.minimum; @@ -1102,12 +1102,12 @@ void InputHub::HandleTouchScreenEvent(struct input_event readBuffer[], const siz for (size_t j = iter.first; j <= iter.second; j++) { struct input_event &iev = readBuffer[j]; if (iev.code == ABS_X || iev.code == ABS_MT_POSITION_X) { - absInfo.absX = (uint32_t)iev.value; - absInfo.absXIndex = (int32_t)j; + absInfo.absX = static_cast(iev.value); + absInfo.absXIndex = static_cast(j); } if (iev.code == ABS_Y || iev.code == ABS_MT_POSITION_Y) { - absInfo.absY = (uint32_t)iev.value; - absInfo.absYIndex = (int32_t)j; + absInfo.absY = static_cast(iev.value); + absInfo.absYIndex = static_cast(j); } } diff --git a/dfx_utils/include/hidumper.h b/dfx_utils/include/hidumper.h index 17958d4..ef487ca 100644 --- a/dfx_utils/include/hidumper.h +++ b/dfx_utils/include/hidumper.h @@ -38,16 +38,16 @@ enum class HiDumperFlag { }; struct NodeInfo { - std::string deviceId_ = ""; - std::string nodeName_ = ""; - std::string dhId_ = ""; + std::string devId = ""; + std::string virNodeName = ""; + std::string inputDhId = ""; }; struct SessionInfo { - int32_t sessionId_ = 0; - std::string mySessionName_ = ""; - std::string peerSessionName_ = ""; - SessionStatus sessionStatus_ = SessionStatus::CLOSED; + int32_t sesId = 0; + std::string mySesName = ""; + std::string peerSesName = ""; + SessionStatus sessionState = SessionStatus::CLOSED; }; class HiDumper { diff --git a/dfx_utils/src/hidumper.cpp b/dfx_utils/src/hidumper.cpp index 38dd5dd..59a7b49 100644 --- a/dfx_utils/src/hidumper.cpp +++ b/dfx_utils/src/hidumper.cpp @@ -106,11 +106,11 @@ int32_t HiDumper::GetAllNodeInfos(std::string& result) for (auto iter = nodeInfos_.begin(); iter != nodeInfos_.end(); iter++) { result.append("\n{"); result.append("\n deviceid : "); - result.append(GetAnonyString((*iter).deviceId_)); + result.append(GetAnonyString((*iter).devId)); result.append("\n nodename : "); - result.append((*iter).nodeName_); + result.append((*iter).virNodeName); result.append("\n dhId : "); - result.append(GetAnonyString((*iter).dhId_)); + result.append(GetAnonyString((*iter).inputDhId)); result.append("\n},"); } return DH_SUCCESS; @@ -121,7 +121,7 @@ void HiDumper::DeleteNodeInfo(const std::string& deviceId, const std::string& dh DHLOGI("DeleteNodeInfo Dump."); std::lock_guard node_lock(nodeMutex_); for (auto iter = nodeInfos_.begin(); iter != nodeInfos_.end();) { - if ((*iter).deviceId_.compare(deviceId) == 0 && (*iter).dhId_.compare(dhId) == 0) { + if ((*iter).devId.compare(deviceId) == 0 && (*iter).inputDhId.compare(dhId) == 0) { iter = nodeInfos_.erase(iter); } else { iter++; @@ -138,18 +138,18 @@ int32_t HiDumper::GetSessionInfo(std::string& result) result.append("\n remotedevid : "); result.append(GetAnonyString(iter->first)); result.append("\n sessionid : "); - result.append(std::to_string(iter->second.sessionId_)); + result.append(std::to_string(iter->second.sesId)); result.append("\n mysessionname : "); - result.append(iter->second.mySessionName_); + result.append(iter->second.mySesName); result.append("\n peersessionname : "); - result.append(iter->second.peerSessionName_); + result.append(iter->second.peerSesName); std::string sessionStatus(""); - auto item = SESSION_STATUS.find(iter->second.sessionStatus_); + auto item = SESSION_STATUS.find(iter->second.sessionState); if (item == SESSION_STATUS.end()) { sessionStatus = "unknown state"; } else { - sessionStatus = SESSION_STATUS.find(iter->second.sessionStatus_)->second; + sessionStatus = SESSION_STATUS.find(iter->second.sessionState)->second; } result.append("\n sessionstate : "); result.append(sessionStatus); @@ -187,9 +187,9 @@ void HiDumper::SaveNodeInfo(const std::string& deviceId, const std::string& node { std::lock_guard node_lock(nodeMutex_); NodeInfo nodeInfo = { - .deviceId_ = deviceId, - .nodeName_ = nodeName, - .dhId_ = dhId, + .devId = deviceId, + .virNodeName = nodeName, + .inputDhId = dhId, }; nodeInfos_.push_back(nodeInfo); } @@ -201,10 +201,10 @@ void HiDumper::CreateSessionInfo(const std::string& remoteDevId, const int32_t& auto iter = sessionInfos_.find(remoteDevId); if (iter == sessionInfos_.end()) { SessionInfo sessionInfo = { - .sessionId_ = sessionId, - .mySessionName_ = mySessionName, - .peerSessionName_ = peerSessionName, - .sessionStatus_ = sessionStatus, + .sesId = sessionId, + .mySesName = mySessionName, + .peerSesName = peerSessionName, + .sessionState = sessionStatus, }; sessionInfos_[remoteDevId] = sessionInfo; } @@ -218,7 +218,7 @@ void HiDumper::SetSessionStatus(const std::string& remoteDevId, const SessionSta DHLOGI("remote deviceid does not exist"); return; } - sessionInfos_[remoteDevId].sessionStatus_ = sessionStatus; + sessionInfos_[remoteDevId].sessionState = sessionStatus; } } // namespace DistributedInput } // namespace DistributedHardware diff --git a/inputdevicehandler/include/distributed_input_handler.h b/inputdevicehandler/include/distributed_input_handler.h index a8a49e8..9b3ed2a 100644 --- a/inputdevicehandler/include/distributed_input_handler.h +++ b/inputdevicehandler/include/distributed_input_handler.h @@ -40,12 +40,12 @@ namespace DistributedInput { class DistributedInputHandler : public IHardwareHandler { DECLARE_SINGLE_INSTANCE_BASE(DistributedInputHandler); public: - API_EXPORT virtual int32_t Initialize() override; + API_EXPORT int32_t Initialize() override; API_EXPORT virtual std::vector Query() override; API_EXPORT virtual std::map QueryExtraInfo() override; - API_EXPORT virtual bool IsSupportPlugin() override; - API_EXPORT virtual void RegisterPluginListener(std::shared_ptr listener) override; - API_EXPORT virtual void UnRegisterPluginListener() override; + API_EXPORT bool IsSupportPlugin() override; + API_EXPORT void RegisterPluginListener(std::shared_ptr listener) override; + API_EXPORT void UnRegisterPluginListener() override; API_EXPORT void FindDevicesInfoByType(const uint32_t inputTypes, std::map &datas); API_EXPORT void FindDevicesInfoByDhId(std::vector dhidsVec, std::map &datas); @@ -66,8 +66,8 @@ private: void StopInputMonitorDeviceThread(); // The event queue. - static const int INPUT_DEVICE_BUFFER_SIZE = 32; - InputDeviceEvent mEventBuffer[INPUT_DEVICE_BUFFER_SIZE] = {}; + static const int inputDeviceBufferSize = 32; + InputDeviceEvent mEventBuffer[inputDeviceBufferSize] = {}; std::mutex operationMutex_; std::unique_ptr inputHub_; }; diff --git a/inputdevicehandler/src/distributed_input_handler.cpp b/inputdevicehandler/src/distributed_input_handler.cpp index 3b5671f..b0294bf 100644 --- a/inputdevicehandler/src/distributed_input_handler.cpp +++ b/inputdevicehandler/src/distributed_input_handler.cpp @@ -187,7 +187,7 @@ void DistributedInputHandler::StartInputMonitorDeviceThread(const std::string de return; } while (isCollectingEvents_) { - size_t count = inputHub_->StartCollectInputHandler(mEventBuffer, INPUT_DEVICE_BUFFER_SIZE); + size_t count = inputHub_->StartCollectInputHandler(mEventBuffer, inputDeviceBufferSize); if (count > 0) { DHLOGI("Count: %zu", count); for (size_t iCnt = 0; iCnt < count; iCnt++) { diff --git a/interfaces/ipc/include/add_white_list_infos_call_back_proxy.h b/interfaces/ipc/include/add_white_list_infos_call_back_proxy.h index c1939e4..276af7c 100644 --- a/interfaces/ipc/include/add_white_list_infos_call_back_proxy.h +++ b/interfaces/ipc/include/add_white_list_infos_call_back_proxy.h @@ -28,10 +28,9 @@ namespace DistributedInput { class AddWhiteListInfosCallbackProxy : public IRemoteProxy { public: explicit AddWhiteListInfosCallbackProxy(const sptr &object); + ~AddWhiteListInfosCallbackProxy() override; - virtual ~AddWhiteListInfosCallbackProxy() override; - - virtual void OnResult(const std::string& deviceId, const std::string& strJson) override; + void OnResult(const std::string& deviceId, const std::string& strJson) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/add_white_list_infos_call_back_stub.h b/interfaces/ipc/include/add_white_list_infos_call_back_stub.h index 99cda31..9ac3c69 100644 --- a/interfaces/ipc/include/add_white_list_infos_call_back_stub.h +++ b/interfaces/ipc/include/add_white_list_infos_call_back_stub.h @@ -28,7 +28,7 @@ namespace DistributedInput { class AddWhiteListInfosCallbackStub : public IRemoteStub { public: AddWhiteListInfosCallbackStub(); - virtual ~AddWhiteListInfosCallbackStub() override; + ~AddWhiteListInfosCallbackStub() override; int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/interfaces/ipc/include/del_white_list_infos_call_back_proxy.h b/interfaces/ipc/include/del_white_list_infos_call_back_proxy.h index 7362a30..9a06867 100644 --- a/interfaces/ipc/include/del_white_list_infos_call_back_proxy.h +++ b/interfaces/ipc/include/del_white_list_infos_call_back_proxy.h @@ -28,10 +28,9 @@ namespace DistributedInput { class DelWhiteListInfosCallbackProxy : public IRemoteProxy { public: explicit DelWhiteListInfosCallbackProxy(const sptr &object); + ~DelWhiteListInfosCallbackProxy() override; - virtual ~DelWhiteListInfosCallbackProxy() override; - - virtual void OnResult(const std::string& deviceId) override; + void OnResult(const std::string& deviceId) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/del_white_list_infos_call_back_stub.h b/interfaces/ipc/include/del_white_list_infos_call_back_stub.h index eb39ff1..6ad9dfe 100644 --- a/interfaces/ipc/include/del_white_list_infos_call_back_stub.h +++ b/interfaces/ipc/include/del_white_list_infos_call_back_stub.h @@ -28,7 +28,7 @@ namespace DistributedInput { class DelWhiteListInfosCallbackStub : public IRemoteStub { public: DelWhiteListInfosCallbackStub(); - virtual ~DelWhiteListInfosCallbackStub() override; + ~DelWhiteListInfosCallbackStub() override; int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/interfaces/ipc/include/distributed_input_client.h b/interfaces/ipc/include/distributed_input_client.h index 804fa7f..29745fa 100644 --- a/interfaces/ipc/include/distributed_input_client.h +++ b/interfaces/ipc/include/distributed_input_client.h @@ -120,50 +120,50 @@ public: class RegisterDInputCb : public OHOS::DistributedHardware::DistributedInput::RegisterDInputCallbackStub { public: RegisterDInputCb() = default; - virtual ~RegisterDInputCb() = default; - void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status); + ~RegisterDInputCb() override = default; + void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status) override; }; class UnregisterDInputCb : public OHOS::DistributedHardware::DistributedInput::UnregisterDInputCallbackStub { public: UnregisterDInputCb() = default; - virtual ~UnregisterDInputCb() = default; - void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status); + ~UnregisterDInputCb() override = default; + void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status) override; }; class AddWhiteListInfosCb : public OHOS::DistributedHardware::DistributedInput::AddWhiteListInfosCallbackStub { public: AddWhiteListInfosCb() = default; - virtual ~AddWhiteListInfosCb() = default; - void OnResult(const std::string &deviceId, const std::string &strJson); + ~AddWhiteListInfosCb() override = default; + void OnResult(const std::string &deviceId, const std::string &strJson) override; }; class DelWhiteListInfosCb : public OHOS::DistributedHardware::DistributedInput::DelWhiteListInfosCallbackStub { public: DelWhiteListInfosCb() = default; - virtual ~DelWhiteListInfosCb() = default; - void OnResult(const std::string &deviceId); + ~DelWhiteListInfosCb() override = default; + void OnResult(const std::string &deviceId) override; }; class SharingDhIdListenerCb : public OHOS::DistributedHardware::DistributedInput::SharingDhIdListenerStub { public: SharingDhIdListenerCb() = default; - virtual ~SharingDhIdListenerCb() = default; - int32_t OnSharing(std::string dhId); - int32_t OnNoSharing(std::string dhId); + ~SharingDhIdListenerCb() override = default; + int32_t OnSharing(std::string dhId) override; + int32_t OnNoSharing(std::string dhId) override; }; class GetSinkScreenInfosCb : public OHOS::DistributedHardware::DistributedInput::GetSinkScreenInfosCallbackStub { public: GetSinkScreenInfosCb() = default; - virtual ~GetSinkScreenInfosCb() = default; - void OnResult(const std::string &strJson); + ~GetSinkScreenInfosCb() override = default; + void OnResult(const std::string &strJson) override; }; class DInputClientEventHandler : public AppExecFwk::EventHandler { public: - DInputClientEventHandler(const std::shared_ptr &runner); - ~DInputClientEventHandler() {} + explicit DInputClientEventHandler(const std::shared_ptr &runner); + ~DInputClientEventHandler() override = default; void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) override; }; diff --git a/interfaces/ipc/include/distributed_input_sink_proxy.h b/interfaces/ipc/include/distributed_input_sink_proxy.h index d754ee5..b65df5a 100644 --- a/interfaces/ipc/include/distributed_input_sink_proxy.h +++ b/interfaces/ipc/include/distributed_input_sink_proxy.h @@ -31,19 +31,18 @@ class DistributedInputSinkProxy : public IRemoteProxy { public: explicit DistributedInputSinkProxy(const sptr &object); + ~DistributedInputSinkProxy() override; - virtual ~DistributedInputSinkProxy() override; + int32_t Init() override; - virtual int32_t Init() override; + int32_t Release() override; - virtual int32_t Release() override; + int32_t RegisterGetSinkScreenInfosCallback(sptr callback) override; - virtual int32_t RegisterGetSinkScreenInfosCallback(sptr callback) override; + int32_t NotifyStartDScreen(const SrcScreenInfo& srcScreenRemoteCtrlInfo) override; + int32_t NotifyStopDScreen(const std::string& srcScreenInfoKey) override; - virtual int32_t NotifyStartDScreen(const SrcScreenInfo& srcScreenRemoteCtrlInfo) override; - virtual int32_t NotifyStopDScreen(const std::string& srcScreenInfoKey) override; - - virtual int32_t RegisterSharingDhIdListener(sptr sharingDhIdListener) override; + int32_t RegisterSharingDhIdListener(sptr sharingDhIdListener) override; private: bool SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply); diff --git a/interfaces/ipc/include/distributed_input_sink_stub.h b/interfaces/ipc/include/distributed_input_sink_stub.h index 3b55dcd..3d13969 100644 --- a/interfaces/ipc/include/distributed_input_sink_stub.h +++ b/interfaces/ipc/include/distributed_input_sink_stub.h @@ -28,10 +28,9 @@ namespace DistributedInput { class DistributedInputSinkStub : public IRemoteStub { public: DistributedInputSinkStub(); - virtual ~DistributedInputSinkStub() override; + ~DistributedInputSinkStub() override; - virtual int32_t OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; + int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; int32_t InitInner(MessageParcel &data, MessageParcel &reply, MessageOption &option); diff --git a/interfaces/ipc/include/distributed_input_source_proxy.h b/interfaces/ipc/include/distributed_input_source_proxy.h index 959c77a..4855fe4 100644 --- a/interfaces/ipc/include/distributed_input_source_proxy.h +++ b/interfaces/ipc/include/distributed_input_source_proxy.h @@ -27,64 +27,62 @@ namespace DistributedHardware { namespace DistributedInput { class DistributedInputSourceProxy : public IRemoteProxy { public: - explicit DistributedInputSourceProxy(const sptr &object); + ~DistributedInputSourceProxy() override; - virtual ~DistributedInputSourceProxy() override; + int32_t Init() override; - virtual int32_t Init() override; + int32_t Release() override; - virtual int32_t Release() override; - - virtual int32_t RegisterDistributedHardware(const std::string& devId, const std::string& dhId, + int32_t RegisterDistributedHardware(const std::string& devId, const std::string& dhId, const std::string& parameters, sptr callback) override; - virtual int32_t UnregisterDistributedHardware(const std::string& devId, const std::string& dhId, + int32_t UnregisterDistributedHardware(const std::string& devId, const std::string& dhId, sptr callback) override; - virtual int32_t PrepareRemoteInput(const std::string &deviceId, sptr callback) override; + int32_t PrepareRemoteInput(const std::string &deviceId, sptr callback) override; - virtual int32_t UnprepareRemoteInput(const std::string &deviceId, sptr callback) override; + int32_t UnprepareRemoteInput(const std::string &deviceId, sptr callback) override; - virtual int32_t StartRemoteInput( + int32_t StartRemoteInput( const std::string& deviceId, const uint32_t& inputTypes, sptr callback) override; - virtual int32_t StopRemoteInput( + int32_t StopRemoteInput( const std::string& deviceId, const uint32_t& inputTypes, sptr callback) override; - virtual int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, + int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, sptr callback) override; - virtual int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, + int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, sptr callback) override; - virtual int32_t PrepareRemoteInput(const std::string &srcId, const std::string &sinkId, + int32_t PrepareRemoteInput(const std::string &srcId, const std::string &sinkId, sptr callback) override; - virtual int32_t UnprepareRemoteInput(const std::string &srcId, const std::string &sinkId, + int32_t UnprepareRemoteInput(const std::string &srcId, const std::string &sinkId, sptr callback) override; - virtual int32_t StartRemoteInput(const std::string &sinkId, const std::vector &dhIds, + int32_t StartRemoteInput(const std::string &sinkId, const std::vector &dhIds, sptr callback) override; - virtual int32_t StopRemoteInput(const std::string &sinkId, const std::vector &dhIds, + int32_t StopRemoteInput(const std::string &sinkId, const std::vector &dhIds, sptr callback) override; - virtual int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, + int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const std::vector &dhIds, sptr callback) override; - virtual int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, + int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, const std::vector &dhIds, sptr callback) override; - virtual int32_t RegisterAddWhiteListCallback(sptr addWhiteListCallback) override; - virtual int32_t RegisterDelWhiteListCallback(sptr delWhiteListCallback) override; - virtual int32_t RegisterInputNodeListener(sptr listener) override; - virtual int32_t UnregisterInputNodeListener(sptr listener) override; + int32_t RegisterAddWhiteListCallback(sptr addWhiteListCallback) override; + int32_t RegisterDelWhiteListCallback(sptr delWhiteListCallback) override; + int32_t RegisterInputNodeListener(sptr listener) override; + int32_t UnregisterInputNodeListener(sptr listener) override; - virtual int32_t SyncNodeInfoRemoteInput(const std::string &userDevId, const std::string &dhid, + int32_t SyncNodeInfoRemoteInput(const std::string &userDevId, const std::string &dhid, const std::string &nodeDesc) override; - virtual int32_t RegisterSimulationEventListener(sptr listener) override; - virtual int32_t UnregisterSimulationEventListener(sptr listener) override; + int32_t RegisterSimulationEventListener(sptr listener) override; + int32_t UnregisterSimulationEventListener(sptr listener) override; private: bool SendRequest(const IDistributedSourceInput::MessageCode code, MessageParcel &data, MessageParcel &reply); diff --git a/interfaces/ipc/include/distributed_input_source_stub.h b/interfaces/ipc/include/distributed_input_source_stub.h index 3819ceb..2690ce8 100644 --- a/interfaces/ipc/include/distributed_input_source_stub.h +++ b/interfaces/ipc/include/distributed_input_source_stub.h @@ -28,10 +28,9 @@ namespace DistributedInput { class DistributedInputSourceStub : public IRemoteStub { public: DistributedInputSourceStub(); - virtual ~DistributedInputSourceStub() override; + ~DistributedInputSourceStub() override; - virtual int32_t OnRemoteRequest( - uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; + int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; private: int32_t HandleInitDistributedHardware(MessageParcel &reply); diff --git a/interfaces/ipc/include/get_sink_screen_infos_call_back_proxy.h b/interfaces/ipc/include/get_sink_screen_infos_call_back_proxy.h index 22fb1f7..fd5b1d2 100644 --- a/interfaces/ipc/include/get_sink_screen_infos_call_back_proxy.h +++ b/interfaces/ipc/include/get_sink_screen_infos_call_back_proxy.h @@ -28,10 +28,9 @@ namespace DistributedInput { class GetSinkScreenInfosCallbackProxy : public IRemoteProxy { public: explicit GetSinkScreenInfosCallbackProxy(const sptr &object); + ~GetSinkScreenInfosCallbackProxy() override; - virtual ~GetSinkScreenInfosCallbackProxy() override; - - virtual void OnResult(const std::string& strJson) override; + void OnResult(const std::string& strJson) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/get_sink_screen_infos_call_back_stub.h b/interfaces/ipc/include/get_sink_screen_infos_call_back_stub.h index bcaa388..9d5e429 100644 --- a/interfaces/ipc/include/get_sink_screen_infos_call_back_stub.h +++ b/interfaces/ipc/include/get_sink_screen_infos_call_back_stub.h @@ -28,7 +28,7 @@ namespace DistributedInput { class GetSinkScreenInfosCallbackStub : public IRemoteStub { public: GetSinkScreenInfosCallbackStub(); - virtual ~GetSinkScreenInfosCallbackStub() override; + ~GetSinkScreenInfosCallbackStub() override; int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/interfaces/ipc/include/input_node_listener_proxy.h b/interfaces/ipc/include/input_node_listener_proxy.h index 3c9a0ee..45b8de3 100644 --- a/interfaces/ipc/include/input_node_listener_proxy.h +++ b/interfaces/ipc/include/input_node_listener_proxy.h @@ -28,13 +28,12 @@ namespace DistributedInput { class InputNodeListenerProxy : public IRemoteProxy { public: explicit InputNodeListenerProxy(const sptr &object); + ~InputNodeListenerProxy() override; - virtual ~InputNodeListenerProxy() override; - - virtual void OnNodeOnLine(const std::string srcDevId, const std::string sinkDevId, + void OnNodeOnLine(const std::string srcDevId, const std::string sinkDevId, const std::string sinkNodeId, const std::string sinkNodeDesc) override; - virtual void OnNodeOffLine(const std::string srcDevId, const std::string sinkDevId, + void OnNodeOffLine(const std::string srcDevId, const std::string sinkDevId, const std::string sinkNodeId) override; private: diff --git a/interfaces/ipc/include/input_node_listener_stub.h b/interfaces/ipc/include/input_node_listener_stub.h index 37a8c29..bf09845 100644 --- a/interfaces/ipc/include/input_node_listener_stub.h +++ b/interfaces/ipc/include/input_node_listener_stub.h @@ -28,7 +28,7 @@ namespace DistributedInput { class InputNodeListenerStub : public IRemoteStub { public: InputNodeListenerStub(); - virtual ~InputNodeListenerStub() override; + ~InputNodeListenerStub() override; int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/interfaces/ipc/include/prepare_d_input_call_back_proxy.h b/interfaces/ipc/include/prepare_d_input_call_back_proxy.h index 991dd6e..9e50268 100644 --- a/interfaces/ipc/include/prepare_d_input_call_back_proxy.h +++ b/interfaces/ipc/include/prepare_d_input_call_back_proxy.h @@ -28,10 +28,9 @@ namespace DistributedInput { class PrepareDInputCallbackProxy : public IRemoteProxy { public: explicit PrepareDInputCallbackProxy(const sptr &object); + ~PrepareDInputCallbackProxy() override; - virtual ~PrepareDInputCallbackProxy() override; - - virtual void OnResult(const std::string& deviceId, const int32_t& status) override; + void OnResult(const std::string& deviceId, const int32_t& status) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/prepare_d_input_call_back_stub.h b/interfaces/ipc/include/prepare_d_input_call_back_stub.h index 437adcf..225e04a 100644 --- a/interfaces/ipc/include/prepare_d_input_call_back_stub.h +++ b/interfaces/ipc/include/prepare_d_input_call_back_stub.h @@ -28,7 +28,7 @@ namespace DistributedInput { class PrepareDInputCallbackStub : public IRemoteStub { public: PrepareDInputCallbackStub(); - virtual ~PrepareDInputCallbackStub() override; + ~PrepareDInputCallbackStub() override; int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/interfaces/ipc/include/register_d_input_call_back_proxy.h b/interfaces/ipc/include/register_d_input_call_back_proxy.h index 76119fd..fc2ab42 100644 --- a/interfaces/ipc/include/register_d_input_call_back_proxy.h +++ b/interfaces/ipc/include/register_d_input_call_back_proxy.h @@ -28,10 +28,9 @@ namespace DistributedInput { class RegisterDInputCallbackProxy : public IRemoteProxy { public: explicit RegisterDInputCallbackProxy(const sptr &object); + ~RegisterDInputCallbackProxy() override; - virtual ~RegisterDInputCallbackProxy() override; - - virtual void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status) override; + void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/register_d_input_call_back_stub.h b/interfaces/ipc/include/register_d_input_call_back_stub.h index 098d44d..a98d28b 100644 --- a/interfaces/ipc/include/register_d_input_call_back_stub.h +++ b/interfaces/ipc/include/register_d_input_call_back_stub.h @@ -28,7 +28,7 @@ namespace DistributedInput { class RegisterDInputCallbackStub : public IRemoteStub { public: RegisterDInputCallbackStub(); - virtual ~RegisterDInputCallbackStub() override; + ~RegisterDInputCallbackStub() override; int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/interfaces/ipc/include/sharing_dhid_listener_proxy.h b/interfaces/ipc/include/sharing_dhid_listener_proxy.h index c9f974c..8e3bcbd 100644 --- a/interfaces/ipc/include/sharing_dhid_listener_proxy.h +++ b/interfaces/ipc/include/sharing_dhid_listener_proxy.h @@ -28,11 +28,10 @@ namespace DistributedInput { class SharingDhIdListenerProxy : public IRemoteProxy { public: explicit SharingDhIdListenerProxy(const sptr &object); + ~SharingDhIdListenerProxy() override; - virtual ~SharingDhIdListenerProxy() override; - - virtual int32_t OnSharing(std::string dhId) override; - virtual int32_t OnNoSharing(std::string dhId) override; + int32_t OnSharing(std::string dhId) override; + int32_t OnNoSharing(std::string dhId) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/sharing_dhid_listener_stub.h b/interfaces/ipc/include/sharing_dhid_listener_stub.h index ba301c7..39af8f7 100644 --- a/interfaces/ipc/include/sharing_dhid_listener_stub.h +++ b/interfaces/ipc/include/sharing_dhid_listener_stub.h @@ -28,7 +28,7 @@ namespace DistributedInput { class SharingDhIdListenerStub : public IRemoteStub { public: SharingDhIdListenerStub(); - virtual ~SharingDhIdListenerStub() override; + ~SharingDhIdListenerStub() override; int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/interfaces/ipc/include/simulation_event_listener_proxy.h b/interfaces/ipc/include/simulation_event_listener_proxy.h index 28a801e..4519a49 100644 --- a/interfaces/ipc/include/simulation_event_listener_proxy.h +++ b/interfaces/ipc/include/simulation_event_listener_proxy.h @@ -28,10 +28,9 @@ namespace DistributedInput { class SimulationEventListenerProxy : public IRemoteProxy { public: explicit SimulationEventListenerProxy(const sptr &object); + ~SimulationEventListenerProxy() override; - virtual ~SimulationEventListenerProxy() override; - - virtual int32_t OnSimulationEvent(uint32_t type, uint32_t code, int32_t value) override; + int32_t OnSimulationEvent(uint32_t type, uint32_t code, int32_t value) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/simulation_event_listener_stub.h b/interfaces/ipc/include/simulation_event_listener_stub.h index aa1c608..c88afc7 100644 --- a/interfaces/ipc/include/simulation_event_listener_stub.h +++ b/interfaces/ipc/include/simulation_event_listener_stub.h @@ -28,7 +28,7 @@ namespace DistributedInput { class SimulationEventListenerStub : public IRemoteStub { public: SimulationEventListenerStub(); - virtual ~SimulationEventListenerStub() override; + ~SimulationEventListenerStub() override; int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/interfaces/ipc/include/start_d_input_call_back_proxy.h b/interfaces/ipc/include/start_d_input_call_back_proxy.h index d58205a..476e9e9 100644 --- a/interfaces/ipc/include/start_d_input_call_back_proxy.h +++ b/interfaces/ipc/include/start_d_input_call_back_proxy.h @@ -28,8 +28,7 @@ namespace DistributedInput { class StartDInputCallbackProxy : public IRemoteProxy { public: explicit StartDInputCallbackProxy(const sptr &object); - - virtual ~StartDInputCallbackProxy() override; + ~StartDInputCallbackProxy() override; virtual void OnResult(const std::string& devId, const uint32_t& inputTypes, const int32_t& status) override; diff --git a/interfaces/ipc/include/start_d_input_call_back_stub.h b/interfaces/ipc/include/start_d_input_call_back_stub.h index 4f28dbf..7c3932a 100644 --- a/interfaces/ipc/include/start_d_input_call_back_stub.h +++ b/interfaces/ipc/include/start_d_input_call_back_stub.h @@ -28,7 +28,7 @@ namespace DistributedInput { class StartDInputCallbackStub : public IRemoteStub { public: StartDInputCallbackStub(); - virtual ~StartDInputCallbackStub() override; + ~StartDInputCallbackStub() override; int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/interfaces/ipc/include/start_stop_d_inputs_call_back_proxy.h b/interfaces/ipc/include/start_stop_d_inputs_call_back_proxy.h index 6511f18..dd10634 100644 --- a/interfaces/ipc/include/start_stop_d_inputs_call_back_proxy.h +++ b/interfaces/ipc/include/start_stop_d_inputs_call_back_proxy.h @@ -27,9 +27,9 @@ namespace DistributedInput { class StartStopDInputsCallbackProxy : public IRemoteProxy { public: explicit StartStopDInputsCallbackProxy(const sptr &object); - virtual ~StartStopDInputsCallbackProxy() override; + ~StartStopDInputsCallbackProxy() override; - virtual void OnResultDhids(const std::string &devId, const int32_t &status) override; + void OnResultDhids(const std::string &devId, const int32_t &status) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/start_stop_d_inputs_call_back_stub.h b/interfaces/ipc/include/start_stop_d_inputs_call_back_stub.h index 3993bbe..809ea2d 100644 --- a/interfaces/ipc/include/start_stop_d_inputs_call_back_stub.h +++ b/interfaces/ipc/include/start_stop_d_inputs_call_back_stub.h @@ -27,7 +27,7 @@ namespace DistributedInput { class StartStopDInputsCallbackStub : public IRemoteStub { public: StartStopDInputsCallbackStub(); - virtual ~StartStopDInputsCallbackStub() override; + ~StartStopDInputsCallbackStub() override; int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/interfaces/ipc/include/start_stop_result_call_back_proxy.h b/interfaces/ipc/include/start_stop_result_call_back_proxy.h index 296d62f..1a9882b 100644 --- a/interfaces/ipc/include/start_stop_result_call_back_proxy.h +++ b/interfaces/ipc/include/start_stop_result_call_back_proxy.h @@ -28,11 +28,11 @@ namespace DistributedInput { class StartStopResultCallbackProxy : public IRemoteProxy { public: explicit StartStopResultCallbackProxy(const sptr &object); - virtual ~StartStopResultCallbackProxy() override; + ~StartStopResultCallbackProxy() override; - virtual void OnStart(const std::string &srcId, const std::string &sinkId, + void OnStart(const std::string &srcId, const std::string &sinkId, std::vector &dhIds) override; - virtual void OnStop(const std::string &srcId, const std::string &sinkId, + void OnStop(const std::string &srcId, const std::string &sinkId, std::vector &dhIds) override; private: diff --git a/interfaces/ipc/include/start_stop_result_call_back_stub.h b/interfaces/ipc/include/start_stop_result_call_back_stub.h index d307798..00e8b1c 100644 --- a/interfaces/ipc/include/start_stop_result_call_back_stub.h +++ b/interfaces/ipc/include/start_stop_result_call_back_stub.h @@ -28,7 +28,7 @@ namespace DistributedInput { class StartStopResultCallbackStub : public IRemoteStub { public: StartStopResultCallbackStub(); - virtual ~StartStopResultCallbackStub() override; + ~StartStopResultCallbackStub() override; int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/interfaces/ipc/include/stop_d_input_call_back_proxy.h b/interfaces/ipc/include/stop_d_input_call_back_proxy.h index 01cfa62..92b28d2 100644 --- a/interfaces/ipc/include/stop_d_input_call_back_proxy.h +++ b/interfaces/ipc/include/stop_d_input_call_back_proxy.h @@ -28,10 +28,9 @@ namespace DistributedInput { class StopDInputCallbackProxy : public IRemoteProxy { public: explicit StopDInputCallbackProxy(const sptr &object); + ~StopDInputCallbackProxy() override; - virtual ~StopDInputCallbackProxy() override; - - virtual void OnResult(const std::string& devId, const uint32_t& inputTypes, const int32_t& status) override; + void OnResult(const std::string& devId, const uint32_t& inputTypes, const int32_t& status) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/stop_d_input_call_back_stub.h b/interfaces/ipc/include/stop_d_input_call_back_stub.h index 51ed24d..3649a27 100644 --- a/interfaces/ipc/include/stop_d_input_call_back_stub.h +++ b/interfaces/ipc/include/stop_d_input_call_back_stub.h @@ -28,7 +28,7 @@ namespace DistributedInput { class StopDInputCallbackStub : public IRemoteStub { public: StopDInputCallbackStub(); - virtual ~StopDInputCallbackStub() override; + ~StopDInputCallbackStub() override; int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/interfaces/ipc/include/unprepare_d_input_call_back_proxy.h b/interfaces/ipc/include/unprepare_d_input_call_back_proxy.h index cbcdac3..bae5928 100644 --- a/interfaces/ipc/include/unprepare_d_input_call_back_proxy.h +++ b/interfaces/ipc/include/unprepare_d_input_call_back_proxy.h @@ -28,10 +28,9 @@ namespace DistributedInput { class UnprepareDInputCallbackProxy : public IRemoteProxy { public: explicit UnprepareDInputCallbackProxy(const sptr &object); + ~UnprepareDInputCallbackProxy() override; - virtual ~UnprepareDInputCallbackProxy() override; - - virtual void OnResult(const std::string& deviceId, const int32_t& status) override; + void OnResult(const std::string& deviceId, const int32_t& status) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/unprepare_d_input_call_back_stub.h b/interfaces/ipc/include/unprepare_d_input_call_back_stub.h index 52dc4d0..5ff3c56 100644 --- a/interfaces/ipc/include/unprepare_d_input_call_back_stub.h +++ b/interfaces/ipc/include/unprepare_d_input_call_back_stub.h @@ -28,7 +28,7 @@ namespace DistributedInput { class UnprepareDInputCallbackStub : public IRemoteStub { public: UnprepareDInputCallbackStub(); - virtual ~UnprepareDInputCallbackStub() override; + ~UnprepareDInputCallbackStub() override; int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/interfaces/ipc/include/unregister_d_input_call_back_proxy.h b/interfaces/ipc/include/unregister_d_input_call_back_proxy.h index dd9cacf..6502ce3 100644 --- a/interfaces/ipc/include/unregister_d_input_call_back_proxy.h +++ b/interfaces/ipc/include/unregister_d_input_call_back_proxy.h @@ -28,10 +28,9 @@ namespace DistributedInput { class UnregisterDInputCallbackProxy : public IRemoteProxy { public: explicit UnregisterDInputCallbackProxy(const sptr &object); + ~UnregisterDInputCallbackProxy() override; - virtual ~UnregisterDInputCallbackProxy() override; - - virtual void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status) override; + void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/unregister_d_input_call_back_stub.h b/interfaces/ipc/include/unregister_d_input_call_back_stub.h index 547c426..7aaaa20 100644 --- a/interfaces/ipc/include/unregister_d_input_call_back_stub.h +++ b/interfaces/ipc/include/unregister_d_input_call_back_stub.h @@ -28,7 +28,7 @@ namespace DistributedInput { class UnregisterDInputCallbackStub : public IRemoteStub { public: UnregisterDInputCallbackStub(); - virtual ~UnregisterDInputCallbackStub() override; + ~UnregisterDInputCallbackStub() override; int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; diff --git a/interfaces/ipc/src/distributed_input_client.cpp b/interfaces/ipc/src/distributed_input_client.cpp index 60bcfe6..5412b47 100644 --- a/interfaces/ipc/src/distributed_input_client.cpp +++ b/interfaces/ipc/src/distributed_input_client.cpp @@ -211,7 +211,7 @@ void DistributedInputClient::CheckWhiteListCallback() } } if (!isDelWhiteListCbReg) { - sptr delCallback= new (std::nothrow) DelWhiteListInfosCb(); + sptr delCallback = new (std::nothrow) DelWhiteListInfosCb(); int32_t ret = DInputSAManager::GetInstance().dInputSourceProxy_->RegisterDelWhiteListCallback(delCallback); if (ret == DH_SUCCESS) { diff --git a/services/common/include/dinput_sink_trans_callback.h b/services/common/include/dinput_sink_trans_callback.h index d98d59b..64d226c 100644 --- a/services/common/include/dinput_sink_trans_callback.h +++ b/services/common/include/dinput_sink_trans_callback.h @@ -23,24 +23,24 @@ namespace DistributedHardware { namespace DistributedInput { class DInputSinkTransCallback { public: - virtual void onPrepareRemoteInput(const int32_t& sessionId, const std::string &deviceId) = 0; - virtual void onUnprepareRemoteInput(const int32_t& sessionId) = 0; - virtual void onStartRemoteInput(const int32_t& sessionId, const uint32_t& inputTypes) = 0; - virtual void onStopRemoteInput(const int32_t& sessionId, const uint32_t& inputTypes) = 0; - virtual void onStartRemoteInputDhid(const int32_t &sessionId, const std::string &strDhids) = 0; - virtual void onStopRemoteInputDhid(const int32_t &sessionId, const std::string &strDhids) = 0; + virtual void OnPrepareRemoteInput(const int32_t& sessionId, const std::string &deviceId) = 0; + virtual void OnUnprepareRemoteInput(const int32_t& sessionId) = 0; + virtual void OnStartRemoteInput(const int32_t& sessionId, const uint32_t& inputTypes) = 0; + virtual void OnStopRemoteInput(const int32_t& sessionId, const uint32_t& inputTypes) = 0; + virtual void OnStartRemoteInputDhid(const int32_t &sessionId, const std::string &strDhids) = 0; + virtual void OnStopRemoteInputDhid(const int32_t &sessionId, const std::string &strDhids) = 0; - virtual void onRelayPrepareRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, + virtual void OnRelayPrepareRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, const std::string &deviceId) = 0; - virtual void onRelayUnprepareRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, + virtual void OnRelayUnprepareRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, const std::string &deviceId) = 0; - virtual void onRelayStartDhidRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, + virtual void OnRelayStartDhidRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, const std::string &deviceId, const std::string &strDhids) = 0; - virtual void onRelayStopDhidRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, + virtual void OnRelayStopDhidRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, const std::string &deviceId, const std::string &strDhids) = 0; - virtual void onRelayStartTypeRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, + virtual void OnRelayStartTypeRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, const std::string &deviceId, uint32_t inputTypes) = 0; - virtual void onRelayStopTypeRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, + virtual void OnRelayStopTypeRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, const std::string &deviceId, uint32_t inputTypes) = 0; virtual ~DInputSinkTransCallback() {} }; diff --git a/services/common/include/dinput_source_trans_callback.h b/services/common/include/dinput_source_trans_callback.h index 23a1e64..58a6487 100644 --- a/services/common/include/dinput_source_trans_callback.h +++ b/services/common/include/dinput_source_trans_callback.h @@ -23,31 +23,31 @@ namespace DistributedHardware { namespace DistributedInput { class DInputSourceTransCallback { public: - virtual void onResponseRegisterDistributedHardware(const std::string deviceId, const std::string dhId, + virtual void OnResponseRegisterDistributedHardware(const std::string deviceId, const std::string dhId, bool result) = 0; - virtual void onResponsePrepareRemoteInput(const std::string deviceId, bool result, const std::string &object) = 0; - virtual void onResponseUnprepareRemoteInput(const std::string deviceId, bool result) = 0; - virtual void onResponseStartRemoteInput(const std::string deviceId, const uint32_t inputTypes, bool result) = 0; - virtual void onResponseStopRemoteInput(const std::string deviceId, const uint32_t inputTypes, bool result) = 0; - virtual void onResponseStartRemoteInputDhid(const std::string deviceId, const std::string &dhids, bool result) = 0; - virtual void onResponseStopRemoteInputDhid(const std::string deviceId, const std::string &dhids, bool result) = 0; - virtual void onResponseKeyState(const std::string deviceId, const std::string &dhid, const uint32_t type, + virtual void OnResponsePrepareRemoteInput(const std::string deviceId, bool result, const std::string &object) = 0; + virtual void OnResponseUnprepareRemoteInput(const std::string deviceId, bool result) = 0; + virtual void OnResponseStartRemoteInput(const std::string deviceId, const uint32_t inputTypes, bool result) = 0; + virtual void OnResponseStopRemoteInput(const std::string deviceId, const uint32_t inputTypes, bool result) = 0; + virtual void OnResponseStartRemoteInputDhid(const std::string deviceId, const std::string &dhids, bool result) = 0; + virtual void OnResponseStopRemoteInputDhid(const std::string deviceId, const std::string &dhids, bool result) = 0; + virtual void OnResponseKeyState(const std::string deviceId, const std::string &dhid, const uint32_t type, const uint32_t code, const uint32_t value) = 0; - virtual void onReceivedEventRemoteInput(const std::string deviceId, const std::string &object) = 0; + virtual void OnReceivedEventRemoteInput(const std::string deviceId, const std::string &object) = 0; - virtual void onResponseRelayPrepareRemoteInput(int32_t sessionId, const std::string &deviceId, bool result, + virtual void OnResponseRelayPrepareRemoteInput(int32_t sessionId, const std::string &deviceId, bool result, const std::string &object) = 0; - virtual void onResponseRelayUnprepareRemoteInput(int32_t sessionId, const std::string &deviceId, bool result) = 0; + virtual void OnResponseRelayUnprepareRemoteInput(int32_t sessionId, const std::string &deviceId, bool result) = 0; - virtual void onReceiveRelayPrepareResult(int32_t status, const std::string &srcId, const std::string &sinkId) = 0; - virtual void onReceiveRelayUnprepareResult(int32_t status, const std::string &srcId, const std::string &sinkId) = 0; - virtual void onReceiveRelayStartDhidResult(int32_t status, const std::string &srcId, const std::string &sinkId, + virtual void OnReceiveRelayPrepareResult(int32_t status, const std::string &srcId, const std::string &sinkId) = 0; + virtual void OnReceiveRelayUnprepareResult(int32_t status, const std::string &srcId, const std::string &sinkId) = 0; + virtual void OnReceiveRelayStartDhidResult(int32_t status, const std::string &srcId, const std::string &sinkId, const std::string &dhids) = 0; - virtual void onReceiveRelayStopDhidResult(int32_t status, const std::string &srcId, const std::string &sinkId, + virtual void OnReceiveRelayStopDhidResult(int32_t status, const std::string &srcId, const std::string &sinkId, const std::string &dhids) = 0; - virtual void onReceiveRelayStartTypeResult(int32_t status, const std::string &srcId, const std::string &sinkId, + virtual void OnReceiveRelayStartTypeResult(int32_t status, const std::string &srcId, const std::string &sinkId, uint32_t inputTypes) = 0; - virtual void onReceiveRelayStopTypeResult(int32_t status, const std::string &srcId, const std::string &sinkId, + virtual void OnReceiveRelayStopTypeResult(int32_t status, const std::string &srcId, const std::string &sinkId, uint32_t inputTypes) = 0; }; } // namespace DistributedInput diff --git a/services/sink/sinkmanager/include/distributed_input_sink_event_handler.h b/services/sink/sinkmanager/include/distributed_input_sink_event_handler.h index 0156fd9..3791306 100644 --- a/services/sink/sinkmanager/include/distributed_input_sink_event_handler.h +++ b/services/sink/sinkmanager/include/distributed_input_sink_event_handler.h @@ -26,8 +26,8 @@ namespace DistributedHardware { namespace DistributedInput { class DistributedInputSinkEventHandler : public AppExecFwk::EventHandler { public: - DistributedInputSinkEventHandler(const std::shared_ptr &runner); - virtual ~DistributedInputSinkEventHandler(); + explicit DistributedInputSinkEventHandler(const std::shared_ptr &runner); + ~DistributedInputSinkEventHandler() override; bool ProxyPostTask(const Callback &callback, int64_t delayTime); diff --git a/services/sink/sinkmanager/include/distributed_input_sink_manager.h b/services/sink/sinkmanager/include/distributed_input_sink_manager.h index 6e65034..172906d 100644 --- a/services/sink/sinkmanager/include/distributed_input_sink_manager.h +++ b/services/sink/sinkmanager/include/distributed_input_sink_manager.h @@ -49,35 +49,35 @@ class DistributedInputSinkManager : public SystemAbility, public DistributedInpu public: DistributedInputSinkManager(int32_t saId, bool runOnCreate); - ~DistributedInputSinkManager(); + ~DistributedInputSinkManager() override; class DInputSinkListener : public DInputSinkTransCallback { public: - DInputSinkListener(DistributedInputSinkManager *manager); - ~DInputSinkListener(); - void onPrepareRemoteInput(const int32_t& sessionId, const std::string &deviceId); - void onUnprepareRemoteInput(const int32_t& sessionId); - void onStartRemoteInput(const int32_t& sessionId, const uint32_t& inputTypes); - void onStopRemoteInput(const int32_t& sessionId, const uint32_t& inputTypes); - void onStartRemoteInputDhid(const int32_t &sessionId, const std::string &strDhids); - void onStopRemoteInputDhid(const int32_t &sessionId, const std::string &strDhids); + explicit DInputSinkListener(DistributedInputSinkManager *manager); + ~DInputSinkListener() override; + void OnPrepareRemoteInput(const int32_t& sessionId, const std::string &deviceId) override; + void OnUnprepareRemoteInput(const int32_t& sessionId) override; + void OnStartRemoteInput(const int32_t& sessionId, const uint32_t& inputTypes) override; + void OnStopRemoteInput(const int32_t& sessionId, const uint32_t& inputTypes) override; + void OnStartRemoteInputDhid(const int32_t &sessionId, const std::string &strDhids) override; + void OnStopRemoteInputDhid(const int32_t &sessionId, const std::string &strDhids) override; - void onRelayPrepareRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, - const std::string &deviceId); - void onRelayUnprepareRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, - const std::string &deviceId); - void onRelayStartDhidRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, - const std::string &deviceId, const std::string &strDhids); - void onRelayStopDhidRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, - const std::string &deviceId, const std::string &strDhids); - void onRelayStartTypeRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, - const std::string &deviceId, uint32_t inputTypes); - void onRelayStopTypeRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, - const std::string &deviceId, uint32_t inputTypes); + void OnRelayPrepareRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, + const std::string &deviceId) override; + void OnRelayUnprepareRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, + const std::string &deviceId) override; + void OnRelayStartDhidRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, + const std::string &deviceId, const std::string &strDhids) override; + void OnRelayStopDhidRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, + const std::string &deviceId, const std::string &strDhids) override; + void OnRelayStartTypeRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, + const std::string &deviceId, uint32_t inputTypes) override; + void OnRelayStopTypeRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, + const std::string &deviceId, uint32_t inputTypes) override; private: DistributedInputSinkManager *sinkManagerObj_; - static inline int bit_is_set(const unsigned long *array, int bit) + static inline int BitIsSet(const unsigned long *array, int bit) { return !!(array[bit / LONG_BITS] & (1LL << (bit % LONG_BITS))); } @@ -88,8 +88,8 @@ public: class ProjectWindowListener : public PublisherListenerStub { public: - ProjectWindowListener(DistributedInputSinkManager *manager); - ~ProjectWindowListener(); + explicit ProjectWindowListener(DistributedInputSinkManager *manager); + ~ProjectWindowListener() override; void OnMessage(const DHTopic topic, const std::string& message) override; private: @@ -109,7 +109,7 @@ public: class DScreenSinkSvrRecipient : public IRemoteObject::DeathRecipient { public: DScreenSinkSvrRecipient(const std::string& srcDevId, const uint64_t srcWinId); - ~DScreenSinkSvrRecipient(); + ~DScreenSinkSvrRecipient() override; void OnRemoteDied(const wptr &remote) override; private: @@ -122,11 +122,11 @@ public: void OnStop() override; - virtual int32_t Init() override; + int32_t Init() override; - virtual int32_t Release() override; + int32_t Release() override; - virtual int32_t RegisterGetSinkScreenInfosCallback(sptr callback) override; + int32_t RegisterGetSinkScreenInfosCallback(sptr callback) override; uint32_t GetSinkScreenInfosCbackSize(); @@ -136,7 +136,7 @@ public: uint32_t GetInputTypes(); - void SetInputTypes(const uint32_t& inputTypess); + void SetInputTypes(const uint32_t& inputTypes); /* * GetEventHandler, get the ui_service manager service's handler. diff --git a/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp b/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp index 62523ce..06cd429 100644 --- a/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp +++ b/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp @@ -74,10 +74,10 @@ DistributedInputSinkManager::DInputSinkListener::~DInputSinkListener() DHLOGI("DInputSinkListener destory."); } -void DistributedInputSinkManager::DInputSinkListener::onPrepareRemoteInput( +void DistributedInputSinkManager::DInputSinkListener::OnPrepareRemoteInput( const int32_t& sessionId, const std::string &deviceId) { - DHLOGI("onPrepareRemoteInput called, sessionId: %d, devId: %s", sessionId, GetAnonyString(deviceId).c_str()); + DHLOGI("OnPrepareRemoteInput called, sessionId: %d, devId: %s", sessionId, GetAnonyString(deviceId).c_str()); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SINK_MSG_ONPREPARE; @@ -104,7 +104,7 @@ void DistributedInputSinkManager::DInputSinkListener::onPrepareRemoteInput( DHLOGE("query local network id from softbus failed"); } if (vecFilter.empty() || vecFilter[0].empty() || vecFilter[0][0].empty()) { - DHLOGE("onPrepareRemoteInput called, white list is null."); + DHLOGE("OnPrepareRemoteInput called, white list is null."); jsonStr[DINPUT_SOFTBUS_KEY_RESP_VALUE] = true; jsonStr[DINPUT_SOFTBUS_KEY_WHITE_LIST] = ""; smsg = jsonStr.dump(); @@ -119,10 +119,10 @@ void DistributedInputSinkManager::DInputSinkListener::onPrepareRemoteInput( DistributedInputSinkTransport::GetInstance().RespPrepareRemoteInput(sessionId, smsg); } -void DistributedInputSinkManager::DInputSinkListener::onUnprepareRemoteInput(const int32_t& sessionId) +void DistributedInputSinkManager::DInputSinkListener::OnUnprepareRemoteInput(const int32_t& sessionId) { - DHLOGI("onUnprepareRemoteInput called, sessionId: %d", sessionId); - onStopRemoteInput(sessionId, static_cast(DInputDeviceType::ALL)); + DHLOGI("OnUnprepareRemoteInput called, sessionId: %d", sessionId); + OnStopRemoteInput(sessionId, static_cast(DInputDeviceType::ALL)); DistributedInputSinkSwitch::GetInstance().RemoveSession(sessionId); nlohmann::json jsonStr; @@ -132,7 +132,7 @@ void DistributedInputSinkManager::DInputSinkListener::onUnprepareRemoteInput(con DistributedInputSinkTransport::GetInstance().RespUnprepareRemoteInput(sessionId, smsg); } -void DistributedInputSinkManager::DInputSinkListener::onRelayPrepareRemoteInput(const int32_t &toSrcSessionId, +void DistributedInputSinkManager::DInputSinkListener::OnRelayPrepareRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, const std::string &deviceId) { DHLOGI("toSinkSessionId: %s, devId: %s", GetAnonyInt32(toSinkSessionId).c_str(), GetAnonyString(deviceId).c_str()); @@ -178,7 +178,7 @@ void DistributedInputSinkManager::DInputSinkListener::onRelayPrepareRemoteInput( DistributedInputSinkTransport::GetInstance().RespPrepareRemoteInput(toSinkSessionId, smsg); } -void DistributedInputSinkManager::DInputSinkListener::onRelayUnprepareRemoteInput(const int32_t &toSrcSessionId, +void DistributedInputSinkManager::DInputSinkListener::OnRelayUnprepareRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, const std::string &deviceId) { DHLOGI("toSinkSessionId: %d, devId: %s", toSinkSessionId, GetAnonyString(deviceId).c_str()); @@ -194,11 +194,11 @@ void DistributedInputSinkManager::DInputSinkListener::onRelayUnprepareRemoteInpu DistributedInputSinkTransport::GetInstance().RespUnprepareRemoteInput(toSinkSessionId, smsg); } -void DistributedInputSinkManager::DInputSinkListener::onStartRemoteInput( +void DistributedInputSinkManager::DInputSinkListener::OnStartRemoteInput( const int32_t& sessionId, const uint32_t& inputTypes) { int32_t curSessionId = DistributedInputSinkSwitch::GetInstance().GetSwitchOpenedSession(); - DHLOGI("onStartRemoteInput called, cursessionId: %d, new sessionId: %d", curSessionId, sessionId); + DHLOGI("OnStartRemoteInput called, cursessionId: %d, new sessionId: %d", curSessionId, sessionId); // set new session int32_t startRes = DistributedInputSinkSwitch::GetInstance().StartSwitch(sessionId); @@ -235,10 +235,10 @@ void DistributedInputSinkManager::DInputSinkListener::onStartRemoteInput( } } -void DistributedInputSinkManager::DInputSinkListener::onStopRemoteInput( +void DistributedInputSinkManager::DInputSinkListener::OnStopRemoteInput( const int32_t& sessionId, const uint32_t& inputTypes) { - DHLOGI("onStopRemoteInput called, sessionId: %d, inputTypes: %d, curInputTypes: %d", + DHLOGI("OnStopRemoteInput called, sessionId: %d, inputTypes: %d, curInputTypes: %d", sessionId, inputTypes, sinkManagerObj_->GetInputTypes()); sinkManagerObj_->SetInputTypes(sinkManagerObj_->GetInputTypes() - @@ -268,11 +268,11 @@ void DistributedInputSinkManager::DInputSinkListener::onStopRemoteInput( } } -void DistributedInputSinkManager::DInputSinkListener::onStartRemoteInputDhid(const int32_t &sessionId, +void DistributedInputSinkManager::DInputSinkListener::OnStartRemoteInputDhid(const int32_t &sessionId, const std::string &strDhids) { int32_t curSessionId = DistributedInputSinkSwitch::GetInstance().GetSwitchOpenedSession(); - DHLOGE("onStartRemoteInputDhid called, cursessionId: %d, new sessionId: %d", + DHLOGE("OnStartRemoteInputDhid called, cursessionId: %d, new sessionId: %d", curSessionId, sessionId); // set new session int32_t startRes = DistributedInputSinkSwitch::GetInstance().StartSwitch(sessionId); @@ -285,12 +285,12 @@ void DistributedInputSinkManager::DInputSinkListener::onStartRemoteInputDhid(con DistributedInputSinkTransport::GetInstance().RespStartRemoteInput(sessionId, smsgSta); if (startRes != DH_SUCCESS) { - DHLOGE("onStartRemoteInputDhid StartSwitch error."); + DHLOGE("OnStartRemoteInputDhid StartSwitch error."); return; } if (curSessionId == ERR_DH_INPUT_SERVER_SINK_GET_OPEN_SESSION_FAIL) { - DHLOGW("onStartRemoteInputDhid called, this is the only session."); + DHLOGW("OnStartRemoteInputDhid called, this is the only session."); } std::thread(&DistributedInputSinkManager::DInputSinkListener::CheckKeyState, this, sessionId, strDhids).detach(); @@ -304,10 +304,10 @@ void DistributedInputSinkManager::DInputSinkListener::onStartRemoteInputDhid(con } } -void DistributedInputSinkManager::DInputSinkListener::onStopRemoteInputDhid(const int32_t &sessionId, +void DistributedInputSinkManager::DInputSinkListener::OnStopRemoteInputDhid(const int32_t &sessionId, const std::string &strDhids) { - DHLOGI("onStopRemoteInputDhid called, sessionId: %d", sessionId); + DHLOGI("OnStopRemoteInputDhid called, sessionId: %d", sessionId); std::vector stopIndeedDhIds; std::vector stopOnCmdDhIds; StringSplit(strDhids, INPUT_STRING_SPLIT_POINT, stopOnCmdDhIds); @@ -318,7 +318,7 @@ void DistributedInputSinkManager::DInputSinkListener::onStopRemoteInputDhid(cons DistributedInputCollector::GetInstance().ReportDhIdSharingState(stopIndeedOnes); if (DistributedInputCollector::GetInstance().IsAllDevicesStoped()) { - DHLOGE("onStopRemoteInputDhid called, all dhid stop sharing, sessionId: %d is closed.", sessionId); + DHLOGE("OnStopRemoteInputDhid called, all dhid stop sharing, sessionId: %d is closed.", sessionId); DistributedInputSinkSwitch::GetInstance().StopSwitch(sessionId); } @@ -341,7 +341,7 @@ void DistributedInputSinkManager::DInputSinkListener::onStopRemoteInputDhid(cons } } -void DistributedInputSinkManager::DInputSinkListener::onRelayStartDhidRemoteInput(const int32_t &toSrcSessionId, +void DistributedInputSinkManager::DInputSinkListener::OnRelayStartDhidRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, const std::string &deviceId, const std::string &strDhids) { int32_t curSessionId = DistributedInputSinkSwitch::GetInstance().GetSwitchOpenedSession(); @@ -379,7 +379,7 @@ void DistributedInputSinkManager::DInputSinkListener::onRelayStartDhidRemoteInpu } } -void DistributedInputSinkManager::DInputSinkListener::onRelayStopDhidRemoteInput(const int32_t &toSrcSessionId, +void DistributedInputSinkManager::DInputSinkListener::OnRelayStopDhidRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, const std::string &deviceId, const std::string &strDhids) { DHLOGI("toSinkSessionId: %d", toSinkSessionId); @@ -393,7 +393,7 @@ void DistributedInputSinkManager::DInputSinkListener::onRelayStopDhidRemoteInput DistributedInputCollector::GetInstance().ReportDhIdSharingState(stopIndeedOnes); if (DistributedInputCollector::GetInstance().IsAllDevicesStoped()) { - DHLOGE("onStopRemoteInputDhid called, all dhid stop sharing, sessionId: %d is closed.", toSinkSessionId); + DHLOGE("OnStopRemoteInputDhid called, all dhid stop sharing, sessionId: %d is closed.", toSinkSessionId); DistributedInputSinkSwitch::GetInstance().StopSwitch(toSinkSessionId); } @@ -411,13 +411,13 @@ void DistributedInputSinkManager::DInputSinkListener::onRelayStopDhidRemoteInput sinkManagerObj_->SetInputTypes(static_cast(DInputDeviceType::NONE)); if (DistributedInputSinkSwitch::GetInstance().GetSwitchOpenedSession() == ERR_DH_INPUT_SERVER_SINK_GET_OPEN_SESSION_FAIL) { - DHLOGI("onStartRemoteInput called, all session is stop."); + DHLOGI("OnStartRemoteInput called, all session is stop."); sinkManagerObj_->SetStartTransFlag(DInputServerType::NULL_SERVER_TYPE); } } } -void DistributedInputSinkManager::DInputSinkListener::onRelayStartTypeRemoteInput(const int32_t &toSrcSessionId, +void DistributedInputSinkManager::DInputSinkListener::OnRelayStartTypeRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, const std::string &deviceId, uint32_t inputTypes) { int32_t curSessionId = DistributedInputSinkSwitch::GetInstance().GetSwitchOpenedSession(); @@ -461,10 +461,10 @@ void DistributedInputSinkManager::DInputSinkListener::onRelayStartTypeRemoteInpu } } -void DistributedInputSinkManager::DInputSinkListener::onRelayStopTypeRemoteInput(const int32_t &toSrcSessionId, +void DistributedInputSinkManager::DInputSinkListener::OnRelayStopTypeRemoteInput(const int32_t &toSrcSessionId, const int32_t &toSinkSessionId, const std::string &deviceId, uint32_t inputTypes) { - DHLOGI("onStopRemoteInput called, sessionId: %d, inputTypes: %d, curInputTypes: %d", + DHLOGI("OnStopRemoteInput called, sessionId: %d, inputTypes: %d, curInputTypes: %d", toSinkSessionId, inputTypes, sinkManagerObj_->GetInputTypes()); sinkManagerObj_->SetInputTypes(sinkManagerObj_->GetInputTypes() - @@ -556,15 +556,15 @@ void DistributedInputSinkManager::DInputSinkListener::CheckKeyState(const int32_ SleepTimeMs(); continue; } - leftKeyVal = bit_is_set(keystate, BTN_LEFT); + leftKeyVal = BitIsSet(keystate, BTN_LEFT); if (leftKeyVal != 0) { DistributedInputSinkTransport::GetInstance().SendKeyStateNodeMsg(sessionId, dhid, BTN_LEFT); } - rightKeyVal = bit_is_set(keystate, BTN_RIGHT); + rightKeyVal = BitIsSet(keystate, BTN_RIGHT); if (rightKeyVal != 0) { DistributedInputSinkTransport::GetInstance().SendKeyStateNodeMsg(sessionId, dhid, BTN_RIGHT); } - midKeyVal = bit_is_set(keystate, BTN_MIDDLE); + midKeyVal = BitIsSet(keystate, BTN_MIDDLE); if (midKeyVal != 0) { DistributedInputSinkTransport::GetInstance().SendKeyStateNodeMsg(sessionId, dhid, BTN_MIDDLE); } @@ -774,7 +774,7 @@ DInputServerType DistributedInputSinkManager::GetStartTransFlag() } void DistributedInputSinkManager::SetStartTransFlag(const DInputServerType flag) { - DHLOGI("Set Sink isStartTrans_ %d", (int32_t)flag); + DHLOGI("Set Sink isStartTrans_ %d", static_cast(flag)); isStartTrans_ = flag; } @@ -894,8 +894,8 @@ int32_t DistributedInputSinkManager::ProjectWindowListener::UpdateSinkScreenInfo sinkScreenInfo.sinkShowWidth = GetScreenWidth(); sinkScreenInfo.sinkShowHeight = GetScreenHeight(); LocalAbsInfo info = DInputContext::GetInstance().GetLocalTouchScreenInfo().localAbsInfo; - sinkScreenInfo.sinkPhyWidth = (uint32_t)(info.absMtPositionXMax + 1); - sinkScreenInfo.sinkPhyHeight = (uint32_t)(info.absMtPositionYMax + 1); + sinkScreenInfo.sinkPhyWidth = static_cast(info.absMtPositionXMax + 1); + sinkScreenInfo.sinkPhyHeight = static_cast(info.absMtPositionYMax + 1); DHLOGI("sinkShowWinId: %d, sinkProjShowWidth: %d, sinkProjShowHeight: %d, sinkWinShowX: %d, sinkWinShowY: %d," "sinkShowWidth: %d, sinkShowHeight: %d, sinkPhyWidth: %d, sinkPhyHeight: %d", sinkScreenInfo.sinkShowWinId, sinkScreenInfo.sinkProjShowWidth, sinkScreenInfo.sinkProjShowHeight, sinkScreenInfo.sinkWinShowX, diff --git a/services/sink/transport/include/distributed_input_sink_transport.h b/services/sink/transport/include/distributed_input_sink_transport.h index e50942b..12679a5 100644 --- a/services/sink/transport/include/distributed_input_sink_transport.h +++ b/services/sink/transport/include/distributed_input_sink_transport.h @@ -54,8 +54,8 @@ public: class DInputSinkEventHandler : public AppExecFwk::EventHandler { public: - DInputSinkEventHandler(const std::shared_ptr &runner); - ~DInputSinkEventHandler() {} + explicit DInputSinkEventHandler(const std::shared_ptr &runner); + ~DInputSinkEventHandler() override = default; void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) override; void RecordEventLog(const std::shared_ptr &events); diff --git a/services/sink/transport/src/distributed_input_sink_transport.cpp b/services/sink/transport/src/distributed_input_sink_transport.cpp index 1dac7b4..500afa8 100644 --- a/services/sink/transport/src/distributed_input_sink_transport.cpp +++ b/services/sink/transport/src/distributed_input_sink_transport.cpp @@ -411,7 +411,7 @@ void DistributedInputSinkTransport::NotifyPrepareRemoteInput(int32_t sessionId, std::string deviceId = recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID]; DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_PREPARE deviceId:%s.", GetAnonyString(deviceId).c_str()); - callback_->onPrepareRemoteInput(sessionId, deviceId); + callback_->OnPrepareRemoteInput(sessionId, deviceId); } void DistributedInputSinkTransport::NotifyUnprepareRemoteInput(int32_t sessionId, const nlohmann::json &recMsg) @@ -423,7 +423,7 @@ void DistributedInputSinkTransport::NotifyUnprepareRemoteInput(int32_t sessionId std::string deviceId = recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID]; DHLOGI("OnBytesReceived cmdType TRANS_SOURCE_MSG_UNPREPARE deviceId:%s.", GetAnonyString(deviceId).c_str()); - callback_->onUnprepareRemoteInput(sessionId); + callback_->OnUnprepareRemoteInput(sessionId); } void DistributedInputSinkTransport::NotifyStartRemoteInput(int32_t sessionId, const nlohmann::json &recMsg) @@ -436,7 +436,7 @@ void DistributedInputSinkTransport::NotifyStartRemoteInput(int32_t sessionId, co uint32_t inputTypes = recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE]; DHLOGI("OnBytesRecei,ved cmdType is TRANS_SOURCE_MSG_START_TYPE deviceId:%s inputTypes:%d .", GetAnonyString(deviceId).c_str(), inputTypes); - callback_->onStartRemoteInput(sessionId, inputTypes); + callback_->OnStartRemoteInput(sessionId, inputTypes); } void DistributedInputSinkTransport::NotifyStopRemoteInput(int32_t sessionId, const nlohmann::json &recMsg) @@ -448,7 +448,7 @@ void DistributedInputSinkTransport::NotifyStopRemoteInput(int32_t sessionId, con std::string deviceId = recMsg[DINPUT_SOFTBUS_KEY_DEVICE_ID]; uint32_t inputTypes = recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE]; DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_STOP_TYPE deviceId:%s.", GetAnonyString(deviceId).c_str()); - callback_->onStopRemoteInput(sessionId, inputTypes); + callback_->OnStopRemoteInput(sessionId, inputTypes); } void DistributedInputSinkTransport::NotifyLatency(int32_t sessionId, const nlohmann::json &recMsg) @@ -486,7 +486,7 @@ void DistributedInputSinkTransport::NotifyStartRemoteInputDhid(int32_t sessionId std::string strTmp = recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID]; DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_START_DHID deviceId:%s .", GetAnonyString(deviceId).c_str()); - callback_->onStartRemoteInputDhid(sessionId, strTmp); + callback_->OnStartRemoteInputDhid(sessionId, strTmp); } void DistributedInputSinkTransport::NotifyStopRemoteInputDhid(int32_t sessionId, const nlohmann::json &recMsg) @@ -505,7 +505,7 @@ void DistributedInputSinkTransport::NotifyStopRemoteInputDhid(int32_t sessionId, std::string strTmp = recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID]; DHLOGE("OnBytesReceived cmdType is TRANS_SOURCE_MSG_STOP_DHID deviceId:%s.", GetAnonyString(deviceId).c_str()); - callback_->onStopRemoteInputDhid(sessionId, strTmp); + callback_->OnStopRemoteInputDhid(sessionId, strTmp); } void DistributedInputSinkTransport::NotifyRelayPrepareRemoteInput(int32_t sessionId, const nlohmann::json &recMsg) @@ -522,7 +522,7 @@ void DistributedInputSinkTransport::NotifyRelayPrepareRemoteInput(int32_t sessio int32_t toSrcSessionId = recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID]; DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_PREPARE_FOR_REL deviceId:%s.", GetAnonyString(deviceId).c_str()); - callback_->onRelayPrepareRemoteInput(toSrcSessionId, sessionId, deviceId); + callback_->OnRelayPrepareRemoteInput(toSrcSessionId, sessionId, deviceId); } void DistributedInputSinkTransport::NotifyRelayUnprepareRemoteInput(int32_t sessionId, const nlohmann::json &recMsg) @@ -539,7 +539,7 @@ void DistributedInputSinkTransport::NotifyRelayUnprepareRemoteInput(int32_t sess int32_t toSrcSessionId = recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID]; DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_UNPREPARE_FOR_REL deviceId:%s.", GetAnonyString(deviceId).c_str()); - callback_->onRelayUnprepareRemoteInput(toSrcSessionId, sessionId, deviceId); + callback_->OnRelayUnprepareRemoteInput(toSrcSessionId, sessionId, deviceId); } void DistributedInputSinkTransport::NotifyRelayStartDhidRemoteInput(int32_t sessionId, const nlohmann::json &recMsg) @@ -561,7 +561,7 @@ void DistributedInputSinkTransport::NotifyRelayStartDhidRemoteInput(int32_t sess std::string dhids = recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID]; DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_START_DHID_FOR_REL deviceId:%s.", GetAnonyString(deviceId).c_str()); - callback_->onRelayStartDhidRemoteInput(toSrcSessionId, sessionId, deviceId, dhids); + callback_->OnRelayStartDhidRemoteInput(toSrcSessionId, sessionId, deviceId, dhids); } void DistributedInputSinkTransport::NotifyRelayStopDhidRemoteInput(int32_t sessionId, const nlohmann::json &recMsg) @@ -583,7 +583,7 @@ void DistributedInputSinkTransport::NotifyRelayStopDhidRemoteInput(int32_t sessi std::string dhids = recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID]; DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_STOP_DHID_FOR_REL deviceId:%s.", GetAnonyString(deviceId).c_str()); - callback_->onRelayStopDhidRemoteInput(toSrcSessionId, sessionId, deviceId, dhids); + callback_->OnRelayStopDhidRemoteInput(toSrcSessionId, sessionId, deviceId, dhids); } void DistributedInputSinkTransport::NotifyRelayStartTypeRemoteInput(int32_t sessionId, const nlohmann::json &recMsg) @@ -605,7 +605,7 @@ void DistributedInputSinkTransport::NotifyRelayStartTypeRemoteInput(int32_t sess uint32_t inputTypes = recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE]; DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_START_TYPE_FOR_REL deviceId:%s.", GetAnonyString(deviceId).c_str()); - callback_->onRelayStartTypeRemoteInput(toSrcSessionId, sessionId, deviceId, inputTypes); + callback_->OnRelayStartTypeRemoteInput(toSrcSessionId, sessionId, deviceId, inputTypes); } void DistributedInputSinkTransport::NotifyRelayStopTypeRemoteInput(int32_t sessionId, const nlohmann::json &recMsg) @@ -627,7 +627,7 @@ void DistributedInputSinkTransport::NotifyRelayStopTypeRemoteInput(int32_t sessi uint32_t inputTypes = recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE]; DHLOGI("OnBytesReceived cmdType is TRANS_SOURCE_MSG_STOP_TYPE_FOR_REL deviceId:%s.", GetAnonyString(deviceId).c_str()); - callback_->onRelayStopTypeRemoteInput(toSrcSessionId, sessionId, deviceId, inputTypes); + callback_->OnRelayStopTypeRemoteInput(toSrcSessionId, sessionId, deviceId, inputTypes); } void DistributedInputSinkTransport::HandleSessionData(int32_t sessionId, const std::string& message) diff --git a/services/source/inputinject/include/distributed_input_inject.h b/services/source/inputinject/include/distributed_input_inject.h index 5ec3648..0da45f7 100644 --- a/services/source/inputinject/include/distributed_input_inject.h +++ b/services/source/inputinject/include/distributed_input_inject.h @@ -64,9 +64,6 @@ private: std::mutex inputNodeManagerMutex_; std::set> inputNodeListeners_; std::mutex inputNodeListenersMutex_; - - // The event queue. - static const int EVENT_BUFFER_SIZE = 16; }; } // namespace DistributedInput } // namespace DistributedHardware diff --git a/services/source/inputinject/include/virtual_device.h b/services/source/inputinject/include/virtual_device.h index d7dba66..a7bc086 100644 --- a/services/source/inputinject/include/virtual_device.h +++ b/services/source/inputinject/include/virtual_device.h @@ -34,7 +34,7 @@ namespace DistributedHardware { namespace DistributedInput { class VirtualDevice { public: - VirtualDevice(const InputDevice& event); + explicit VirtualDevice(const InputDevice& event); virtual ~VirtualDevice(); bool DoIoctl(int32_t fd, int32_t request, const uint32_t value); bool CreateKey(); diff --git a/services/source/inputinject/include/virtual_keyboard.h b/services/source/inputinject/include/virtual_keyboard.h index 2d3da1a..a2bcf5a 100644 --- a/services/source/inputinject/include/virtual_keyboard.h +++ b/services/source/inputinject/include/virtual_keyboard.h @@ -23,8 +23,8 @@ namespace DistributedHardware { namespace DistributedInput { class VirtualKeyboard : public VirtualDevice { public: - VirtualKeyboard(const InputDevice& event); - ~VirtualKeyboard(); + explicit VirtualKeyboard(const InputDevice& event); + ~VirtualKeyboard() override; protected: const std::vector& GetEventTypes() const override; const std::vector& GetKeys() const override; diff --git a/services/source/inputinject/include/virtual_mouse.h b/services/source/inputinject/include/virtual_mouse.h index def4b88..9f974da 100644 --- a/services/source/inputinject/include/virtual_mouse.h +++ b/services/source/inputinject/include/virtual_mouse.h @@ -23,8 +23,8 @@ namespace DistributedHardware { namespace DistributedInput { class VirtualMouse : public VirtualDevice { public: - VirtualMouse(const InputDevice& event); - ~VirtualMouse(); + explicit VirtualMouse(const InputDevice& event); + ~VirtualMouse() override; protected: const std::vector& GetEventTypes() const override; const std::vector& GetKeys() const override; diff --git a/services/source/inputinject/include/virtual_touchpad.h b/services/source/inputinject/include/virtual_touchpad.h index a6dd5cf..11635e0 100644 --- a/services/source/inputinject/include/virtual_touchpad.h +++ b/services/source/inputinject/include/virtual_touchpad.h @@ -23,8 +23,8 @@ namespace DistributedHardware { namespace DistributedInput { class VirtualTouchpad : public VirtualDevice { public: - VirtualTouchpad(const InputDevice& event); - ~VirtualTouchpad(); + explicit VirtualTouchpad(const InputDevice& event); + ~VirtualTouchpad() override; protected: const std::vector& GetEventTypes() const override; const std::vector& GetKeys() const override; diff --git a/services/source/inputinject/include/virtual_touchscreen.h b/services/source/inputinject/include/virtual_touchscreen.h index 4ee101c..ba7645d 100644 --- a/services/source/inputinject/include/virtual_touchscreen.h +++ b/services/source/inputinject/include/virtual_touchscreen.h @@ -25,7 +25,7 @@ namespace DistributedInput { class VirtualTouchScreen : public VirtualDevice { public: VirtualTouchScreen(const InputDevice& event, LocalAbsInfo& absInfo, uint32_t phyWidth, uint32_t phyHeight); - ~VirtualTouchScreen(); + ~VirtualTouchScreen() override; protected: const std::vector& GetEventTypes() const override; const std::vector& GetKeys() const override; diff --git a/services/source/inputinject/src/distributed_input_node_manager.cpp b/services/source/inputinject/src/distributed_input_node_manager.cpp index 93841d0..48941e1 100644 --- a/services/source/inputinject/src/distributed_input_node_manager.cpp +++ b/services/source/inputinject/src/distributed_input_node_manager.cpp @@ -276,23 +276,23 @@ int32_t DistributedInputNodeManager::GetDeviceInfo(std::string &deviceId) void DistributedInputNodeManager::GetDevicesInfoByType(const std::string &networkId, uint32_t inputTypes, std::map &datas) { - uint32_t input_types_ = 0; + uint32_t inputType = 0; if ((inputTypes & static_cast(DInputDeviceType::MOUSE)) != 0) { - input_types_ |= INPUT_DEVICE_CLASS_CURSOR; + inputType |= INPUT_DEVICE_CLASS_CURSOR; } if ((inputTypes & static_cast(DInputDeviceType::KEYBOARD)) != 0) { - input_types_ |= INPUT_DEVICE_CLASS_KEYBOARD; + inputType |= INPUT_DEVICE_CLASS_KEYBOARD; } if ((inputTypes & static_cast(DInputDeviceType::MOUSE)) != 0) { - input_types_ |= INPUT_DEVICE_CLASS_TOUCH; + inputType |= INPUT_DEVICE_CLASS_TOUCH; } std::lock_guard lock(virtualDeviceMapMutex_); for (const auto &[id, virdevice] : virtualDeviceMap_) { - if ((virdevice->GetDeviceType() & input_types_) && (virdevice->GetNetWorkId() == networkId)) { + if ((virdevice->GetDeviceType() & inputType) && (virdevice->GetNetWorkId() == networkId)) { datas.insert(std::pair(virdevice->GetDeviceFd(), id)); } } diff --git a/services/source/inputinject/src/virtual_device.cpp b/services/source/inputinject/src/virtual_device.cpp index 58a064b..c439415 100644 --- a/services/source/inputinject/src/virtual_device.cpp +++ b/services/source/inputinject/src/virtual_device.cpp @@ -57,7 +57,7 @@ bool VirtualDevice::DoIoctl(int32_t fd, int32_t request, const uint32_t value) bool VirtualDevice::CreateKey() { - auto fun = [&](int32_t uiSet, const std::vector& list) -> bool { + auto fun = [this](int32_t uiSet, const std::vector& list) -> bool { for (uint32_t evt_type : list) { if (!DoIoctl(fd_, uiSet, evt_type)) { DHLOGE("Error setting event type: %u", evt_type); @@ -139,11 +139,11 @@ bool VirtualDevice::SetUp(const std::string& devId, const std::string& dhId) } DHLOGI("create fd %d", fd_); - char sysfs_device_name[16]; - if (ioctl(fd_, UI_GET_SYSNAME(sizeof(sysfs_device_name)), sysfs_device_name) < 0) { + char sysfsDeviceName[16] = {0}; + if (ioctl(fd_, UI_GET_SYSNAME(sizeof(sysfsDeviceName)), sysfsDeviceName) < 0) { DHLOGE("Unable to get input device name"); } - DHLOGI("get input device name: %s, fd: %d", GetAnonyString(sysfs_device_name).c_str(), fd_); + DHLOGI("get input device name: %s, fd: %d", GetAnonyString(sysfsDeviceName).c_str(), fd_); return true; } diff --git a/services/source/inputinject/src/virtual_touchpad.cpp b/services/source/inputinject/src/virtual_touchpad.cpp index e76e805..1f7d206 100644 --- a/services/source/inputinject/src/virtual_touchpad.cpp +++ b/services/source/inputinject/src/virtual_touchpad.cpp @@ -34,7 +34,7 @@ const std::vector RELBITS {}; VirtualTouchpad::VirtualTouchpad(const InputDevice& event) : VirtualDevice(event) { - const int ABS_MAX_WHEEL = 71; + const int absMaxWheel = 71; dev_.absmin[ABS_X] = 0; dev_.absmax[ABS_X] = 1; @@ -47,7 +47,7 @@ VirtualTouchpad::VirtualTouchpad(const InputDevice& event) : VirtualDevice(event dev_.absflat[ABS_Y] = 0; dev_.absmin[ABS_WHEEL] = 0; - dev_.absmax[ABS_WHEEL] = ABS_MAX_WHEEL; + dev_.absmax[ABS_WHEEL] = absMaxWheel; dev_.absfuzz[ABS_WHEEL] = 0; dev_.absflat[ABS_WHEEL] = 0; diff --git a/services/source/inputinject/src/virtual_touchscreen.cpp b/services/source/inputinject/src/virtual_touchscreen.cpp index 49c4e92..7eb797a 100644 --- a/services/source/inputinject/src/virtual_touchscreen.cpp +++ b/services/source/inputinject/src/virtual_touchscreen.cpp @@ -40,12 +40,12 @@ VirtualTouchScreen::VirtualTouchScreen(const InputDevice& event, LocalAbsInfo& a uint32_t phyHeight) : VirtualDevice(event) { dev_.absmin[ABS_X] = 0; - dev_.absmax[ABS_X] = (int32_t)phyWidth; + dev_.absmax[ABS_X] = static_cast(phyWidth); dev_.absfuzz[ABS_X] = 0; dev_.absflat[ABS_X] = 0; dev_.absmin[ABS_Y] = 0; - dev_.absmax[ABS_Y] = (int32_t)phyHeight; + dev_.absmax[ABS_Y] = static_cast(phyHeight); dev_.absfuzz[ABS_Y] = 0; dev_.absflat[ABS_Y] = 0; @@ -70,12 +70,12 @@ VirtualTouchScreen::VirtualTouchScreen(const InputDevice& event, LocalAbsInfo& a dev_.absflat[ABS_MT_ORIENTATION] = 0; dev_.absmin[ABS_MT_POSITION_X] = 0; - dev_.absmax[ABS_MT_POSITION_X] = (int32_t)phyWidth; + dev_.absmax[ABS_MT_POSITION_X] = static_cast(phyWidth); dev_.absfuzz[ABS_MT_POSITION_X] = 0; dev_.absflat[ABS_MT_POSITION_X] = 0; dev_.absmin[ABS_MT_POSITION_Y] = 0; - dev_.absmax[ABS_MT_POSITION_Y] = (int32_t)phyHeight; + dev_.absmax[ABS_MT_POSITION_Y] = static_cast(phyHeight); dev_.absfuzz[ABS_MT_POSITION_Y] = 0; dev_.absflat[ABS_MT_POSITION_Y] = 0; diff --git a/services/source/sourcemanager/include/distributed_input_source_event_handler.h b/services/source/sourcemanager/include/distributed_input_source_event_handler.h index d344979..8b1797f 100644 --- a/services/source/sourcemanager/include/distributed_input_source_event_handler.h +++ b/services/source/sourcemanager/include/distributed_input_source_event_handler.h @@ -26,8 +26,8 @@ namespace DistributedHardware { namespace DistributedInput { class DistributedInputSourceEventHandler : public AppExecFwk::EventHandler { public: - DistributedInputSourceEventHandler(const std::shared_ptr &runner); - virtual ~DistributedInputSourceEventHandler(); + explicit DistributedInputSourceEventHandler(const std::shared_ptr &runner); + ~DistributedInputSourceEventHandler() override; bool ProxyPostTask(const Callback &callback, int64_t delayTime); diff --git a/services/source/sourcemanager/include/distributed_input_source_manager.h b/services/source/sourcemanager/include/distributed_input_source_manager.h index 8bd8c52..3b63198 100644 --- a/services/source/sourcemanager/include/distributed_input_source_manager.h +++ b/services/source/sourcemanager/include/distributed_input_source_manager.h @@ -118,65 +118,65 @@ typedef struct InputDeviceId { public: DistributedInputSourceManager(int32_t saId, bool runOnCreate); - ~DistributedInputSourceManager(); + ~DistributedInputSourceManager() override; void OnStart() override; void OnStop() override; - virtual int32_t Init() override; + int32_t Init() override; - virtual int32_t Release() override; + int32_t Release() override; - virtual int32_t RegisterDistributedHardware(const std::string& devId, const std::string& dhId, + int32_t RegisterDistributedHardware(const std::string& devId, const std::string& dhId, const std::string& parameters, sptr callback) override; - virtual int32_t UnregisterDistributedHardware(const std::string& devId, const std::string& dhId, + int32_t UnregisterDistributedHardware(const std::string& devId, const std::string& dhId, sptr callback) override; - virtual int32_t PrepareRemoteInput(const std::string &deviceId, sptr callback) override; + int32_t PrepareRemoteInput(const std::string &deviceId, sptr callback) override; - virtual int32_t UnprepareRemoteInput(const std::string &deviceId, sptr callback) override; + int32_t UnprepareRemoteInput(const std::string &deviceId, sptr callback) override; - virtual int32_t StartRemoteInput( + int32_t StartRemoteInput( const std::string& deviceId, const uint32_t& inputTypes, sptr callback) override; - virtual int32_t StopRemoteInput( + int32_t StopRemoteInput( const std::string& deviceId, const uint32_t& inputTypes, sptr callback) override; - virtual int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, + int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, sptr callback) override; - virtual int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, + int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, sptr callback) override; - virtual int32_t PrepareRemoteInput(const std::string &srcId, const std::string &sinkId, + int32_t PrepareRemoteInput(const std::string &srcId, const std::string &sinkId, sptr callback) override; - virtual int32_t UnprepareRemoteInput(const std::string &srcId, const std::string &sinkId, + int32_t UnprepareRemoteInput(const std::string &srcId, const std::string &sinkId, sptr callback) override; - virtual int32_t StartRemoteInput(const std::string &sinkId, const std::vector &dhIds, + int32_t StartRemoteInput(const std::string &sinkId, const std::vector &dhIds, sptr callback) override; - virtual int32_t StopRemoteInput(const std::string &sinkId, const std::vector &dhIds, + int32_t StopRemoteInput(const std::string &sinkId, const std::vector &dhIds, sptr callback) override; - virtual int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, + int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const std::vector &dhIds, sptr callback) override; - virtual int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, + int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, const std::vector &dhIds, sptr callback) override; - virtual int32_t RegisterAddWhiteListCallback(sptr addWhiteListCallback) override; - virtual int32_t RegisterDelWhiteListCallback(sptr delWhiteListCallback) override; - virtual int32_t RegisterInputNodeListener(sptr listener) override; - virtual int32_t UnregisterInputNodeListener(sptr listener) override; + int32_t RegisterAddWhiteListCallback(sptr addWhiteListCallback) override; + int32_t RegisterDelWhiteListCallback(sptr delWhiteListCallback) override; + int32_t RegisterInputNodeListener(sptr listener) override; + int32_t UnregisterInputNodeListener(sptr listener) override; - virtual int32_t SyncNodeInfoRemoteInput(const std::string &userDevId, const std::string &dhId, + int32_t SyncNodeInfoRemoteInput(const std::string &userDevId, const std::string &dhId, const std::string &nodeDesc) override; - virtual int32_t RegisterSimulationEventListener(sptr listener) override; - virtual int32_t UnregisterSimulationEventListener(sptr listener) override; + int32_t RegisterSimulationEventListener(sptr listener) override; + int32_t UnregisterSimulationEventListener(sptr listener) override; bool CheckRegisterParam(const std::string &devId, const std::string &dhId, const std::string ¶meters, sptr callback); bool CheckUnregisterParam(const std::string &devId, const std::string &dhId, @@ -187,30 +187,32 @@ public: public: DInputSourceListener(DistributedInputSourceManager *manager); virtual ~DInputSourceListener(); - void onResponseRegisterDistributedHardware(const std::string deviceId, const std::string dhId, bool result); - void onResponsePrepareRemoteInput(const std::string deviceId, bool result, const std::string &object); - void onResponseUnprepareRemoteInput(const std::string deviceId, bool result); - void onResponseStartRemoteInput(const std::string deviceId, const uint32_t inputTypes, bool result); - void onResponseStopRemoteInput(const std::string deviceId, const uint32_t inputTypes, bool result); - void onResponseStartRemoteInputDhid(const std::string deviceId, const std::string &dhids, bool result); - void onResponseStopRemoteInputDhid(const std::string deviceId, const std::string &dhids, bool result); - void onResponseKeyState(const std::string deviceId, const std::string &dhid, const uint32_t type, - const uint32_t code, const uint32_t value); - void onReceivedEventRemoteInput(const std::string deviceId, const std::string &event); - void onResponseRelayPrepareRemoteInput(int32_t sessionId, const std::string &deviceId, bool result, - const std::string &object); - void onResponseRelayUnprepareRemoteInput(int32_t sessionId, const std::string &deviceId, bool result); + void OnResponseRegisterDistributedHardware(const std::string deviceId, const std::string dhId, + bool result) override; + void OnResponsePrepareRemoteInput(const std::string deviceId, bool result, const std::string &object) override; + void OnResponseUnprepareRemoteInput(const std::string deviceId, bool result) override; + void OnResponseStartRemoteInput(const std::string deviceId, const uint32_t inputTypes, bool result) override; + void OnResponseStopRemoteInput(const std::string deviceId, const uint32_t inputTypes, bool result) override; + void OnResponseStartRemoteInputDhid(const std::string deviceId, const std::string &dhids, bool result) override; + void OnResponseStopRemoteInputDhid(const std::string deviceId, const std::string &dhids, bool result) override; + void OnResponseKeyState(const std::string deviceId, const std::string &dhid, const uint32_t type, + const uint32_t code, const uint32_t value) override; + void OnReceivedEventRemoteInput(const std::string deviceId, const std::string &event) override; + void OnResponseRelayPrepareRemoteInput(int32_t sessionId, const std::string &deviceId, bool result, + const std::string &object) override; + void OnResponseRelayUnprepareRemoteInput(int32_t sessionId, const std::string &deviceId, bool result) override; - void onReceiveRelayPrepareResult(int32_t status, const std::string &srcId, const std::string &sinkId); - void onReceiveRelayUnprepareResult(int32_t status, const std::string &srcId, const std::string &sinkId); - void onReceiveRelayStartDhidResult(int32_t status, const std::string &srcId, const std::string &sinkId, - const std::string &dhids); - void onReceiveRelayStopDhidResult(int32_t status, const std::string &srcId, const std::string &sinkId, - const std::string &dhids); - void onReceiveRelayStartTypeResult(int32_t status, const std::string &srcId, const std::string &sinkId, - uint32_t inputTypes); - void onReceiveRelayStopTypeResult(int32_t status, const std::string &srcId, const std::string &sinkId, - uint32_t inputTypes); + void OnReceiveRelayPrepareResult(int32_t status, const std::string &srcId, const std::string &sinkId) override; + void OnReceiveRelayUnprepareResult(int32_t status, const std::string &srcId, + const std::string &sinkId) override; + void OnReceiveRelayStartDhidResult(int32_t status, const std::string &srcId, const std::string &sinkId, + const std::string &dhids) override; + void OnReceiveRelayStopDhidResult(int32_t status, const std::string &srcId, const std::string &sinkId, + const std::string &dhids) override; + void OnReceiveRelayStartTypeResult(int32_t status, const std::string &srcId, const std::string &sinkId, + uint32_t inputTypes) override; + void OnReceiveRelayStopTypeResult(int32_t status, const std::string &srcId, const std::string &sinkId, + uint32_t inputTypes) override; void RecordEventLog(int64_t when, int32_t type, int32_t code, int32_t value, const std::string& path); private: @@ -221,7 +223,7 @@ public: public: DInputSourceManagerEventHandler(const std::shared_ptr &runner, DistributedInputSourceManager *manager); - ~DInputSourceManagerEventHandler(); + ~DInputSourceManagerEventHandler() override; void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) override; private: @@ -253,18 +255,18 @@ public: class StartDScreenListener : public PublisherListenerStub { public: StartDScreenListener(); - ~StartDScreenListener(); + ~StartDScreenListener() override; void OnMessage(const DHTopic topic, const std::string& message) override; private: int32_t ParseMessage(const std::string& message, std::string& sinkDevId, SrcScreenInfo& srcScreenInfo); - int32_t UpdateSrcScreenInfoCache(const SrcScreenInfo& TmpInfo); + int32_t UpdateSrcScreenInfoCache(const SrcScreenInfo& tmpInfo); }; class StopDScreenListener : public PublisherListenerStub { public: StopDScreenListener(); - ~StopDScreenListener(); + ~StopDScreenListener() override; void OnMessage(const DHTopic topic, const std::string& message) override; private: @@ -273,11 +275,10 @@ public: class DeviceOfflineListener : public PublisherListenerStub { public: - DeviceOfflineListener(DistributedInputSourceManager* srcManagerContext); + explicit DeviceOfflineListener(DistributedInputSourceManager* srcManagerContext); + ~DeviceOfflineListener() override; - ~DeviceOfflineListener(); - - void OnMessage(const DHTopic topic, const std::string& message); + void OnMessage(const DHTopic topic, const std::string& message) override; private: void DeleteNodeInfoAndNotify(const std::string& offlineDevId); @@ -289,7 +290,7 @@ public: class DScreenSourceSvrRecipient : public IRemoteObject::DeathRecipient { public: DScreenSourceSvrRecipient(const std::string& srcDevId, const std::string& sinkDevId, const uint64_t srcWinId); - ~DScreenSourceSvrRecipient(); + ~DScreenSourceSvrRecipient() override; void OnRemoteDied(const wptr &remote) override; private: diff --git a/services/source/sourcemanager/include/distributed_input_source_sa_cli_mgr.h b/services/source/sourcemanager/include/distributed_input_source_sa_cli_mgr.h index 8594502..477cb60 100644 --- a/services/source/sourcemanager/include/distributed_input_source_sa_cli_mgr.h +++ b/services/source/sourcemanager/include/distributed_input_source_sa_cli_mgr.h @@ -46,7 +46,7 @@ private: sptr GetRemoteCliFromCache(const std::string &devId); void AddRemoteCli(const std::string &devId, sptr object); void DeleteRemoteCli(const std::string &devId); - void DeleteRemoteCli(const sptr object); + void DeleteRemoteCli(const sptr remote); void ProcRemoteCliDied(const sptr& remote); private: diff --git a/services/source/sourcemanager/src/distributed_input_source_manager.cpp b/services/source/sourcemanager/src/distributed_input_source_manager.cpp index f78889d..002a81f 100644 --- a/services/source/sourcemanager/src/distributed_input_source_manager.cpp +++ b/services/source/sourcemanager/src/distributed_input_source_manager.cpp @@ -77,19 +77,19 @@ DistributedInputSourceManager::DInputSourceListener::~DInputSourceListener() DHLOGI("DInputSourceListener destory."); } -void DistributedInputSourceManager::DInputSourceListener::onResponseRegisterDistributedHardware( +void DistributedInputSourceManager::DInputSourceListener::OnResponseRegisterDistributedHardware( const std::string deviceId, const std::string dhId, bool result) { - DHLOGI("onResponseRegisterDistributedHardware called, deviceId: %s, " + DHLOGI("OnResponseRegisterDistributedHardware called, deviceId: %s, " "result: %s.", GetAnonyString(deviceId).c_str(), result ? "success" : "failed"); if (sourceManagerObj_ == nullptr) { - DHLOGE("onResponseRegisterDistributedHardware sourceManagerObj_ is null."); + DHLOGE("OnResponseRegisterDistributedHardware sourceManagerObj_ is null."); return; } if (sourceManagerObj_->GetCallbackEventHandler() == nullptr) { sourceManagerObj_->RunRegisterCallback(deviceId, dhId, ERR_DH_INPUT_SERVER_SOURCE_MANAGERGET_CALLBACK_HANDLER_FAIL); - DHLOGE("onResponseRegisterDistributedHardware GetCallbackEventHandler is null."); + DHLOGE("OnResponseRegisterDistributedHardware GetCallbackEventHandler is null."); return; } @@ -105,20 +105,20 @@ void DistributedInputSourceManager::DInputSourceListener::onResponseRegisterDist sourceManagerObj_->GetCallbackEventHandler()->SendEvent(msgEvent, 0, AppExecFwk::EventQueue::Priority::IMMEDIATE); } -void DistributedInputSourceManager::DInputSourceListener::onResponsePrepareRemoteInput(const std::string deviceId, +void DistributedInputSourceManager::DInputSourceListener::OnResponsePrepareRemoteInput(const std::string deviceId, bool result, const std::string &object) { - DHLOGI("onResponsePrepareRemoteInput called, deviceId: %s, result: %s.", + DHLOGI("OnResponsePrepareRemoteInput called, deviceId: %s, result: %s.", GetAnonyString(deviceId).c_str(), result ? "success" : "failed"); if (sourceManagerObj_ == nullptr) { - DHLOGE("onResponsePrepareRemoteInput sourceManagerObj_ is null."); + DHLOGE("OnResponsePrepareRemoteInput sourceManagerObj_ is null."); return; } if (sourceManagerObj_->GetCallbackEventHandler() == nullptr) { sourceManagerObj_->RunPrepareCallback(deviceId, ERR_DH_INPUT_SERVER_SOURCE_MANAGERGET_CALLBACK_HANDLER_FAIL, object); - DHLOGE("onResponsePrepareRemoteInput GetCallbackEventHandler is null."); + DHLOGE("OnResponsePrepareRemoteInput GetCallbackEventHandler is null."); return; } std::shared_ptr jsonArrayMsg = std::make_shared(); @@ -133,20 +133,20 @@ void DistributedInputSourceManager::DInputSourceListener::onResponsePrepareRemot sourceManagerObj_->GetCallbackEventHandler()->SendEvent(msgEvent, 0, AppExecFwk::EventQueue::Priority::IMMEDIATE); } -void DistributedInputSourceManager::DInputSourceListener::onResponseUnprepareRemoteInput( +void DistributedInputSourceManager::DInputSourceListener::OnResponseUnprepareRemoteInput( const std::string deviceId, bool result) { - DHLOGI("onResponseUnprepareRemoteInput called, deviceId: %s, " + DHLOGI("OnResponseUnprepareRemoteInput called, deviceId: %s, " "result: %s.", GetAnonyString(deviceId).c_str(), result ? "success" : "failed"); if (sourceManagerObj_ == nullptr) { - DHLOGE("onResponseUnprepareRemoteInput sourceManagerObj_ is null."); + DHLOGE("OnResponseUnprepareRemoteInput sourceManagerObj_ is null."); return; } if (sourceManagerObj_->GetCallbackEventHandler() == nullptr) { sourceManagerObj_->RunUnprepareCallback(deviceId, ERR_DH_INPUT_SERVER_SOURCE_MANAGERGET_CALLBACK_HANDLER_FAIL); - DHLOGE("onResponseUnprepareRemoteInput GetCallbackEventHandler is null."); + DHLOGE("OnResponseUnprepareRemoteInput GetCallbackEventHandler is null."); return; } std::shared_ptr jsonArrayMsg = std::make_shared(); @@ -160,7 +160,7 @@ void DistributedInputSourceManager::DInputSourceListener::onResponseUnprepareRem sourceManagerObj_->GetCallbackEventHandler()->SendEvent(msgEvent, 0, AppExecFwk::EventQueue::Priority::IMMEDIATE); } -void DistributedInputSourceManager::DInputSourceListener::onResponseRelayPrepareRemoteInput(int32_t toSrcSessionId, +void DistributedInputSourceManager::DInputSourceListener::OnResponseRelayPrepareRemoteInput(int32_t toSrcSessionId, const std::string &deviceId, bool result, const std::string &object) { DHLOGI("deviceId: %s, result: %d.", GetAnonyString(deviceId).c_str(), result); @@ -184,7 +184,7 @@ void DistributedInputSourceManager::DInputSourceListener::onResponseRelayPrepare sourceManagerObj_->GetCallbackEventHandler()->SendEvent(msgEvent, 0, AppExecFwk::EventQueue::Priority::IMMEDIATE); } -void DistributedInputSourceManager::DInputSourceListener::onResponseRelayUnprepareRemoteInput(int32_t toSrcSessionId, +void DistributedInputSourceManager::DInputSourceListener::OnResponseRelayUnprepareRemoteInput(int32_t toSrcSessionId, const std::string &deviceId, bool result) { DHLOGI("deviceId: %s, result: %d.", GetAnonyString(deviceId).c_str(), result); @@ -207,20 +207,20 @@ void DistributedInputSourceManager::DInputSourceListener::onResponseRelayUnprepa sourceManagerObj_->GetCallbackEventHandler()->SendEvent(msgEvent, 0, AppExecFwk::EventQueue::Priority::IMMEDIATE); } -void DistributedInputSourceManager::DInputSourceListener::onResponseStartRemoteInput( +void DistributedInputSourceManager::DInputSourceListener::OnResponseStartRemoteInput( const std::string deviceId, const uint32_t inputTypes, bool result) { - DHLOGI("onResponseStartRemoteInput called, deviceId: %s, inputTypes: %d, result: %s.", + DHLOGI("OnResponseStartRemoteInput called, deviceId: %s, inputTypes: %d, result: %s.", GetAnonyString(deviceId).c_str(), inputTypes, result ? "success" : "failed"); if (sourceManagerObj_ == nullptr) { - DHLOGE("onResponseStartRemoteInput sourceManagerObj_ is null."); + DHLOGE("OnResponseStartRemoteInput sourceManagerObj_ is null."); return; } if (sourceManagerObj_->GetCallbackEventHandler() == nullptr) { sourceManagerObj_->RunStartCallback(deviceId, inputTypes, ERR_DH_INPUT_SERVER_SOURCE_MANAGERGET_CALLBACK_HANDLER_FAIL); - DHLOGE("onResponseStartRemoteInput GetCallbackEventHandler is null."); + DHLOGE("OnResponseStartRemoteInput GetCallbackEventHandler is null."); return; } if (result) { @@ -238,18 +238,18 @@ void DistributedInputSourceManager::DInputSourceListener::onResponseStartRemoteI sourceManagerObj_->GetCallbackEventHandler()->SendEvent(msgEvent, 0, AppExecFwk::EventQueue::Priority::IMMEDIATE); } -void DistributedInputSourceManager::DInputSourceListener::onResponseStopRemoteInput( +void DistributedInputSourceManager::DInputSourceListener::OnResponseStopRemoteInput( const std::string deviceId, const uint32_t inputTypes, bool result) { - DHLOGI("onResponseStopRemoteInput called, deviceId: %s, inputTypes: %d, result: %s.", + DHLOGI("OnResponseStopRemoteInput called, deviceId: %s, inputTypes: %d, result: %s.", GetAnonyString(deviceId).c_str(), inputTypes, result ? "true" : "failed"); if (sourceManagerObj_ == nullptr) { - DHLOGE("onResponseStopRemoteInput sourceManagerObj_ is null."); + DHLOGE("OnResponseStopRemoteInput sourceManagerObj_ is null."); return; } if (sourceManagerObj_->GetCallbackEventHandler() == nullptr) { - DHLOGE("onResponseStopRemoteInput GetCallbackEventHandler is null."); + DHLOGE("OnResponseStopRemoteInput GetCallbackEventHandler is null."); sourceManagerObj_->RunStopCallback(deviceId, inputTypes, ERR_DH_INPUT_SERVER_SOURCE_MANAGERGET_CALLBACK_HANDLER_FAIL); return; @@ -266,18 +266,18 @@ void DistributedInputSourceManager::DInputSourceListener::onResponseStopRemoteIn sourceManagerObj_->GetCallbackEventHandler()->SendEvent(msgEvent, 0, AppExecFwk::EventQueue::Priority::IMMEDIATE); } -void DistributedInputSourceManager::DInputSourceListener::onResponseStartRemoteInputDhid( +void DistributedInputSourceManager::DInputSourceListener::OnResponseStartRemoteInputDhid( const std::string deviceId, const std::string &dhids, bool result) { - DHLOGI("onResponseStartRemoteInputDhid called, deviceId: %s, result: %s.", + DHLOGI("OnResponseStartRemoteInputDhid called, deviceId: %s, result: %s.", GetAnonyString(deviceId).c_str(), result ? "success" : "failed"); if (sourceManagerObj_ == nullptr) { - DHLOGE("onResponseStartRemoteInputDhid sourceManagerObj_ is null."); + DHLOGE("OnResponseStartRemoteInputDhid sourceManagerObj_ is null."); return; } if (sourceManagerObj_->GetCallbackEventHandler() == nullptr) { - DHLOGE("onResponseStartRemoteInputDhid GetCallbackEventHandler is null."); + DHLOGE("OnResponseStartRemoteInputDhid GetCallbackEventHandler is null."); sourceManagerObj_->RunStartDhidCallback(deviceId, dhids, ERR_DH_INPUT_SERVER_SOURCE_MANAGERGET_CALLBACK_HANDLER_FAIL); return; @@ -297,18 +297,18 @@ void DistributedInputSourceManager::DInputSourceListener::onResponseStartRemoteI sourceManagerObj_->GetCallbackEventHandler()->SendEvent(msgEvent, 0, AppExecFwk::EventQueue::Priority::IMMEDIATE); } -void DistributedInputSourceManager::DInputSourceListener::onResponseStopRemoteInputDhid( +void DistributedInputSourceManager::DInputSourceListener::OnResponseStopRemoteInputDhid( const std::string deviceId, const std::string &dhids, bool result) { - DHLOGI("onResponseStopRemoteInputDhid called, deviceId: %s, result: %s.", + DHLOGI("OnResponseStopRemoteInputDhid called, deviceId: %s, result: %s.", GetAnonyString(deviceId).c_str(), result ? "success" : "failed"); if (sourceManagerObj_ == nullptr) { - DHLOGE("onResponseStopRemoteInputDhid sourceManagerObj_ is null."); + DHLOGE("OnResponseStopRemoteInputDhid sourceManagerObj_ is null."); return; } if (sourceManagerObj_->GetCallbackEventHandler() == nullptr) { - DHLOGE("onResponseStopRemoteInputDhid GetCallbackEventHandler is null."); + DHLOGE("OnResponseStopRemoteInputDhid GetCallbackEventHandler is null."); sourceManagerObj_->RunStopDhidCallback(deviceId, dhids, ERR_DH_INPUT_SERVER_SOURCE_MANAGERGET_CALLBACK_HANDLER_FAIL); return; @@ -324,7 +324,7 @@ void DistributedInputSourceManager::DInputSourceListener::onResponseStopRemoteIn sourceManagerObj_->GetCallbackEventHandler()->SendEvent(msgEvent, 0, AppExecFwk::EventQueue::Priority::IMMEDIATE); } -void DistributedInputSourceManager::DInputSourceListener::onResponseKeyState(const std::string deviceId, +void DistributedInputSourceManager::DInputSourceListener::OnResponseKeyState(const std::string deviceId, const std::string &dhid, const uint32_t type, const uint32_t code, const uint32_t value) { DHLOGI("onResponseMouseDown called, deviceId: %s, dhid: %s.", GetAnonyString(deviceId).c_str(), @@ -351,7 +351,7 @@ void DistributedInputSourceManager::DInputSourceListener::onResponseKeyState(con sourceManagerObj_->GetCallbackEventHandler()->SendEvent(msgEvent, 0, AppExecFwk::EventQueue::Priority::IMMEDIATE); } -void DistributedInputSourceManager::DInputSourceListener::onReceivedEventRemoteInput( +void DistributedInputSourceManager::DInputSourceListener::OnReceivedEventRemoteInput( const std::string deviceId, const std::string &event) { nlohmann::json inputData = nlohmann::json::parse(event, nullptr, false); @@ -360,7 +360,7 @@ void DistributedInputSourceManager::DInputSourceListener::onReceivedEventRemoteI return; } size_t jsonSize = inputData.size(); - DHLOGI("onReceivedEventRemoteInput called, deviceId: %s, json size:%d.", + DHLOGI("OnReceivedEventRemoteInput called, deviceId: %s, json size:%d.", GetAnonyString(deviceId).c_str(), jsonSize); RawEvent mEventBuffer[jsonSize]; @@ -380,7 +380,7 @@ void DistributedInputSourceManager::DInputSourceListener::onReceivedEventRemoteI DistributedInputInject::GetInstance().RegisterDistributedEvent(mEventBuffer, jsonSize); } -void DistributedInputSourceManager::DInputSourceListener::onReceiveRelayPrepareResult(int32_t status, +void DistributedInputSourceManager::DInputSourceListener::OnReceiveRelayPrepareResult(int32_t status, const std::string &srcId, const std::string &sinkId) { DHLOGI("status:%d, srcId: %s, sinkId: %s.", status, GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str()); @@ -403,7 +403,7 @@ void DistributedInputSourceManager::DInputSourceListener::onReceiveRelayPrepareR sourceManagerObj_->GetCallbackEventHandler()->SendEvent(msgEvent, 0, AppExecFwk::EventQueue::Priority::IMMEDIATE); } -void DistributedInputSourceManager::DInputSourceListener::onReceiveRelayUnprepareResult(int32_t status, +void DistributedInputSourceManager::DInputSourceListener::OnReceiveRelayUnprepareResult(int32_t status, const std::string &srcId, const std::string &sinkId) { DHLOGI("status:%d, srcId: %s, sinkId: %s.", status, GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str()); @@ -426,7 +426,7 @@ void DistributedInputSourceManager::DInputSourceListener::onReceiveRelayUnprepar sourceManagerObj_->GetCallbackEventHandler()->SendEvent(msgEvent, 0, AppExecFwk::EventQueue::Priority::IMMEDIATE); } -void DistributedInputSourceManager::DInputSourceListener::onReceiveRelayStartDhidResult(int32_t status, +void DistributedInputSourceManager::DInputSourceListener::OnReceiveRelayStartDhidResult(int32_t status, const std::string &srcId, const std::string &sinkId, const std::string &dhids) { DHLOGI("status:%d, srcId: %s, sinkId: %s.", status, GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str()); @@ -450,7 +450,7 @@ void DistributedInputSourceManager::DInputSourceListener::onReceiveRelayStartDhi sourceManagerObj_->GetCallbackEventHandler()->SendEvent(msgEvent, 0, AppExecFwk::EventQueue::Priority::IMMEDIATE); } -void DistributedInputSourceManager::DInputSourceListener::onReceiveRelayStopDhidResult(int32_t status, +void DistributedInputSourceManager::DInputSourceListener::OnReceiveRelayStopDhidResult(int32_t status, const std::string &srcId, const std::string &sinkId, const std::string &dhids) { DHLOGI("status:%d, srcId: %s, sinkId: %s.", status, GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str()); @@ -474,7 +474,7 @@ void DistributedInputSourceManager::DInputSourceListener::onReceiveRelayStopDhid sourceManagerObj_->GetCallbackEventHandler()->SendEvent(msgEvent, 0, AppExecFwk::EventQueue::Priority::IMMEDIATE); } -void DistributedInputSourceManager::DInputSourceListener::onReceiveRelayStartTypeResult(int32_t status, +void DistributedInputSourceManager::DInputSourceListener::OnReceiveRelayStartTypeResult(int32_t status, const std::string &srcId, const std::string &sinkId, uint32_t inputTypes) { DHLOGI("status:%d, srcId: %s, sinkId: %s.", status, GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str()); @@ -498,7 +498,7 @@ void DistributedInputSourceManager::DInputSourceListener::onReceiveRelayStartTyp sourceManagerObj_->GetCallbackEventHandler()->SendEvent(msgEvent, 0, AppExecFwk::EventQueue::Priority::IMMEDIATE); } -void DistributedInputSourceManager::DInputSourceListener::onReceiveRelayStopTypeResult(int32_t status, +void DistributedInputSourceManager::DInputSourceListener::OnReceiveRelayStopTypeResult(int32_t status, const std::string &srcId, const std::string &sinkId, uint32_t inputTypes) { DHLOGI("status:%d, srcId: %s, sinkId: %s.", status, GetAnonyString(srcId).c_str(), GetAnonyString(sinkId).c_str()); @@ -2465,7 +2465,7 @@ DInputServerType DistributedInputSourceManager::GetStartTransFlag() void DistributedInputSourceManager::SetStartTransFlag(const DInputServerType flag) { - DHLOGI("Set Source isStartTrans_ %d", (int32_t)flag); + DHLOGI("Set Source isStartTrans_ %d", static_cast(flag)); isStartTrans_ = flag; } @@ -2678,17 +2678,17 @@ int32_t DistributedInputSourceManager::StartDScreenListener::ParseMessage(const return DH_SUCCESS; } -int32_t DistributedInputSourceManager::StartDScreenListener::UpdateSrcScreenInfoCache(const SrcScreenInfo& TmpInfo) +int32_t DistributedInputSourceManager::StartDScreenListener::UpdateSrcScreenInfoCache(const SrcScreenInfo& tmpInfo) { std::string srcDevId = GetLocalNetworkId(); - std::string srcScreenInfoKey = DInputContext::GetInstance().GetScreenInfoKey(srcDevId, TmpInfo.sourceWinId); + std::string srcScreenInfoKey = DInputContext::GetInstance().GetScreenInfoKey(srcDevId, tmpInfo.sourceWinId); SrcScreenInfo srcScreenInfo = DInputContext::GetInstance().GetSrcScreenInfo(srcScreenInfoKey); srcScreenInfo.devId = srcDevId; srcScreenInfo.sessionId = DistributedInputSourceTransport::GetInstance().GetCurrentSessionId(); srcScreenInfo.uuid = GetUUIDBySoftBus(srcDevId); - srcScreenInfo.sourceWinId = TmpInfo.sourceWinId; - srcScreenInfo.sourceWinWidth = TmpInfo.sourceWinWidth; - srcScreenInfo.sourceWinHeight = TmpInfo.sourceWinHeight; + srcScreenInfo.sourceWinId = tmpInfo.sourceWinId; + srcScreenInfo.sourceWinWidth = tmpInfo.sourceWinWidth; + srcScreenInfo.sourceWinHeight = tmpInfo.sourceWinHeight; srcScreenInfo.sourcePhyId = DistributedInputInject::GetInstance().GenerateVirtualTouchScreenDHId( srcScreenInfo.sourceWinId, srcScreenInfo.sourceWinWidth, srcScreenInfo.sourceWinHeight); int32_t virtualScreenFd = DistributedInputInject::GetInstance().GetVirtualTouchScreenFd(); @@ -2696,9 +2696,9 @@ int32_t DistributedInputSourceManager::StartDScreenListener::UpdateSrcScreenInfo DHLOGE("virtualScreenFd is invalid"); return ERR_DH_INPUT_SERVER_SOURCE_VIRTUAL_SCREEN_NODE_IS_INVALID; } - srcScreenInfo.sourcePhyFd = (uint32_t)virtualScreenFd; - srcScreenInfo.sourcePhyWidth = TmpInfo.sourceWinWidth; - srcScreenInfo.sourcePhyHeight = TmpInfo.sourceWinHeight; + srcScreenInfo.sourcePhyFd = static_cast(virtualScreenFd); + srcScreenInfo.sourcePhyWidth = tmpInfo.sourceWinWidth; + srcScreenInfo.sourcePhyHeight = tmpInfo.sourceWinHeight; DHLOGI("StartDScreenListener UpdateSrcScreenInfo the data: devId: %s, sourceWinId: %d, sourceWinWidth: %d," "sourceWinHeight: %d, sourcePhyId: %s, sourcePhyFd: %d, sourcePhyWidth: %d, sourcePhyHeight: %d", GetAnonyString(srcScreenInfo.devId).c_str(), srcScreenInfo.sourceWinId, srcScreenInfo.sourceWinWidth, diff --git a/services/source/transport/src/distributed_input_source_transport.cpp b/services/source/transport/src/distributed_input_source_transport.cpp index a22fde6..6b575dc 100644 --- a/services/source/transport/src/distributed_input_source_transport.cpp +++ b/services/source/transport/src/distributed_input_source_transport.cpp @@ -1119,7 +1119,7 @@ void DistributedInputSourceTransport::NotifyResponsePrepareRemoteInput(int32_t s DHLOGE("OnBytesReceived cmdType is TRANS_SINK_MSG_ONPREPARE, deviceId is error."); return; } - callback_->onResponsePrepareRemoteInput(deviceId, recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE], + callback_->OnResponsePrepareRemoteInput(deviceId, recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE], recMsg[DINPUT_SOFTBUS_KEY_WHITE_LIST]); } @@ -1136,7 +1136,7 @@ void DistributedInputSourceTransport::NotifyResponseUnprepareRemoteInput(int32_t DHLOGE("OnBytesReceived cmdType is TRANS_SINK_MSG_ONUNPREPARE, deviceId is error."); return; } - callback_->onResponseUnprepareRemoteInput(deviceId, recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE]); + callback_->OnResponseUnprepareRemoteInput(deviceId, recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE]); CloseInputSoftbus(sessionId); } @@ -1152,7 +1152,7 @@ void DistributedInputSourceTransport::NotifyResponseStartRemoteInput(int32_t ses DHLOGE("OnBytesReceived cmdType is TRANS_SINK_MSG_ONSTART, deviceId is error."); return; } - callback_->onResponseStartRemoteInput( + callback_->OnResponseStartRemoteInput( deviceId, recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE], recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE]); } @@ -1168,7 +1168,7 @@ void DistributedInputSourceTransport::NotifyResponseStopRemoteInput(int32_t sess DHLOGE("OnBytesReceived cmdType TRANS_SINK_MSG_ONSTOP, deviceId is error."); return; } - callback_->onResponseStopRemoteInput( + callback_->OnResponseStopRemoteInput( deviceId, recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE], recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE]); } @@ -1185,7 +1185,7 @@ void DistributedInputSourceTransport::NotifyResponseStartRemoteInputDhid(int32_t DHLOGE("OnBytesReceived cmdType is TRANS_SINK_MSG_DHID_ONSTART, deviceId is error."); return; } - callback_->onResponseStartRemoteInputDhid( + callback_->OnResponseStartRemoteInputDhid( deviceId, recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID], recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE]); } @@ -1201,7 +1201,7 @@ void DistributedInputSourceTransport::NotifyResponseStopRemoteInputDhid(int32_t DHLOGE("OnBytesReceived cmdType is TRANS_SINK_MSG_DHID_ONSTOP, deviceId is error."); return; } - callback_->onResponseStopRemoteInputDhid( + callback_->OnResponseStopRemoteInputDhid( deviceId, recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID], recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE]); } @@ -1213,7 +1213,7 @@ void DistributedInputSourceTransport::NotifyResponseKeyState(int32_t sessionId, DHLOGE("OnBytesReceived cmdType is TRANS_SINK_MSG_KEY_STATE, deviceId is error."); return; } - callback_->onResponseKeyState(deviceId, recMsg[DINPUT_SOFTBUS_KEY_KEYSTATE_DHID], + callback_->OnResponseKeyState(deviceId, recMsg[DINPUT_SOFTBUS_KEY_KEYSTATE_DHID], recMsg[DINPUT_SOFTBUS_KEY_KEYSTATE_TYPE], recMsg[DINPUT_SOFTBUS_KEY_KEYSTATE_CODE], recMsg[DINPUT_SOFTBUS_KEY_KEYSTATE_VALUE]); } @@ -1232,7 +1232,7 @@ void DistributedInputSourceTransport::NotifyReceivedEventRemoteInput(int32_t ses return; } std::string inputDataStr = recMsg[DINPUT_SOFTBUS_KEY_INPUT_DATA]; - callback_->onReceivedEventRemoteInput(deviceId, inputDataStr); + callback_->OnReceivedEventRemoteInput(deviceId, inputDataStr); } void DistributedInputSourceTransport::CalculateLatency(int32_t sessionId, const nlohmann::json &recMsg) @@ -1262,13 +1262,13 @@ void DistributedInputSourceTransport::ReceiveSrcTSrcRelayPrepare(int32_t session // continue notify to A_sink_trans int32_t ret = OpenInputSoftbus(deviceId); if (ret != DH_SUCCESS) { - callback_->onResponseRelayPrepareRemoteInput(sessionId, deviceId, false, ""); + callback_->OnResponseRelayPrepareRemoteInput(sessionId, deviceId, false, ""); return; } ret = PrepareRemoteInput(sessionId, deviceId); if (ret != DH_SUCCESS) { - callback_->onResponseRelayPrepareRemoteInput(sessionId, deviceId, false, ""); + callback_->OnResponseRelayPrepareRemoteInput(sessionId, deviceId, false, ""); return; } } @@ -1285,7 +1285,7 @@ void DistributedInputSourceTransport::ReceiveSrcTSrcRelayUnprepare(int32_t sessi int32_t ret = UnprepareRemoteInput(sessionId, deviceId); if (ret != DH_SUCCESS) { DHLOGE("Can not send message by softbus, unprepare fail."); - callback_->onResponseRelayUnprepareRemoteInput(sessionId, deviceId, false); + callback_->OnResponseRelayUnprepareRemoteInput(sessionId, deviceId, false); return; } } @@ -1305,7 +1305,7 @@ void DistributedInputSourceTransport::NotifyResponseRelayPrepareRemoteInput(int3 DHLOGE("OnBytesReceived cmdType is TRANS_SINK_MSG_ON_RELAY_PREPARE, sinkDevId is error."); return; } - callback_->onResponseRelayPrepareRemoteInput(recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID], sinkDevId, + callback_->OnResponseRelayPrepareRemoteInput(recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID], sinkDevId, recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE], recMsg[DINPUT_SOFTBUS_KEY_WHITE_LIST]); } @@ -1323,7 +1323,7 @@ void DistributedInputSourceTransport::NotifyResponseRelayUnprepareRemoteInput(in DHLOGE("OnBytesReceived cmdType is TRANS_SINK_MSG_ON_RELAY_UNPREPARE, sinkDevId is error."); return; } - callback_->onResponseRelayUnprepareRemoteInput(recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID], sinkDevId, + callback_->OnResponseRelayUnprepareRemoteInput(recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID], sinkDevId, recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE]); CloseInputSoftbus(sessionId); } @@ -1341,7 +1341,7 @@ void DistributedInputSourceTransport::ReceiveRelayPrepareResult(int32_t sessionI std::string srcId = recMsg[DINPUT_SOFTBUS_KEY_SRC_DEV_ID]; std::string sinkId = recMsg[DINPUT_SOFTBUS_KEY_SINK_DEV_ID]; int32_t status = recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE]; - callback_->onReceiveRelayPrepareResult(status, srcId, sinkId); + callback_->OnReceiveRelayPrepareResult(status, srcId, sinkId); } void DistributedInputSourceTransport::ReceiveRelayUnprepareResult(int32_t sessionId, const nlohmann::json &recMsg) @@ -1357,7 +1357,7 @@ void DistributedInputSourceTransport::ReceiveRelayUnprepareResult(int32_t sessio std::string srcId = recMsg[DINPUT_SOFTBUS_KEY_SRC_DEV_ID]; std::string sinkId = recMsg[DINPUT_SOFTBUS_KEY_SINK_DEV_ID]; int32_t status = recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE]; - callback_->onReceiveRelayUnprepareResult(status, srcId, sinkId); + callback_->OnReceiveRelayUnprepareResult(status, srcId, sinkId); CloseInputSoftbus(sessionId); } @@ -1476,7 +1476,7 @@ void DistributedInputSourceTransport::ReceiveRelayStartDhidResult(int32_t sessio std::string sinkId = recMsg[DINPUT_SOFTBUS_KEY_SINK_DEV_ID]; int32_t status = recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE]; std::string dhids = recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID]; - callback_->onReceiveRelayStartDhidResult(status, srcId, sinkId, dhids); + callback_->OnReceiveRelayStartDhidResult(status, srcId, sinkId, dhids); } void DistributedInputSourceTransport::ReceiveRelayStopDhidResult(int32_t sessionId, const nlohmann::json &recMsg) @@ -1494,7 +1494,7 @@ void DistributedInputSourceTransport::ReceiveRelayStopDhidResult(int32_t session std::string sinkId = recMsg[DINPUT_SOFTBUS_KEY_SINK_DEV_ID]; int32_t status = recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE]; std::string dhids = recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID]; - callback_->onReceiveRelayStopDhidResult(status, srcId, sinkId, dhids); + callback_->OnReceiveRelayStopDhidResult(status, srcId, sinkId, dhids); } void DistributedInputSourceTransport::ReceiveSrcTSrcRelayStartType(int32_t sessionId, const nlohmann::json &recMsg) @@ -1612,7 +1612,7 @@ void DistributedInputSourceTransport::ReceiveRelayStartTypeResult(int32_t sessio std::string sinkId = recMsg[DINPUT_SOFTBUS_KEY_SINK_DEV_ID]; int32_t status = recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE]; uint32_t inputTypes = recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE]; - callback_->onReceiveRelayStartTypeResult(status, srcId, sinkId, inputTypes); + callback_->OnReceiveRelayStartTypeResult(status, srcId, sinkId, inputTypes); } void DistributedInputSourceTransport::ReceiveRelayStopTypeResult(int32_t sessionId, const nlohmann::json &recMsg) @@ -1630,7 +1630,7 @@ void DistributedInputSourceTransport::ReceiveRelayStopTypeResult(int32_t session std::string sinkId = recMsg[DINPUT_SOFTBUS_KEY_SINK_DEV_ID]; int32_t status = recMsg[DINPUT_SOFTBUS_KEY_RESP_VALUE]; uint32_t inputTypes = recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE]; - callback_->onReceiveRelayStopTypeResult(status, srcId, sinkId, inputTypes); + callback_->OnReceiveRelayStopTypeResult(status, srcId, sinkId, inputTypes); } void DistributedInputSourceTransport::HandleSessionData(int32_t sessionId, const std::string& message) diff --git a/sinkhandler/include/distributed_input_sink_handler.h b/sinkhandler/include/distributed_input_sink_handler.h index 7939300..e4e4569 100644 --- a/sinkhandler/include/distributed_input_sink_handler.h +++ b/sinkhandler/include/distributed_input_sink_handler.h @@ -36,7 +36,7 @@ DECLARE_SINGLE_INSTANCE_BASE(DistributedInputSinkHandler); public: int32_t InitSink(const std::string& params) override; int32_t ReleaseSink() override; - int32_t SubscribeLocalHardware(const std::string& dhId, const std::string& parameters) override; + int32_t SubscribeLocalHardware(const std::string& dhId, const std::string& params) override; int32_t UnsubscribeLocalHardware(const std::string& dhId) override; void FinishStartSA(const std::string ¶ms, const sptr &remoteObject);