From 8796703eb72eafc132e789e19d4568e92ba82d32 Mon Sep 17 00:00:00 2001 From: xxxx Date: Wed, 16 Nov 2022 17:53:31 +0800 Subject: [PATCH] Revert " Match-id-b85c69e76c3dc4fe54a3032974160b529a25120d --- 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 | 14 +-- .../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 | 5 +- .../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 | 38 +++--- .../distributed_input_sink_event_handler.h | 4 +- .../include/distributed_input_sink_manager.h | 54 ++++---- .../src/distributed_input_sink_manager.cpp | 80 ++++++------ .../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 | 6 +- .../distributed_input_source_event_handler.h | 4 +- .../distributed_input_source_manager.h | 119 +++++++++--------- .../distributed_input_source_sa_cli_mgr.h | 2 +- .../src/distributed_input_source_manager.cpp | 94 +++++++------- .../distributed_input_source_transport.cpp | 42 +++---- .../include/distributed_input_sink_handler.h | 2 +- utils/src/dinput_context.cpp | 24 ++-- 63 files changed, 431 insertions(+), 413 deletions(-) diff --git a/common/include/input_hub.cpp b/common/include/input_hub.cpp index 0ff177c..fc1dea6 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 = static_cast(absInfo.maximum + 1); + info.sinkPhyWidth = (uint32_t)(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 = static_cast(absInfo.maximum + 1); + info.sinkPhyHeight = (uint32_t)(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 = static_cast(iev.value); - absInfo.absXIndex = static_cast(j); + absInfo.absX = (uint32_t)iev.value; + absInfo.absXIndex = (int32_t)j; } if (iev.code == ABS_Y || iev.code == ABS_MT_POSITION_Y) { - absInfo.absY = static_cast(iev.value); - absInfo.absYIndex = static_cast(j); + absInfo.absY = (uint32_t)iev.value; + absInfo.absYIndex = (int32_t)j; } } diff --git a/dfx_utils/include/hidumper.h b/dfx_utils/include/hidumper.h index ef487ca..17958d4 100644 --- a/dfx_utils/include/hidumper.h +++ b/dfx_utils/include/hidumper.h @@ -38,16 +38,16 @@ enum class HiDumperFlag { }; struct NodeInfo { - std::string devId = ""; - std::string virNodeName = ""; - std::string inputDhId = ""; + std::string deviceId_ = ""; + std::string nodeName_ = ""; + std::string dhId_ = ""; }; struct SessionInfo { - int32_t sesId = 0; - std::string mySesName = ""; - std::string peerSesName = ""; - SessionStatus sessionState = SessionStatus::CLOSED; + int32_t sessionId_ = 0; + std::string mySessionName_ = ""; + std::string peerSessionName_ = ""; + SessionStatus sessionStatus_ = SessionStatus::CLOSED; }; class HiDumper { diff --git a/dfx_utils/src/hidumper.cpp b/dfx_utils/src/hidumper.cpp index 59a7b49..38dd5dd 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).devId)); + result.append(GetAnonyString((*iter).deviceId_)); result.append("\n nodename : "); - result.append((*iter).virNodeName); + result.append((*iter).nodeName_); result.append("\n dhId : "); - result.append(GetAnonyString((*iter).inputDhId)); + result.append(GetAnonyString((*iter).dhId_)); 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).devId.compare(deviceId) == 0 && (*iter).inputDhId.compare(dhId) == 0) { + if ((*iter).deviceId_.compare(deviceId) == 0 && (*iter).dhId_.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.sesId)); + result.append(std::to_string(iter->second.sessionId_)); result.append("\n mysessionname : "); - result.append(iter->second.mySesName); + result.append(iter->second.mySessionName_); result.append("\n peersessionname : "); - result.append(iter->second.peerSesName); + result.append(iter->second.peerSessionName_); std::string sessionStatus(""); - auto item = SESSION_STATUS.find(iter->second.sessionState); + auto item = SESSION_STATUS.find(iter->second.sessionStatus_); if (item == SESSION_STATUS.end()) { sessionStatus = "unknown state"; } else { - sessionStatus = SESSION_STATUS.find(iter->second.sessionState)->second; + sessionStatus = SESSION_STATUS.find(iter->second.sessionStatus_)->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 = { - .devId = deviceId, - .virNodeName = nodeName, - .inputDhId = dhId, + .deviceId_ = deviceId, + .nodeName_ = nodeName, + .dhId_ = 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 = { - .sesId = sessionId, - .mySesName = mySessionName, - .peerSesName = peerSessionName, - .sessionState = sessionStatus, + .sessionId_ = sessionId, + .mySessionName_ = mySessionName, + .peerSessionName_ = peerSessionName, + .sessionStatus_ = 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].sessionState = sessionStatus; + sessionInfos_[remoteDevId].sessionStatus_ = sessionStatus; } } // namespace DistributedInput } // namespace DistributedHardware diff --git a/inputdevicehandler/include/distributed_input_handler.h b/inputdevicehandler/include/distributed_input_handler.h index 9b3ed2a..a8a49e8 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 int32_t Initialize() override; + API_EXPORT virtual int32_t Initialize() override; API_EXPORT virtual std::vector Query() override; API_EXPORT virtual std::map QueryExtraInfo() override; - API_EXPORT bool IsSupportPlugin() override; - API_EXPORT void RegisterPluginListener(std::shared_ptr listener) override; - API_EXPORT void UnRegisterPluginListener() 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 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 inputDeviceBufferSize = 32; - InputDeviceEvent mEventBuffer[inputDeviceBufferSize] = {}; + static const int INPUT_DEVICE_BUFFER_SIZE = 32; + InputDeviceEvent mEventBuffer[INPUT_DEVICE_BUFFER_SIZE] = {}; std::mutex operationMutex_; std::unique_ptr inputHub_; }; diff --git a/inputdevicehandler/src/distributed_input_handler.cpp b/inputdevicehandler/src/distributed_input_handler.cpp index b0294bf..3b5671f 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, inputDeviceBufferSize); + size_t count = inputHub_->StartCollectInputHandler(mEventBuffer, INPUT_DEVICE_BUFFER_SIZE); 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 276af7c..c1939e4 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,9 +28,10 @@ namespace DistributedInput { class AddWhiteListInfosCallbackProxy : public IRemoteProxy { public: explicit AddWhiteListInfosCallbackProxy(const sptr &object); - ~AddWhiteListInfosCallbackProxy() override; - void OnResult(const std::string& deviceId, const std::string& strJson) override; + virtual ~AddWhiteListInfosCallbackProxy() override; + + virtual 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 9ac3c69..99cda31 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(); - ~AddWhiteListInfosCallbackStub() override; + virtual ~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 9a06867..7362a30 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,9 +28,10 @@ namespace DistributedInput { class DelWhiteListInfosCallbackProxy : public IRemoteProxy { public: explicit DelWhiteListInfosCallbackProxy(const sptr &object); - ~DelWhiteListInfosCallbackProxy() override; - void OnResult(const std::string& deviceId) override; + virtual ~DelWhiteListInfosCallbackProxy() override; + + virtual 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 6ad9dfe..eb39ff1 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(); - ~DelWhiteListInfosCallbackStub() override; + virtual ~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 29745fa..804fa7f 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; - ~RegisterDInputCb() override = default; - void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status) override; + virtual ~RegisterDInputCb() = default; + void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status); }; class UnregisterDInputCb : public OHOS::DistributedHardware::DistributedInput::UnregisterDInputCallbackStub { public: UnregisterDInputCb() = default; - ~UnregisterDInputCb() override = default; - void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status) override; + virtual ~UnregisterDInputCb() = default; + void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status); }; class AddWhiteListInfosCb : public OHOS::DistributedHardware::DistributedInput::AddWhiteListInfosCallbackStub { public: AddWhiteListInfosCb() = default; - ~AddWhiteListInfosCb() override = default; - void OnResult(const std::string &deviceId, const std::string &strJson) override; + virtual ~AddWhiteListInfosCb() = default; + void OnResult(const std::string &deviceId, const std::string &strJson); }; class DelWhiteListInfosCb : public OHOS::DistributedHardware::DistributedInput::DelWhiteListInfosCallbackStub { public: DelWhiteListInfosCb() = default; - ~DelWhiteListInfosCb() override = default; - void OnResult(const std::string &deviceId) override; + virtual ~DelWhiteListInfosCb() = default; + void OnResult(const std::string &deviceId); }; class SharingDhIdListenerCb : public OHOS::DistributedHardware::DistributedInput::SharingDhIdListenerStub { public: SharingDhIdListenerCb() = default; - ~SharingDhIdListenerCb() override = default; - int32_t OnSharing(std::string dhId) override; - int32_t OnNoSharing(std::string dhId) override; + virtual ~SharingDhIdListenerCb() = default; + int32_t OnSharing(std::string dhId); + int32_t OnNoSharing(std::string dhId); }; class GetSinkScreenInfosCb : public OHOS::DistributedHardware::DistributedInput::GetSinkScreenInfosCallbackStub { public: GetSinkScreenInfosCb() = default; - ~GetSinkScreenInfosCb() override = default; - void OnResult(const std::string &strJson) override; + virtual ~GetSinkScreenInfosCb() = default; + void OnResult(const std::string &strJson); }; class DInputClientEventHandler : public AppExecFwk::EventHandler { public: - explicit DInputClientEventHandler(const std::shared_ptr &runner); - ~DInputClientEventHandler() override = default; + DInputClientEventHandler(const std::shared_ptr &runner); + ~DInputClientEventHandler() {} 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 211c216..d754ee5 100644 --- a/interfaces/ipc/include/distributed_input_sink_proxy.h +++ b/interfaces/ipc/include/distributed_input_sink_proxy.h @@ -32,18 +32,18 @@ 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; - int32_t RegisterSharingDhIdListener(sptr sharingDhIdListener) override; + virtual 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 3d13969..3b55dcd 100644 --- a/interfaces/ipc/include/distributed_input_sink_stub.h +++ b/interfaces/ipc/include/distributed_input_sink_stub.h @@ -28,9 +28,10 @@ namespace DistributedInput { class DistributedInputSinkStub : public IRemoteStub { public: DistributedInputSinkStub(); - ~DistributedInputSinkStub() override; + virtual ~DistributedInputSinkStub() override; - int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; + virtual 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 4855fe4..959c77a 100644 --- a/interfaces/ipc/include/distributed_input_source_proxy.h +++ b/interfaces/ipc/include/distributed_input_source_proxy.h @@ -27,62 +27,64 @@ namespace DistributedHardware { namespace DistributedInput { class DistributedInputSourceProxy : public IRemoteProxy { public: + explicit DistributedInputSourceProxy(const sptr &object); - ~DistributedInputSourceProxy() override; - int32_t Init() override; + virtual ~DistributedInputSourceProxy() override; - int32_t Release() override; + virtual int32_t Init() override; - int32_t RegisterDistributedHardware(const std::string& devId, const std::string& dhId, + virtual int32_t Release() override; + + virtual int32_t RegisterDistributedHardware(const std::string& devId, const std::string& dhId, const std::string& parameters, sptr callback) override; - int32_t UnregisterDistributedHardware(const std::string& devId, const std::string& dhId, + virtual int32_t UnregisterDistributedHardware(const std::string& devId, const std::string& dhId, sptr callback) override; - int32_t PrepareRemoteInput(const std::string &deviceId, sptr callback) override; + virtual int32_t PrepareRemoteInput(const std::string &deviceId, sptr callback) override; - int32_t UnprepareRemoteInput(const std::string &deviceId, sptr callback) override; + virtual int32_t UnprepareRemoteInput(const std::string &deviceId, sptr callback) override; - int32_t StartRemoteInput( + virtual int32_t StartRemoteInput( const std::string& deviceId, const uint32_t& inputTypes, sptr callback) override; - int32_t StopRemoteInput( + virtual int32_t StopRemoteInput( const std::string& deviceId, const uint32_t& inputTypes, sptr callback) override; - int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, + virtual int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, sptr callback) override; - int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, + virtual int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, sptr callback) override; - int32_t PrepareRemoteInput(const std::string &srcId, const std::string &sinkId, + virtual int32_t PrepareRemoteInput(const std::string &srcId, const std::string &sinkId, sptr callback) override; - int32_t UnprepareRemoteInput(const std::string &srcId, const std::string &sinkId, + virtual int32_t UnprepareRemoteInput(const std::string &srcId, const std::string &sinkId, sptr callback) override; - int32_t StartRemoteInput(const std::string &sinkId, const std::vector &dhIds, + virtual int32_t StartRemoteInput(const std::string &sinkId, const std::vector &dhIds, sptr callback) override; - int32_t StopRemoteInput(const std::string &sinkId, const std::vector &dhIds, + virtual int32_t StopRemoteInput(const std::string &sinkId, const std::vector &dhIds, sptr callback) override; - int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, + virtual int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const std::vector &dhIds, sptr callback) override; - int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, + virtual int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, const std::vector &dhIds, sptr callback) 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 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 SyncNodeInfoRemoteInput(const std::string &userDevId, const std::string &dhid, + virtual int32_t SyncNodeInfoRemoteInput(const std::string &userDevId, const std::string &dhid, const std::string &nodeDesc) override; - int32_t RegisterSimulationEventListener(sptr listener) override; - int32_t UnregisterSimulationEventListener(sptr listener) override; + virtual int32_t RegisterSimulationEventListener(sptr listener) override; + virtual 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 2690ce8..3819ceb 100644 --- a/interfaces/ipc/include/distributed_input_source_stub.h +++ b/interfaces/ipc/include/distributed_input_source_stub.h @@ -28,9 +28,10 @@ namespace DistributedInput { class DistributedInputSourceStub : public IRemoteStub { public: DistributedInputSourceStub(); - ~DistributedInputSourceStub() override; + virtual ~DistributedInputSourceStub() override; - int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; + virtual 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 fd5b1d2..22fb1f7 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,9 +28,10 @@ namespace DistributedInput { class GetSinkScreenInfosCallbackProxy : public IRemoteProxy { public: explicit GetSinkScreenInfosCallbackProxy(const sptr &object); - ~GetSinkScreenInfosCallbackProxy() override; - void OnResult(const std::string& strJson) override; + virtual ~GetSinkScreenInfosCallbackProxy() override; + + virtual 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 9d5e429..bcaa388 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(); - ~GetSinkScreenInfosCallbackStub() override; + virtual ~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 45b8de3..3c9a0ee 100644 --- a/interfaces/ipc/include/input_node_listener_proxy.h +++ b/interfaces/ipc/include/input_node_listener_proxy.h @@ -28,12 +28,13 @@ namespace DistributedInput { class InputNodeListenerProxy : public IRemoteProxy { public: explicit InputNodeListenerProxy(const sptr &object); - ~InputNodeListenerProxy() override; - void OnNodeOnLine(const std::string srcDevId, const std::string sinkDevId, + virtual ~InputNodeListenerProxy() override; + + virtual void OnNodeOnLine(const std::string srcDevId, const std::string sinkDevId, const std::string sinkNodeId, const std::string sinkNodeDesc) override; - void OnNodeOffLine(const std::string srcDevId, const std::string sinkDevId, + virtual 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 bf09845..37a8c29 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(); - ~InputNodeListenerStub() override; + virtual ~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 9e50268..991dd6e 100644 --- a/interfaces/ipc/include/prepare_d_input_call_back_proxy.h +++ b/interfaces/ipc/include/prepare_d_input_call_back_proxy.h @@ -28,9 +28,10 @@ namespace DistributedInput { class PrepareDInputCallbackProxy : public IRemoteProxy { public: explicit PrepareDInputCallbackProxy(const sptr &object); - ~PrepareDInputCallbackProxy() override; - void OnResult(const std::string& deviceId, const int32_t& status) override; + virtual ~PrepareDInputCallbackProxy() override; + + virtual 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 225e04a..437adcf 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(); - ~PrepareDInputCallbackStub() override; + virtual ~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 fc2ab42..76119fd 100644 --- a/interfaces/ipc/include/register_d_input_call_back_proxy.h +++ b/interfaces/ipc/include/register_d_input_call_back_proxy.h @@ -28,9 +28,10 @@ namespace DistributedInput { class RegisterDInputCallbackProxy : public IRemoteProxy { public: explicit RegisterDInputCallbackProxy(const sptr &object); - ~RegisterDInputCallbackProxy() override; - void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status) override; + virtual ~RegisterDInputCallbackProxy() override; + + virtual 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 a98d28b..098d44d 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(); - ~RegisterDInputCallbackStub() override; + virtual ~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 8e3bcbd..c9f974c 100644 --- a/interfaces/ipc/include/sharing_dhid_listener_proxy.h +++ b/interfaces/ipc/include/sharing_dhid_listener_proxy.h @@ -28,10 +28,11 @@ namespace DistributedInput { class SharingDhIdListenerProxy : public IRemoteProxy { public: explicit SharingDhIdListenerProxy(const sptr &object); - ~SharingDhIdListenerProxy() override; - int32_t OnSharing(std::string dhId) override; - int32_t OnNoSharing(std::string dhId) override; + virtual ~SharingDhIdListenerProxy() override; + + virtual int32_t OnSharing(std::string dhId) override; + virtual 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 39af8f7..ba301c7 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(); - ~SharingDhIdListenerStub() override; + virtual ~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 4519a49..28a801e 100644 --- a/interfaces/ipc/include/simulation_event_listener_proxy.h +++ b/interfaces/ipc/include/simulation_event_listener_proxy.h @@ -28,9 +28,10 @@ namespace DistributedInput { class SimulationEventListenerProxy : public IRemoteProxy { public: explicit SimulationEventListenerProxy(const sptr &object); - ~SimulationEventListenerProxy() override; - int32_t OnSimulationEvent(uint32_t type, uint32_t code, int32_t value) override; + virtual ~SimulationEventListenerProxy() override; + + virtual 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 c88afc7..aa1c608 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(); - ~SimulationEventListenerStub() override; + virtual ~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 b81a3b9..d58205a 100644 --- a/interfaces/ipc/include/start_d_input_call_back_proxy.h +++ b/interfaces/ipc/include/start_d_input_call_back_proxy.h @@ -28,9 +28,10 @@ namespace DistributedInput { class StartDInputCallbackProxy : public IRemoteProxy { public: explicit StartDInputCallbackProxy(const sptr &object); - ~StartDInputCallbackProxy() override; - void OnResult(const std::string& devId, const uint32_t& inputTypes, const int32_t& status) override; + virtual ~StartDInputCallbackProxy() override; + + virtual 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/start_d_input_call_back_stub.h b/interfaces/ipc/include/start_d_input_call_back_stub.h index 7c3932a..4f28dbf 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(); - ~StartDInputCallbackStub() override; + virtual ~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 dd10634..6511f18 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); - ~StartStopDInputsCallbackProxy() override; + virtual ~StartStopDInputsCallbackProxy() override; - void OnResultDhids(const std::string &devId, const int32_t &status) override; + virtual 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 809ea2d..3993bbe 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(); - ~StartStopDInputsCallbackStub() override; + virtual ~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 1a9882b..296d62f 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); - ~StartStopResultCallbackProxy() override; + virtual ~StartStopResultCallbackProxy() override; - void OnStart(const std::string &srcId, const std::string &sinkId, + virtual void OnStart(const std::string &srcId, const std::string &sinkId, std::vector &dhIds) override; - void OnStop(const std::string &srcId, const std::string &sinkId, + virtual 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 00e8b1c..d307798 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(); - ~StartStopResultCallbackStub() override; + virtual ~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 92b28d2..01cfa62 100644 --- a/interfaces/ipc/include/stop_d_input_call_back_proxy.h +++ b/interfaces/ipc/include/stop_d_input_call_back_proxy.h @@ -28,9 +28,10 @@ namespace DistributedInput { class StopDInputCallbackProxy : public IRemoteProxy { public: explicit StopDInputCallbackProxy(const sptr &object); - ~StopDInputCallbackProxy() override; - void OnResult(const std::string& devId, const uint32_t& inputTypes, const int32_t& status) override; + virtual ~StopDInputCallbackProxy() override; + + virtual 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 3649a27..51ed24d 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(); - ~StopDInputCallbackStub() override; + virtual ~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 bae5928..cbcdac3 100644 --- a/interfaces/ipc/include/unprepare_d_input_call_back_proxy.h +++ b/interfaces/ipc/include/unprepare_d_input_call_back_proxy.h @@ -28,9 +28,10 @@ namespace DistributedInput { class UnprepareDInputCallbackProxy : public IRemoteProxy { public: explicit UnprepareDInputCallbackProxy(const sptr &object); - ~UnprepareDInputCallbackProxy() override; - void OnResult(const std::string& deviceId, const int32_t& status) override; + virtual ~UnprepareDInputCallbackProxy() override; + + virtual 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 5ff3c56..52dc4d0 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(); - ~UnprepareDInputCallbackStub() override; + virtual ~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 6502ce3..dd9cacf 100644 --- a/interfaces/ipc/include/unregister_d_input_call_back_proxy.h +++ b/interfaces/ipc/include/unregister_d_input_call_back_proxy.h @@ -28,9 +28,10 @@ namespace DistributedInput { class UnregisterDInputCallbackProxy : public IRemoteProxy { public: explicit UnregisterDInputCallbackProxy(const sptr &object); - ~UnregisterDInputCallbackProxy() override; - void OnResult(const std::string& devId, const std::string& dhId, const int32_t& status) override; + virtual ~UnregisterDInputCallbackProxy() override; + + virtual 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 7aaaa20..547c426 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(); - ~UnregisterDInputCallbackStub() override; + virtual ~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 5412b47..60bcfe6 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 64d226c..d98d59b 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 f5a1e93..25f1346 100644 --- a/services/common/include/dinput_source_trans_callback.h +++ b/services/common/include/dinput_source_trans_callback.h @@ -23,34 +23,34 @@ 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) = 0; - virtual void OnResponseUnprepareRemoteInput(const std::string deviceId, bool result) = 0; - virtual void OnResponseStartRemoteInput(const std::string deviceId, const uint32_t inputTypes, bool result, + virtual void onResponsePrepareRemoteInput(const std::string deviceId, bool result) = 0; + virtual void onResponseUnprepareRemoteInput(const std::string deviceId, bool result) = 0; + virtual void onResponseStartRemoteInput(const std::string deviceId, const uint32_t inputTypes, bool result, const std::string& object) = 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, + 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, const std::string& object) = 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 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) = 0; - virtual void OnResponseRelayUnprepareRemoteInput(int32_t sessionId, const std::string &deviceId, bool result) = 0; - virtual void OnResponseRelayStartDhidRemoteInput(const std::string &deviceId, const std::string &object) = 0; - virtual void OnResponseRelayStartTypeRemoteInput(const std::string &deviceId, const std::string &object) = 0; + virtual void onResponseRelayPrepareRemoteInput(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 onResponseRelayStartDhidRemoteInput(const std::string &deviceId, const std::string &object) = 0; + virtual void onResponseRelayStartTypeRemoteInput(const std::string &deviceId, const std::string &object) = 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 97e84fa..0156fd9 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: - explicit DistributedInputSinkEventHandler(const std::shared_ptr &runner); - ~DistributedInputSinkEventHandler(); + DistributedInputSinkEventHandler(const std::shared_ptr &runner); + virtual ~DistributedInputSinkEventHandler(); 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 62c1825..7ebb2d6 100644 --- a/services/sink/sinkmanager/include/distributed_input_sink_manager.h +++ b/services/sink/sinkmanager/include/distributed_input_sink_manager.h @@ -56,31 +56,31 @@ public: class DInputSinkListener : public DInputSinkTransCallback { public: - explicit DInputSinkListener(DistributedInputSinkManager *manager); + DInputSinkListener(DistributedInputSinkManager *manager); ~DInputSinkListener(); - 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 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); - 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; + 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); private: DistributedInputSinkManager *sinkManagerObj_; - static inline int BitIsSet(const unsigned long *array, int bit) + static inline int bit_is_set(const unsigned long *array, int bit) { return !!(array[bit / LONG_BITS] & (1LL << (bit % LONG_BITS))); } @@ -91,8 +91,8 @@ public: class ProjectWindowListener : public PublisherListenerStub { public: - explicit ProjectWindowListener(DistributedInputSinkManager *manager); - ~ProjectWindowListener() override; + ProjectWindowListener(DistributedInputSinkManager *manager); + ~ProjectWindowListener(); void OnMessage(const DHTopic topic, const std::string& message) override; private: @@ -112,7 +112,7 @@ public: class DScreenSinkSvrRecipient : public IRemoteObject::DeathRecipient { public: DScreenSinkSvrRecipient(const std::string& srcDevId, const uint64_t srcWinId); - ~DScreenSinkSvrRecipient() override; + ~DScreenSinkSvrRecipient(); void OnRemoteDied(const wptr &remote) override; private: @@ -125,11 +125,11 @@ public: void OnStop() 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; uint32_t GetSinkScreenInfosCbackSize(); @@ -139,7 +139,7 @@ public: uint32_t GetInputTypes(); - void SetInputTypes(const uint32_t& inputTypes); + void SetInputTypes(const uint32_t& inputTypess); /* * 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 1a363e6..ee559b4 100644 --- a/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp +++ b/services/sink/sinkmanager/src/distributed_input_sink_manager.cpp @@ -92,7 +92,7 @@ void DistributedInputSinkManager::AddWhiteList(nlohmann::json &jsonStr) } if (vecFilter.empty() || vecFilter[0].empty() || vecFilter[0][0].empty()) { - DHLOGE("OnStartRemoteInput called, white list is null."); + DHLOGE("onStartRemoteInput called, white list is null."); jsonStr[DINPUT_SOFTBUS_KEY_WHITE_LIST] = ""; return; } @@ -101,10 +101,10 @@ void DistributedInputSinkManager::AddWhiteList(nlohmann::json &jsonStr) jsonStr[DINPUT_SOFTBUS_KEY_WHITE_LIST] = object; } -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; @@ -113,10 +113,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)); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SINK_MSG_ONUNPREPARE; @@ -125,10 +125,10 @@ 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("OnRelayPrepareRemoteInput called, toSinkSessionId: %d, devId: %s", toSinkSessionId, + DHLOGI("onRelayPrepareRemoteInput called, toSinkSessionId: %d, devId: %s", toSinkSessionId, GetAnonyString(deviceId).c_str()); nlohmann::json jsonStr; @@ -139,12 +139,12 @@ 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("OnRelayUnprepareRemoteInput called, toSinkSessionId: %d, devId: %s", toSinkSessionId, + DHLOGI("onRelayUnprepareRemoteInput called, toSinkSessionId: %d, devId: %s", toSinkSessionId, GetAnonyString(deviceId).c_str()); - OnStopRemoteInput(toSrcSessionId, static_cast(DInputDeviceType::ALL)); + onStopRemoteInput(toSrcSessionId, static_cast(DInputDeviceType::ALL)); nlohmann::json jsonStr; jsonStr[DINPUT_SOFTBUS_KEY_CMD_TYPE] = TRANS_SINK_MSG_ON_RELAY_UNPREPARE; @@ -154,10 +154,10 @@ 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) { - DHLOGI("OnStartRemoteInput called, sessionId: %d, inputTypes: %u.", sessionId, inputTypes); + DHLOGI("onStartRemoteInput called, sessionId: %d, inputTypes: %u.", sessionId, inputTypes); if (sinkManagerObj_ == nullptr) { DHLOGE("sinkManagerObj is null."); return; @@ -187,7 +187,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnStartRemoteInput( DistributedInputSinkTransport::GetInstance().RespStartRemoteInput(sessionId, smsg); if (startRes != DH_SUCCESS) { - DHLOGE("OnStartRemoteInput startSwitch error."); + DHLOGE("onStartRemoteInput startSwitch error."); return; } @@ -211,10 +211,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()); if (sinkManagerObj_ == nullptr) { DHLOGE("sinkManagerObj is null."); @@ -249,10 +249,10 @@ void DistributedInputSinkManager::DInputSinkListener::OnStopRemoteInput( DistributedInputSinkSwitch::GetInstance().RemoveSession(sessionId); } -void DistributedInputSinkManager::DInputSinkListener::OnStartRemoteInputDhid(const int32_t &sessionId, +void DistributedInputSinkManager::DInputSinkListener::onStartRemoteInputDhid(const int32_t &sessionId, const std::string &strDhids) { - DHLOGI("OnStartRemoteInputDhid called, : sessionId: %d", sessionId); + DHLOGI("onStartRemoteInputDhid called, : sessionId: %d", sessionId); if (sinkManagerObj_ == nullptr) { DHLOGE("sinkManagerObj is null."); return; @@ -281,7 +281,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnStartRemoteInputDhid(con DistributedInputSinkTransport::GetInstance().RespStartRemoteInput(sessionId, smsg); if (startRes != DH_SUCCESS) { - DHLOGE("OnStartRemoteInputDhid StartSwitch error."); + DHLOGE("onStartRemoteInputDhid StartSwitch error."); return; } @@ -294,10 +294,10 @@ void DistributedInputSinkManager::DInputSinkListener::OnStartRemoteInputDhid(con DistributedInputCollector::GetInstance().ReportDhIdSharingState(affDhIds); } -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); if (sinkManagerObj_ == nullptr) { DHLOGE("sinkManagerObj is null."); return; @@ -313,7 +313,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); } @@ -330,17 +330,17 @@ void DistributedInputSinkManager::DInputSinkListener::OnStopRemoteInputDhid(cons 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); } } DistributedInputSinkSwitch::GetInstance().RemoveSession(sessionId); } -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) { - DHLOGI("OnRelayStartDhidRemoteInput called, toSinkSessionId: %d", toSinkSessionId); + DHLOGI("onRelayStartDhidRemoteInput called, toSinkSessionId: %d", toSinkSessionId); if (sinkManagerObj_ == nullptr) { DHLOGE("sinkManagerObj is null."); return; @@ -370,7 +370,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnRelayStartDhidRemoteInpu DistributedInputSinkTransport::GetInstance().RespStartRemoteInput(toSinkSessionId, smsg); if (startRes != DH_SUCCESS) { - DHLOGE("OnRelayStartDhidRemoteInput startSwitch error."); + DHLOGE("onRelayStartDhidRemoteInput startSwitch error."); return; } @@ -384,10 +384,10 @@ void DistributedInputSinkManager::DInputSinkListener::OnRelayStartDhidRemoteInpu DistributedInputCollector::GetInstance().ReportDhIdSharingState(affDhIds); } -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("OnRelayStopDhidRemoteInput called, toSinkSessionId: %d", toSinkSessionId); + DHLOGI("onRelayStopDhidRemoteInput called, toSinkSessionId: %d", toSinkSessionId); if (sinkManagerObj_ == nullptr) { DHLOGE("sinkManagerObj is null."); return; @@ -403,7 +403,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); } @@ -421,17 +421,17 @@ 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); } } DistributedInputSinkSwitch::GetInstance().RemoveSession(toSinkSessionId); } -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) { - DHLOGI("OnRelayStartTypeRemoteInput called, toSinkSessionId: %d", toSinkSessionId); + DHLOGI("onRelayStartTypeRemoteInput called, toSinkSessionId: %d", toSinkSessionId); if (sinkManagerObj_ == nullptr) { DHLOGE("sinkManagerObj is null."); return; @@ -486,7 +486,7 @@ 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) { if (sinkManagerObj_ == nullptr) { @@ -494,7 +494,7 @@ void DistributedInputSinkManager::DInputSinkListener::OnRelayStopTypeRemoteInput return; } - 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() - @@ -587,15 +587,15 @@ void DistributedInputSinkManager::DInputSinkListener::CheckKeyState(const int32_ SleepTimeMs(); continue; } - leftKeyVal = BitIsSet(keystate, BTN_LEFT); + leftKeyVal = bit_is_set(keystate, BTN_LEFT); if (leftKeyVal != 0) { DistributedInputSinkTransport::GetInstance().SendKeyStateNodeMsg(sessionId, dhid, BTN_LEFT); } - rightKeyVal = BitIsSet(keystate, BTN_RIGHT); + rightKeyVal = bit_is_set(keystate, BTN_RIGHT); if (rightKeyVal != 0) { DistributedInputSinkTransport::GetInstance().SendKeyStateNodeMsg(sessionId, dhid, BTN_RIGHT); } - midKeyVal = BitIsSet(keystate, BTN_MIDDLE); + midKeyVal = bit_is_set(keystate, BTN_MIDDLE); if (midKeyVal != 0) { DistributedInputSinkTransport::GetInstance().SendKeyStateNodeMsg(sessionId, dhid, BTN_MIDDLE); } @@ -805,7 +805,7 @@ DInputServerType DistributedInputSinkManager::GetStartTransFlag() } void DistributedInputSinkManager::SetStartTransFlag(const DInputServerType flag) { - DHLOGI("Set Sink isStartTrans_ %d", static_cast(flag)); + DHLOGI("Set Sink isStartTrans_ %d", (int32_t)flag); isStartTrans_ = flag; } @@ -925,8 +925,8 @@ int32_t DistributedInputSinkManager::ProjectWindowListener::UpdateSinkScreenInfo sinkScreenInfo.sinkShowWidth = GetScreenWidth(); sinkScreenInfo.sinkShowHeight = GetScreenHeight(); LocalAbsInfo info = DInputContext::GetInstance().GetLocalTouchScreenInfo().localAbsInfo; - sinkScreenInfo.sinkPhyWidth = static_cast(info.absMtPositionXMax + 1); - sinkScreenInfo.sinkPhyHeight = static_cast(info.absMtPositionYMax + 1); + sinkScreenInfo.sinkPhyWidth = (uint32_t)(info.absMtPositionXMax + 1); + sinkScreenInfo.sinkPhyHeight = (uint32_t)(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 d8896bd..a122c98 100644 --- a/services/sink/transport/include/distributed_input_sink_transport.h +++ b/services/sink/transport/include/distributed_input_sink_transport.h @@ -61,8 +61,8 @@ public: class DInputSinkEventHandler : public AppExecFwk::EventHandler { public: - explicit DInputSinkEventHandler(const std::shared_ptr &runner); - ~DInputSinkEventHandler() override = default; + DInputSinkEventHandler(const std::shared_ptr &runner); + ~DInputSinkEventHandler() {} 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 9e55481..7458d00 100644 --- a/services/sink/transport/src/distributed_input_sink_transport.cpp +++ b/services/sink/transport/src/distributed_input_sink_transport.cpp @@ -249,7 +249,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) @@ -261,7 +261,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) @@ -274,7 +274,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) @@ -286,7 +286,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) @@ -324,7 +324,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) @@ -343,7 +343,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) @@ -360,7 +360,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) @@ -377,7 +377,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) @@ -399,7 +399,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) @@ -421,7 +421,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) @@ -443,7 +443,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) @@ -465,7 +465,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::DInputTransbaseSinkListener::HandleSessionData(int32_t sessionId, diff --git a/services/source/inputinject/include/distributed_input_inject.h b/services/source/inputinject/include/distributed_input_inject.h index 0da45f7..5ec3648 100644 --- a/services/source/inputinject/include/distributed_input_inject.h +++ b/services/source/inputinject/include/distributed_input_inject.h @@ -64,6 +64,9 @@ 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 a7bc086..d7dba66 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: - explicit VirtualDevice(const InputDevice& event); + 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 a2bcf5a..2d3da1a 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: - explicit VirtualKeyboard(const InputDevice& event); - ~VirtualKeyboard() override; + VirtualKeyboard(const InputDevice& event); + ~VirtualKeyboard(); 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 9f974da..def4b88 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: - explicit VirtualMouse(const InputDevice& event); - ~VirtualMouse() override; + VirtualMouse(const InputDevice& event); + ~VirtualMouse(); 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 11635e0..a6dd5cf 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: - explicit VirtualTouchpad(const InputDevice& event); - ~VirtualTouchpad() override; + VirtualTouchpad(const InputDevice& event); + ~VirtualTouchpad(); 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 ba7645d..4ee101c 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() override; + ~VirtualTouchScreen(); 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 bd477c9..0b78cca 100644 --- a/services/source/inputinject/src/distributed_input_node_manager.cpp +++ b/services/source/inputinject/src/distributed_input_node_manager.cpp @@ -284,23 +284,23 @@ int32_t DistributedInputNodeManager::GetDeviceInfo(std::string &deviceId) void DistributedInputNodeManager::GetDevicesInfoByType(const std::string &networkId, uint32_t inputTypes, std::map &datas) { - uint32_t inputType = 0; + uint32_t input_types_ = 0; if ((inputTypes & static_cast(DInputDeviceType::MOUSE)) != 0) { - inputType |= INPUT_DEVICE_CLASS_CURSOR; + input_types_ |= INPUT_DEVICE_CLASS_CURSOR; } if ((inputTypes & static_cast(DInputDeviceType::KEYBOARD)) != 0) { - inputType |= INPUT_DEVICE_CLASS_KEYBOARD; + input_types_ |= INPUT_DEVICE_CLASS_KEYBOARD; } if ((inputTypes & static_cast(DInputDeviceType::MOUSE)) != 0) { - inputType |= INPUT_DEVICE_CLASS_TOUCH; + input_types_ |= INPUT_DEVICE_CLASS_TOUCH; } std::lock_guard lock(virtualDeviceMapMutex_); for (const auto &[id, virdevice] : virtualDeviceMap_) { - if ((virdevice->GetDeviceType() & inputType) && (virdevice->GetNetWorkId() == networkId)) { + if ((virdevice->GetDeviceType() & input_types_) && (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 9d3f843..58a064b 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 = [this](int32_t uiSet, const std::vector& list) -> bool { + auto fun = [&](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 sysfsDeviceName[16]; - if (ioctl(fd_, UI_GET_SYSNAME(sizeof(sysfsDeviceName)), sysfsDeviceName) < 0) { + char sysfs_device_name[16]; + if (ioctl(fd_, UI_GET_SYSNAME(sizeof(sysfs_device_name)), sysfs_device_name) < 0) { DHLOGE("Unable to get input device name"); } - DHLOGI("get input device name: %s, fd: %d", GetAnonyString(sysfsDeviceName).c_str(), fd_); + DHLOGI("get input device name: %s, fd: %d", GetAnonyString(sysfs_device_name).c_str(), fd_); return true; } diff --git a/services/source/inputinject/src/virtual_touchpad.cpp b/services/source/inputinject/src/virtual_touchpad.cpp index 1f7d206..e76e805 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 absMaxWheel = 71; + const int ABS_MAX_WHEEL = 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] = absMaxWheel; + dev_.absmax[ABS_WHEEL] = ABS_MAX_WHEEL; 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 f5e855f..49c4e92 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] = static_cast(phyWidth); + dev_.absmax[ABS_X] = (int32_t)phyWidth; dev_.absfuzz[ABS_X] = 0; dev_.absflat[ABS_X] = 0; dev_.absmin[ABS_Y] = 0; - dev_.absmax[ABS_Y] = static_cast(phyHeight); + dev_.absmax[ABS_Y] = (int32_t)phyHeight; dev_.absfuzz[ABS_Y] = 0; dev_.absflat[ABS_Y] = 0; @@ -70,7 +70,7 @@ 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] = static_cast(phyHeight); + dev_.absmax[ABS_MT_POSITION_X] = (int32_t)phyWidth; dev_.absfuzz[ABS_MT_POSITION_X] = 0; dev_.absflat[ABS_MT_POSITION_X] = 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 8b1797f..d344979 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: - explicit DistributedInputSourceEventHandler(const std::shared_ptr &runner); - ~DistributedInputSourceEventHandler() override; + DistributedInputSourceEventHandler(const std::shared_ptr &runner); + virtual ~DistributedInputSourceEventHandler(); 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 5c90225..12c1395 100644 --- a/services/source/sourcemanager/include/distributed_input_source_manager.h +++ b/services/source/sourcemanager/include/distributed_input_source_manager.h @@ -119,65 +119,65 @@ typedef struct InputDeviceId { public: DistributedInputSourceManager(int32_t saId, bool runOnCreate); - ~DistributedInputSourceManager() override; + ~DistributedInputSourceManager(); void OnStart() override; void OnStop() override; - int32_t Init() override; + virtual int32_t Init() override; - int32_t Release() override; + virtual int32_t Release() override; - int32_t RegisterDistributedHardware(const std::string& devId, const std::string& dhId, + virtual int32_t RegisterDistributedHardware(const std::string& devId, const std::string& dhId, const std::string& parameters, sptr callback) override; - int32_t UnregisterDistributedHardware(const std::string& devId, const std::string& dhId, + virtual int32_t UnregisterDistributedHardware(const std::string& devId, const std::string& dhId, sptr callback) override; - int32_t PrepareRemoteInput(const std::string &deviceId, sptr callback) override; + virtual int32_t PrepareRemoteInput(const std::string &deviceId, sptr callback) override; - int32_t UnprepareRemoteInput(const std::string &deviceId, sptr callback) override; + virtual int32_t UnprepareRemoteInput(const std::string &deviceId, sptr callback) override; - int32_t StartRemoteInput( + virtual int32_t StartRemoteInput( const std::string& deviceId, const uint32_t& inputTypes, sptr callback) override; - int32_t StopRemoteInput( + virtual int32_t StopRemoteInput( const std::string& deviceId, const uint32_t& inputTypes, sptr callback) override; - int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, + virtual int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, sptr callback) override; - int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, + virtual int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, const uint32_t &inputTypes, sptr callback) override; - int32_t PrepareRemoteInput(const std::string &srcId, const std::string &sinkId, + virtual int32_t PrepareRemoteInput(const std::string &srcId, const std::string &sinkId, sptr callback) override; - int32_t UnprepareRemoteInput(const std::string &srcId, const std::string &sinkId, + virtual int32_t UnprepareRemoteInput(const std::string &srcId, const std::string &sinkId, sptr callback) override; - int32_t StartRemoteInput(const std::string &sinkId, const std::vector &dhIds, + virtual int32_t StartRemoteInput(const std::string &sinkId, const std::vector &dhIds, sptr callback) override; - int32_t StopRemoteInput(const std::string &sinkId, const std::vector &dhIds, + virtual int32_t StopRemoteInput(const std::string &sinkId, const std::vector &dhIds, sptr callback) override; - int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, + virtual int32_t StartRemoteInput(const std::string &srcId, const std::string &sinkId, const std::vector &dhIds, sptr callback) override; - int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, + virtual int32_t StopRemoteInput(const std::string &srcId, const std::string &sinkId, const std::vector &dhIds, sptr callback) 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 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 SyncNodeInfoRemoteInput(const std::string &userDevId, const std::string &dhId, + virtual int32_t SyncNodeInfoRemoteInput(const std::string &userDevId, const std::string &dhId, const std::string &nodeDesc) override; - int32_t RegisterSimulationEventListener(sptr listener) override; - int32_t UnregisterSimulationEventListener(sptr listener) override; + virtual int32_t RegisterSimulationEventListener(sptr listener) override; + virtual 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, @@ -186,37 +186,35 @@ public: class DInputSourceListener : public DInputSourceTransCallback { public: - explicit DInputSourceListener(DistributedInputSourceManager *manager); + DInputSourceListener(DistributedInputSourceManager *manager); virtual ~DInputSourceListener(); - void OnResponseRegisterDistributedHardware(const std::string deviceId, const std::string dhId, - bool result) override; - void OnResponsePrepareRemoteInput(const std::string deviceId, bool result) override; - void OnResponseUnprepareRemoteInput(const std::string deviceId, bool result) override; - void OnResponseStartRemoteInput(const std::string deviceId, const uint32_t inputTypes, bool result, - const std::string &object) 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, - const std::string &object) 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) override; - void OnResponseRelayUnprepareRemoteInput(int32_t sessionId, const std::string &deviceId, bool result) override; - void OnResponseRelayStartDhidRemoteInput(const std::string &deviceId, const std::string &object) override; - void OnResponseRelayStartTypeRemoteInput(const std::string &deviceId, const std::string &object) override; + void onResponseRegisterDistributedHardware(const std::string deviceId, const std::string dhId, bool result); + void onResponsePrepareRemoteInput(const std::string deviceId, bool result); + void onResponseUnprepareRemoteInput(const std::string deviceId, bool result); + void onResponseStartRemoteInput(const std::string deviceId, const uint32_t inputTypes, bool result, + const std::string &object); + void onResponseStopRemoteInput(const std::string deviceId, const uint32_t inputTypes, bool result); + void onResponseStartRemoteInputDhid(const std::string deviceId, const std::string &dhids, bool result, + const std::string &object); + 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); + void onResponseRelayUnprepareRemoteInput(int32_t sessionId, const std::string &deviceId, bool result); + void onResponseRelayStartDhidRemoteInput(const std::string &deviceId, const std::string &object); + void onResponseRelayStartTypeRemoteInput(const std::string &deviceId, const std::string &object); - 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 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 RecordEventLog(int64_t when, int32_t type, int32_t code, int32_t value, const std::string& path); private: @@ -227,7 +225,7 @@ public: public: DInputSourceManagerEventHandler(const std::shared_ptr &runner, DistributedInputSourceManager *manager); - ~DInputSourceManagerEventHandler() override; + ~DInputSourceManagerEventHandler(); void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) override; private: @@ -259,7 +257,7 @@ public: class StartDScreenListener : public PublisherListenerStub { public: StartDScreenListener(); - ~StartDScreenListener() override; + ~StartDScreenListener(); void OnMessage(const DHTopic topic, const std::string& message) override; private: @@ -270,7 +268,7 @@ public: class StopDScreenListener : public PublisherListenerStub { public: StopDScreenListener(); - ~StopDScreenListener() override; + ~StopDScreenListener(); void OnMessage(const DHTopic topic, const std::string& message) override; private: @@ -279,10 +277,11 @@ public: class DeviceOfflineListener : public PublisherListenerStub { public: - explicit DeviceOfflineListener(DistributedInputSourceManager* srcManagerContext); - ~DeviceOfflineListener() override; + DeviceOfflineListener(DistributedInputSourceManager* srcManagerContext); - void OnMessage(const DHTopic topic, const std::string& message) override; + ~DeviceOfflineListener(); + + void OnMessage(const DHTopic topic, const std::string& message); private: void DeleteNodeInfoAndNotify(const std::string& offlineDevId); @@ -294,7 +293,7 @@ public: class DScreenSourceSvrRecipient : public IRemoteObject::DeathRecipient { public: DScreenSourceSvrRecipient(const std::string& srcDevId, const std::string& sinkDevId, const uint64_t srcWinId); - ~DScreenSourceSvrRecipient() override; + ~DScreenSourceSvrRecipient(); 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 e3216be..8594502 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 @@ -44,7 +44,7 @@ private: }; sptr remoteCliDeathRcv; sptr GetRemoteCliFromCache(const std::string &devId); - void AddRemoteCli(const std::string &devId, sptr remote); + void AddRemoteCli(const std::string &devId, sptr object); void DeleteRemoteCli(const std::string &devId); void DeleteRemoteCli(const sptr object); void ProcRemoteCliDied(const sptr& remote); diff --git a/services/source/sourcemanager/src/distributed_input_source_manager.cpp b/services/source/sourcemanager/src/distributed_input_source_manager.cpp index cfe673a..c4e1401 100644 --- a/services/source/sourcemanager/src/distributed_input_source_manager.cpp +++ b/services/source/sourcemanager/src/distributed_input_source_manager.cpp @@ -76,19 +76,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; } @@ -104,20 +104,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) { - 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); - DHLOGE("OnResponsePrepareRemoteInput GetCallbackEventHandler is null."); + DHLOGE("onResponsePrepareRemoteInput GetCallbackEventHandler is null."); return; } std::shared_ptr jsonArrayMsg = std::make_shared(); @@ -130,20 +130,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(); @@ -157,12 +157,12 @@ 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) { - DHLOGI("OnResponseRelayPrepareRemoteInput deviceId: %s, result: %d.", GetAnonyString(deviceId).c_str(), result); + DHLOGI("onResponseRelayPrepareRemoteInput deviceId: %s, result: %d.", GetAnonyString(deviceId).c_str(), result); if (sourceManagerObj_ == nullptr) { - DHLOGE("OnResponseRelayPrepareRemoteInput sourceManagerObj is null."); + DHLOGE("onResponseRelayPrepareRemoteInput sourceManagerObj is null."); return; } if (sourceManagerObj_->GetCallbackEventHandler() == nullptr) { @@ -180,12 +180,12 @@ 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("OnResponseRelayUnprepareRemoteInput deviceId: %s, result: %d.", GetAnonyString(deviceId).c_str(), result); + DHLOGI("onResponseRelayUnprepareRemoteInput deviceId: %s, result: %d.", GetAnonyString(deviceId).c_str(), result); if (sourceManagerObj_ == nullptr) { - DHLOGE("OnResponseRelayUnprepareRemoteInput sourceManagerObj is null."); + DHLOGE("onResponseRelayUnprepareRemoteInput sourceManagerObj is null."); return; } if (sourceManagerObj_->GetCallbackEventHandler() == nullptr) { @@ -203,7 +203,7 @@ void DistributedInputSourceManager::DInputSourceListener::OnResponseRelayUnprepa sourceManagerObj_->GetCallbackEventHandler()->SendEvent(msgEvent, 0, AppExecFwk::EventQueue::Priority::IMMEDIATE); } -void DistributedInputSourceManager::DInputSourceListener::OnResponseRelayStartDhidRemoteInput( +void DistributedInputSourceManager::DInputSourceListener::onResponseRelayStartDhidRemoteInput( const std::string &deviceId, const std::string &object) { DHLOGI("Device whitelist object: %s", object.c_str()); @@ -214,7 +214,7 @@ void DistributedInputSourceManager::DInputSourceListener::OnResponseRelayStartDh sourceManagerObj_->RunWhiteListCallback(deviceId, object); } -void DistributedInputSourceManager::DInputSourceListener::OnResponseRelayStartTypeRemoteInput( +void DistributedInputSourceManager::DInputSourceListener::onResponseRelayStartTypeRemoteInput( const std::string &deviceId, const std::string &object) { DHLOGI("Device whitelist object: %s", object.c_str()); @@ -225,20 +225,20 @@ void DistributedInputSourceManager::DInputSourceListener::OnResponseRelayStartTy sourceManagerObj_->RunWhiteListCallback(deviceId, object); } -void DistributedInputSourceManager::DInputSourceListener::OnResponseStartRemoteInput( +void DistributedInputSourceManager::DInputSourceListener::onResponseStartRemoteInput( const std::string deviceId, const uint32_t inputTypes, bool result, const std::string &object) { - 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, object); - DHLOGE("OnResponseStartRemoteInput GetCallbackEventHandler is null."); + DHLOGE("onResponseStartRemoteInput GetCallbackEventHandler is null."); return; } if (result) { @@ -257,18 +257,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; @@ -285,18 +285,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, const std::string &object) { - 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, object); return; @@ -317,18 +317,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; @@ -344,7 +344,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(), @@ -371,7 +371,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); @@ -380,7 +380,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]; @@ -400,7 +400,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()); @@ -423,7 +423,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()); @@ -446,7 +446,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()); @@ -470,7 +470,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()); @@ -494,7 +494,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()); @@ -518,7 +518,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()); @@ -2560,7 +2560,7 @@ DInputServerType DistributedInputSourceManager::GetStartTransFlag() void DistributedInputSourceManager::SetStartTransFlag(const DInputServerType flag) { - DHLOGI("Set Source isStartTrans_ %d", static_cast(flag)); + DHLOGI("Set Source isStartTrans_ %d", (int32_t)flag); isStartTrans_ = flag; } @@ -2791,7 +2791,7 @@ int32_t DistributedInputSourceManager::StartDScreenListener::UpdateSrcScreenInfo DHLOGE("virtualScreenFd is invalid"); return ERR_DH_INPUT_SERVER_SOURCE_VIRTUAL_SCREEN_NODE_IS_INVALID; } - srcScreenInfo.sourcePhyFd = static_cast(virtualScreenFd); + srcScreenInfo.sourcePhyFd = (uint32_t)virtualScreenFd; srcScreenInfo.sourcePhyWidth = TmpInfo.sourceWinWidth; srcScreenInfo.sourcePhyHeight = TmpInfo.sourceWinHeight; DHLOGI("StartDScreenListener UpdateSrcScreenInfo the data: devId: %s, sourceWinId: %d, sourceWinWidth: %d," diff --git a/services/source/transport/src/distributed_input_source_transport.cpp b/services/source/transport/src/distributed_input_source_transport.cpp index c26d39f..9317298 100644 --- a/services/source/transport/src/distributed_input_source_transport.cpp +++ b/services/source/transport/src/distributed_input_source_transport.cpp @@ -806,7 +806,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]); } void DistributedInputSourceTransport::NotifyResponseUnprepareRemoteInput(int32_t sessionId, @@ -822,7 +822,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(deviceId); } @@ -839,7 +839,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], recMsg[DINPUT_SOFTBUS_KEY_WHITE_LIST]); } @@ -856,7 +856,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]); } @@ -874,7 +874,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], recMsg[DINPUT_SOFTBUS_KEY_WHITE_LIST]); } @@ -891,7 +891,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]); } @@ -903,7 +903,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]); } @@ -922,7 +922,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::ReceiveSrcTSrcRelayPrepare(int32_t sessionId, const nlohmann::json &recMsg) @@ -937,13 +937,13 @@ void DistributedInputSourceTransport::ReceiveSrcTSrcRelayPrepare(int32_t session int32_t ret = OpenInputSoftbus(peerDevId); if (ret != DH_SUCCESS) { - callback_->OnResponseRelayPrepareRemoteInput(sessionId, peerDevId, false); + callback_->onResponseRelayPrepareRemoteInput(sessionId, peerDevId, false); return; } ret = PrepareRemoteInput(sessionId, peerDevId); if (ret != DH_SUCCESS) { - callback_->OnResponseRelayPrepareRemoteInput(sessionId, peerDevId, false); + callback_->onResponseRelayPrepareRemoteInput(sessionId, peerDevId, false); return; } } @@ -960,7 +960,7 @@ void DistributedInputSourceTransport::ReceiveSrcTSrcRelayUnprepare(int32_t sessi int32_t ret = UnprepareRemoteInput(sessionId, peerDevId); if (ret != DH_SUCCESS) { DHLOGE("Can not send message by softbus, unprepare fail."); - callback_->OnResponseRelayUnprepareRemoteInput(sessionId, peerDevId, false); + callback_->onResponseRelayUnprepareRemoteInput(sessionId, peerDevId, false); return; } } @@ -979,7 +979,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]); } @@ -997,7 +997,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]); int32_t toSrcSessionId = recMsg[DINPUT_SOFTBUS_KEY_SESSION_ID]; @@ -1020,7 +1020,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) @@ -1036,7 +1036,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(srcId); } @@ -1112,7 +1112,7 @@ void DistributedInputSourceTransport::NotifyResponseRelayStartDhidRemoteInput(in std::string dhids = recMsg[DINPUT_SOFTBUS_KEY_VECTOR_DHID]; NotifyOriginStartDhidResult(srcTsrcSeId, localNetworkId, sinkDevId, result ? DH_SUCCESS : ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_MSG_IS_BAD, dhids); - callback_->OnResponseRelayStartDhidRemoteInput(sinkDevId, recMsg[DINPUT_SOFTBUS_KEY_WHITE_LIST]); + callback_->onResponseRelayStartDhidRemoteInput(sinkDevId, recMsg[DINPUT_SOFTBUS_KEY_WHITE_LIST]); } void DistributedInputSourceTransport::NotifyResponseRelayStopDhidRemoteInput(int32_t sessionId, @@ -1157,7 +1157,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) @@ -1175,7 +1175,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) @@ -1250,7 +1250,7 @@ void DistributedInputSourceTransport::NotifyResponseRelayStartTypeRemoteInput(in uint32_t inputTypes = recMsg[DINPUT_SOFTBUS_KEY_INPUT_TYPE]; NotifyOriginStartTypeResult(srcTsrcSeId, localNetworkId, sinkDevId, result ? DH_SUCCESS : ERR_DH_INPUT_SERVER_SOURCE_MANAGER_START_MSG_IS_BAD, inputTypes); - callback_->OnResponseRelayStartTypeRemoteInput(sinkDevId, recMsg[DINPUT_SOFTBUS_KEY_WHITE_LIST]); + callback_->onResponseRelayStartTypeRemoteInput(sinkDevId, recMsg[DINPUT_SOFTBUS_KEY_WHITE_LIST]); } void DistributedInputSourceTransport::NotifyResponseRelayStopTypeRemoteInput(int32_t sessionId, @@ -1295,7 +1295,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) @@ -1313,7 +1313,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::DInputTransbaseSourceListener::HandleSessionData(int32_t sessionId, diff --git a/sinkhandler/include/distributed_input_sink_handler.h b/sinkhandler/include/distributed_input_sink_handler.h index e4e4569..7939300 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& params) override; + int32_t SubscribeLocalHardware(const std::string& dhId, const std::string& parameters) override; int32_t UnsubscribeLocalHardware(const std::string& dhId) override; void FinishStartSA(const std::string ¶ms, const sptr &remoteObject); diff --git a/utils/src/dinput_context.cpp b/utils/src/dinput_context.cpp index 22bf0d5..1030d0f 100644 --- a/utils/src/dinput_context.cpp +++ b/utils/src/dinput_context.cpp @@ -135,24 +135,24 @@ int32_t DInputContext::CalculateTransformInfo(SinkScreenInfo &sinkScreenInfo) return ERR_DH_INPUT_CONTEXT_CALCULATE_FAIL; } TransformInfo transformInfo; - transformInfo.sinkWinPhyX = static_cast(sinkScreenInfo.sinkWinShowX / - static_cast(sinkScreenInfo.sinkShowWidth)) * sinkScreenInfo.sinkPhyWidth; - transformInfo.sinkWinPhyY = static_cast(sinkScreenInfo.sinkWinShowY / - static_cast(sinkScreenInfo.sinkShowHeight)) * sinkScreenInfo.sinkPhyHeight; - transformInfo.sinkProjPhyWidth = static_cast((sinkScreenInfo.sinkProjShowWidth / - static_cast(sinkScreenInfo.sinkShowWidth)) * sinkScreenInfo.sinkPhyWidth); - transformInfo.sinkProjPhyHeight = static_cast((sinkScreenInfo.sinkProjShowHeight / - static_cast(sinkScreenInfo.sinkShowHeight)) * sinkScreenInfo.sinkPhyHeight); + transformInfo.sinkWinPhyX = (uint32_t)(sinkScreenInfo.sinkWinShowX / (double)(sinkScreenInfo.sinkShowWidth)) * + sinkScreenInfo.sinkPhyWidth; + transformInfo.sinkWinPhyY = (uint32_t)(sinkScreenInfo.sinkWinShowY / (double)(sinkScreenInfo.sinkShowHeight)) * + sinkScreenInfo.sinkPhyHeight; + transformInfo.sinkProjPhyWidth = (uint32_t)((sinkScreenInfo.sinkProjShowWidth / + (double)sinkScreenInfo.sinkShowWidth) * sinkScreenInfo.sinkPhyWidth); + transformInfo.sinkProjPhyHeight = (uint32_t)((sinkScreenInfo.sinkProjShowHeight / + (double)sinkScreenInfo.sinkShowHeight) * sinkScreenInfo.sinkPhyHeight); if (transformInfo.sinkProjPhyWidth == 0 || transformInfo.sinkProjPhyHeight == 0) { DHLOGE("can not calculate transform infomation"); return ERR_DH_INPUT_CONTEXT_CALCULATE_FAIL; } // coefficient of the sink projection area in the source touch driver - transformInfo.coeffWidth = static_cast(sinkScreenInfo.srcScreenInfo.sourcePhyWidth / - static_cast(transformInfo.sinkProjPhyWidth)); - transformInfo.coeffHeight = static_cast(sinkScreenInfo.srcScreenInfo.sourcePhyHeight / - static_cast(transformInfo.sinkProjPhyHeight)); + transformInfo.coeffWidth = (double)(sinkScreenInfo.srcScreenInfo.sourcePhyWidth / + (double)(transformInfo.sinkProjPhyWidth)); + transformInfo.coeffHeight = (double)(sinkScreenInfo.srcScreenInfo.sourcePhyHeight / + (double)(transformInfo.sinkProjPhyHeight)); DHLOGI("CalculateTransformInfo sinkWinPhyX = %d, sinkWinPhyY = %d, sinkProjPhyWidth = %d, " + "sinkProjPhyHeight = %d, coeffWidth = %f, coeffHeight = %f", transformInfo.sinkWinPhyX,