mirror of
https://github.com/openharmony/distributedhardware_distributed_input.git
synced 2026-07-18 16:04:40 -04:00
remove no use node listener
Signed-off-by: hwzhangchuang <zhangchuang.zhang@huawei.com>
This commit is contained in:
@@ -152,13 +152,8 @@ namespace DistributedInput {
|
||||
constexpr int32_t ERR_DH_INPUT_SOURCE_PROXY_IS_START_INPUT_FAIL = -67032;
|
||||
constexpr int32_t ERR_DH_INPUT_SOURCE_PROXY_REGISTER_WHITELIST_FAIL = -67033;
|
||||
constexpr int32_t ERR_DH_INPUT_SOURCE_PROXY_UNREGISTER_WHITELIST_FAIL = -67034;
|
||||
constexpr int32_t ERR_DH_INPUT_SOURCE_PROXY_REGISTER_NODE_LISTENER_FAIL = -67035;
|
||||
constexpr int32_t ERR_DH_INPUT_SOURCE_PROXY_UNREGISTER_NODE_LISTENER_FAIL = -67036;
|
||||
constexpr int32_t ERR_DH_INPUT_SOURCE_PROXY_REGISTER_SIMULATION_LISTENER_FAIL = -67037;
|
||||
constexpr int32_t ERR_DH_INPUT_SOURCE_PROXY_UNREGISTER_SIMULATION_LISTENER_FAIL = -67038;
|
||||
constexpr int32_t ERR_DH_INPUT_SOURCE_PROXY_SYNC_NODE_FAIL = -67039;
|
||||
constexpr int32_t ERR_DH_INPUT_SOURCE_STUB_REGISTER_NODE_LISTENER_FAIL = -67040;
|
||||
constexpr int32_t ERR_DH_INPUT_SOURCE_STUB_UNREGISTER_NODE_LISTENER_FAIL = -67041;
|
||||
constexpr int32_t ERR_DH_INPUT_SOURCE_STUB_REGISTER_SIMULATION_EVENT_LISTENER_FAIL = -67042;
|
||||
constexpr int32_t ERR_DH_INPUT_SOURCE_STUB_UNREGISTER_SIMULATION_EVENT_LISTENER_FAIL = -67043;
|
||||
constexpr int32_t ERR_DH_INPUT_SOURCE_STUB_ON_REMOTE_REQUEST_FAIL = -67044;
|
||||
|
||||
@@ -40,8 +40,6 @@ enum class IDInputSourceInterfaceCode : uint32_t {
|
||||
STOP_RELAY_DHID_REMOTE_INPUT = 0xf011U,
|
||||
REGISTER_ADD_WHITE_LIST_CB_REMOTE_INPUT = 0xf013U,
|
||||
REGISTER_DEL_WHITE_LIST_CB_REMOTE_INPUT = 0xf014U,
|
||||
REGISTER_NODE_LISTENER = 0xf015U,
|
||||
UNREGISTER_NODE_LISTENER = 0xf016U,
|
||||
REGISTER_SIMULATION_EVENT_LISTENER = 0xf017U,
|
||||
UNREGISTER_SIMULATION_EVENT_LISTENER = 0xf018U,
|
||||
SYNC_NODE_INFO_REMOTE_INPUT = 0xf019U,
|
||||
|
||||
@@ -92,11 +92,7 @@ public:
|
||||
|
||||
virtual int32_t RegisterAddWhiteListCallback(sptr<IAddWhiteListInfosCallback> addWhiteListCallback) = 0;
|
||||
virtual int32_t RegisterDelWhiteListCallback(sptr<IDelWhiteListInfosCallback> delWhiteListCallback) = 0;
|
||||
virtual int32_t RegisterInputNodeListener(sptr<InputNodeListener> listener) = 0;
|
||||
virtual int32_t UnregisterInputNodeListener(sptr<InputNodeListener> listener) = 0;
|
||||
|
||||
virtual int32_t SyncNodeInfoRemoteInput(const std::string &userDevId, const std::string &dhid,
|
||||
const std::string &nodeDesc) = 0;
|
||||
virtual int32_t RegisterSimulationEventListener(sptr<ISimulationEventListener> listener) = 0;
|
||||
virtual int32_t UnregisterSimulationEventListener(sptr<ISimulationEventListener> listener) = 0;
|
||||
virtual int32_t RegisterSessionStateCb(sptr<ISessionStateCallback> callback) = 0;
|
||||
|
||||
@@ -77,8 +77,6 @@ public:
|
||||
*/
|
||||
static bool IsStartDistributedInput(const std::string &dhId);
|
||||
|
||||
static int32_t RegisterInputNodeListener(sptr<InputNodeListener> listener);
|
||||
static int32_t UnregisterInputNodeListener(sptr<InputNodeListener> listener);
|
||||
static int32_t RegisterSimulationEventListener(sptr<ISimulationEventListener> listener);
|
||||
static int32_t UnregisterSimulationEventListener(sptr<ISimulationEventListener> listener);
|
||||
|
||||
|
||||
@@ -110,16 +110,6 @@ int32_t DistributedInputKit::StopRemoteInput(const std::string &srcId, const std
|
||||
return DistributedInputClient::GetInstance().StopRemoteInput(srcId, sinkId, dhIds, callback);
|
||||
}
|
||||
|
||||
int32_t DistributedInputKit::RegisterInputNodeListener(sptr<InputNodeListener> listener)
|
||||
{
|
||||
return DistributedInputClient::GetInstance().RegisterInputNodeListener(listener);
|
||||
}
|
||||
|
||||
int32_t DistributedInputKit::UnregisterInputNodeListener(sptr<InputNodeListener> listener)
|
||||
{
|
||||
return DistributedInputClient::GetInstance().UnregisterInputNodeListener(listener);
|
||||
}
|
||||
|
||||
int32_t DistributedInputKit::RegisterSimulationEventListener(sptr<ISimulationEventListener> listener)
|
||||
{
|
||||
return DistributedInputClient::GetInstance().RegisterSimulationEventListener(listener);
|
||||
|
||||
@@ -459,34 +459,6 @@ HWTEST_F(DistributedInputInnerTest, IsStartDistributedInput03, testing::ext::Tes
|
||||
EXPECT_EQ(true, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputInnerTest, RegisterInputNodeListener01, testing::ext::TestSize.Level0)
|
||||
{
|
||||
sptr<TestInputNodeListener> listener(new TestInputNodeListener());
|
||||
int32_t ret = DistributedInputKit::RegisterInputNodeListener(listener);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputInnerTest, RegisterInputNodeListener02, testing::ext::TestSize.Level0)
|
||||
{
|
||||
sptr<TestInputNodeListener> listener = nullptr;
|
||||
int32_t ret = DistributedInputKit::RegisterInputNodeListener(listener);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputInnerTest, UnregisterInputNodeListener01, testing::ext::TestSize.Level0)
|
||||
{
|
||||
sptr<TestInputNodeListener> listener(new TestInputNodeListener());
|
||||
int32_t ret = DistributedInputKit::UnregisterInputNodeListener(listener);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputInnerTest, UnregisterInputNodeListener02, testing::ext::TestSize.Level0)
|
||||
{
|
||||
sptr<TestInputNodeListener> listener = nullptr;
|
||||
int32_t ret = DistributedInputKit::UnregisterInputNodeListener(listener);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputInnerTest, RegisterSimulationEventListener01, testing::ext::TestSize.Level0)
|
||||
{
|
||||
sptr<TestSimulationEventListenerStub> listener(new TestSimulationEventListenerStub());
|
||||
|
||||
@@ -218,16 +218,6 @@ bool DistributedInputClient::IsStartDistributedInput(const std::string &dhId)
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t DistributedInputClient::RegisterInputNodeListener(sptr<InputNodeListener> listener)
|
||||
{
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t DistributedInputClient::UnregisterInputNodeListener(sptr<InputNodeListener> listener)
|
||||
{
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t DistributedInputClient::RegisterSimulationEventListener(sptr<ISimulationEventListener> listener)
|
||||
{
|
||||
return DH_SUCCESS;
|
||||
|
||||
@@ -101,9 +101,6 @@ public:
|
||||
int32_t NotifyStartDScreen(const std::string &networkId, const std::string &srcDevId, const uint64_t srcWinId);
|
||||
int32_t NotifyStopDScreen(const std::string &networkId, const std::string &srcScreenInfoKey);
|
||||
|
||||
int32_t RegisterInputNodeListener(sptr<InputNodeListener> listener);
|
||||
int32_t UnregisterInputNodeListener(sptr<InputNodeListener> listener);
|
||||
|
||||
int32_t RegisterSimulationEventListener(sptr<ISimulationEventListener> listener);
|
||||
int32_t UnregisterSimulationEventListener(sptr<ISimulationEventListener> listener);
|
||||
|
||||
|
||||
@@ -76,11 +76,7 @@ public:
|
||||
|
||||
int32_t RegisterAddWhiteListCallback(sptr<IAddWhiteListInfosCallback> addWhiteListCallback) override;
|
||||
int32_t RegisterDelWhiteListCallback(sptr<IDelWhiteListInfosCallback> delWhiteListCallback) override;
|
||||
int32_t RegisterInputNodeListener(sptr<InputNodeListener> listener) override;
|
||||
int32_t UnregisterInputNodeListener(sptr<InputNodeListener> listener) override;
|
||||
|
||||
int32_t SyncNodeInfoRemoteInput(const std::string &userDevId, const std::string &dhid,
|
||||
const std::string &nodeDesc) override;
|
||||
int32_t RegisterSimulationEventListener(sptr<ISimulationEventListener> listener) override;
|
||||
int32_t UnregisterSimulationEventListener(sptr<ISimulationEventListener> listener) override;
|
||||
|
||||
|
||||
@@ -54,9 +54,6 @@ private:
|
||||
int32_t HandleStopRelayDhidRemoteInput(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleRegisterAddWhiteListCallback(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleRegisterDelWhiteListCallback(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleRegisterInputNodeListener(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleUnRegisterInputNodeListener(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleSyncNodeInfoRemoteInput(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleRegisterSimulationEventListener(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleUnregisterSimulationEventListener(MessageParcel &data, MessageParcel &reply);
|
||||
int32_t HandleRegisterSessionStateCb(MessageParcel &data, MessageParcel &reply);
|
||||
|
||||
@@ -160,7 +160,6 @@ void DistributedInputClient::CheckSourceRegisterCallback()
|
||||
isSimulationEventCbReg.load());
|
||||
|
||||
CheckWhiteListCallback();
|
||||
CheckNodeMonitorCallback();
|
||||
CheckKeyStateCallback();
|
||||
}
|
||||
|
||||
@@ -223,19 +222,6 @@ void DistributedInputClient::CheckWhiteListCallback()
|
||||
}
|
||||
}
|
||||
|
||||
void DistributedInputClient::CheckNodeMonitorCallback()
|
||||
{
|
||||
if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
DHLOGE("CheckNodeMonitorCallback client get source proxy fail");
|
||||
return;
|
||||
}
|
||||
if (!isNodeMonitorCbReg && regNodeListener_ != nullptr) {
|
||||
DHLOGI("CheckNodeMonitorCallback need continue register regNodeListener_.");
|
||||
DInputSAManager::GetInstance().dInputSourceProxy_->RegisterInputNodeListener(regNodeListener_);
|
||||
isNodeMonitorCbReg = true;
|
||||
}
|
||||
}
|
||||
|
||||
void DistributedInputClient::CheckKeyStateCallback()
|
||||
{
|
||||
if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
@@ -580,50 +566,6 @@ bool DistributedInputClient::IsStartDistributedInput(const std::string &dhId)
|
||||
return sharingDhIds_.find(dhId) != sharingDhIds_.end();
|
||||
}
|
||||
|
||||
int32_t DistributedInputClient::RegisterInputNodeListener(sptr<InputNodeListener> listener)
|
||||
{
|
||||
DHLOGI("RegisterInputNodeListener called");
|
||||
if (listener == nullptr) {
|
||||
DHLOGE("RegisterInputNodeListener param error, client fail");
|
||||
return ERR_DH_INPUT_CLIENT_REG_NODE_CB_FAIL;
|
||||
}
|
||||
if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
DHLOGE("RegisterInputNodeListener proxy error, client fail");
|
||||
isNodeMonitorCbReg = false;
|
||||
regNodeListener_ = listener;
|
||||
return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL;
|
||||
}
|
||||
|
||||
int32_t ret = DInputSAManager::GetInstance().dInputSourceProxy_->RegisterInputNodeListener(listener);
|
||||
if (ret == DH_SUCCESS) {
|
||||
isNodeMonitorCbReg = true;
|
||||
} else {
|
||||
isNodeMonitorCbReg = false;
|
||||
regNodeListener_ = listener;
|
||||
DHLOGE("RegisterInputNodeListener Failed, ret = %d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t DistributedInputClient::UnregisterInputNodeListener(sptr<InputNodeListener> listener)
|
||||
{
|
||||
DHLOGI("UnregisterInputNodeListener called");
|
||||
if (listener == nullptr) {
|
||||
DHLOGE("UnregisterInputNodeListener param error, client fail");
|
||||
return ERR_DH_INPUT_CLIENT_UNREG_NODE_CB_FAIL;
|
||||
}
|
||||
if (!DInputSAManager::GetInstance().GetDInputSourceProxy()) {
|
||||
DHLOGE("UnregisterInputNodeListener proxy error, client fail");
|
||||
return ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL;
|
||||
}
|
||||
|
||||
int32_t ret = DInputSAManager::GetInstance().dInputSourceProxy_->UnregisterInputNodeListener(listener);
|
||||
if (ret != DH_SUCCESS) {
|
||||
DHLOGE("DInputSAManager UnregisterInputNodeListener Failed, ret = %d", ret);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t DistributedInputClient::RegisterSimulationEventListener(sptr<ISimulationEventListener> listener)
|
||||
{
|
||||
DHLOGI("RegisterSimulationEventListener called Simulation Event Listener Register.");
|
||||
|
||||
@@ -580,82 +580,6 @@ int32_t DistributedInputSourceProxy::RegisterDelWhiteListCallback(sptr<IDelWhite
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t DistributedInputSourceProxy::RegisterInputNodeListener(sptr<InputNodeListener> listener)
|
||||
{
|
||||
MessageParcel data;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
DHLOGE("DistributedInputSourceProxy write token valid failed");
|
||||
return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL;
|
||||
}
|
||||
if (!data.WriteRemoteObject(listener->AsObject())) {
|
||||
DHLOGE("DistributedInputSourceProxy write callback failed");
|
||||
return ERR_DH_INPUT_IPC_WRITE_VALID_FAIL;
|
||||
}
|
||||
|
||||
MessageParcel reply;
|
||||
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_REGISTER_NODE_LISTENER_FAIL;
|
||||
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::REGISTER_NODE_LISTENER),
|
||||
data, reply);
|
||||
if (ret) {
|
||||
result = reply.ReadInt32();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t DistributedInputSourceProxy::UnregisterInputNodeListener(sptr<InputNodeListener> listener)
|
||||
{
|
||||
MessageParcel data;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
DHLOGE("DistributedInputSourceProxy write token valid failed");
|
||||
return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL;
|
||||
}
|
||||
|
||||
if (!data.WriteRemoteObject(listener->AsObject())) {
|
||||
DHLOGE("DistributedInputSourceProxy write callback failed");
|
||||
return ERR_DH_INPUT_IPC_WRITE_VALID_FAIL;
|
||||
}
|
||||
|
||||
MessageParcel reply;
|
||||
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_UNREGISTER_NODE_LISTENER_FAIL;
|
||||
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::UNREGISTER_NODE_LISTENER),
|
||||
data, reply);
|
||||
if (ret) {
|
||||
result = reply.ReadInt32();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t DistributedInputSourceProxy::SyncNodeInfoRemoteInput(const std::string &userDevId, const std::string &dhid,
|
||||
const std::string &nodeDesc)
|
||||
{
|
||||
MessageParcel data;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
DHLOGE("DistributedInputSourceProxy write token valid failed");
|
||||
return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL;
|
||||
}
|
||||
if (!data.WriteString(userDevId)) {
|
||||
DHLOGE("write SyncNodeInfoRemoteInput userDevId to parcel failed");
|
||||
return ERR_DH_INPUT_IPC_WRITE_VALID_FAIL;
|
||||
}
|
||||
if (!data.WriteString(dhid)) {
|
||||
DHLOGE("write SyncNodeInfoRemoteInput dhid to parcel failed");
|
||||
return ERR_DH_INPUT_IPC_WRITE_VALID_FAIL;
|
||||
}
|
||||
if (!data.WriteString(nodeDesc)) {
|
||||
DHLOGE("write SyncNodeInfoRemoteInput nodeDesc to parcel failed");
|
||||
return ERR_DH_INPUT_IPC_WRITE_VALID_FAIL;
|
||||
}
|
||||
MessageParcel reply;
|
||||
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_SYNC_NODE_FAIL;
|
||||
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::SYNC_NODE_INFO_REMOTE_INPUT),
|
||||
data, reply);
|
||||
if (ret) {
|
||||
result = reply.ReadInt32();
|
||||
}
|
||||
DHLOGI("SyncNodeInfoRemoteInput end, result=%d", result);
|
||||
return result;
|
||||
}
|
||||
|
||||
int32_t DistributedInputSourceProxy::RegisterSimulationEventListener(sptr<ISimulationEventListener> listener)
|
||||
{
|
||||
MessageParcel data;
|
||||
|
||||
@@ -69,16 +69,10 @@ void DistributedInputSourceStub::RegRespFunMap()
|
||||
&DistributedInputSourceStub::HandleRegisterAddWhiteListCallback;
|
||||
memberFuncMap_[static_cast<uint32_t>(IDInputSourceInterfaceCode::REGISTER_DEL_WHITE_LIST_CB_REMOTE_INPUT)] =
|
||||
&DistributedInputSourceStub::HandleRegisterDelWhiteListCallback;
|
||||
memberFuncMap_[static_cast<uint32_t>(IDInputSourceInterfaceCode::REGISTER_NODE_LISTENER)] =
|
||||
&DistributedInputSourceStub::HandleRegisterInputNodeListener;
|
||||
memberFuncMap_[static_cast<uint32_t>(IDInputSourceInterfaceCode::UNREGISTER_NODE_LISTENER)] =
|
||||
&DistributedInputSourceStub::HandleUnRegisterInputNodeListener;
|
||||
memberFuncMap_[static_cast<uint32_t>(IDInputSourceInterfaceCode::REGISTER_SIMULATION_EVENT_LISTENER)] =
|
||||
&DistributedInputSourceStub::HandleRegisterSimulationEventListener;
|
||||
memberFuncMap_[static_cast<uint32_t>(IDInputSourceInterfaceCode::UNREGISTER_SIMULATION_EVENT_LISTENER)] =
|
||||
&DistributedInputSourceStub::HandleUnregisterSimulationEventListener;
|
||||
memberFuncMap_[static_cast<uint32_t>(IDInputSourceInterfaceCode::SYNC_NODE_INFO_REMOTE_INPUT)] =
|
||||
&DistributedInputSourceStub::HandleSyncNodeInfoRemoteInput;
|
||||
memberFuncMap_[static_cast<uint32_t>(IDInputSourceInterfaceCode::REGISTER_SESSION_STATE_CB)] =
|
||||
&DistributedInputSourceStub::HandleRegisterSessionStateCb;
|
||||
memberFuncMap_[static_cast<uint32_t>(IDInputSourceInterfaceCode::UNREGISTER_SESSION_STATE_CB)] =
|
||||
@@ -504,20 +498,6 @@ int32_t DistributedInputSourceStub::HandleStopRelayDhidRemoteInput(MessageParcel
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t DistributedInputSourceStub::HandleSyncNodeInfoRemoteInput(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
std::string userDevId = data.ReadString();
|
||||
std::string dhid = data.ReadString();
|
||||
std::string nodeDesc = data.ReadString();
|
||||
|
||||
int32_t ret = SyncNodeInfoRemoteInput(userDevId, dhid, nodeDesc);
|
||||
if (!reply.WriteInt32(ret)) {
|
||||
DHLOGE("HandleSyncNodeInfoRemoteInput write ret failed");
|
||||
return ERR_DH_INPUT_IPC_WRITE_VALID_FAIL;
|
||||
}
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t DistributedInputSourceStub::HandleRegisterAddWhiteListCallback(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
sptr<IAddWhiteListInfosCallback> callback = iface_cast<IAddWhiteListInfosCallback>(data.ReadRemoteObject());
|
||||
@@ -548,38 +528,6 @@ int32_t DistributedInputSourceStub::HandleRegisterDelWhiteListCallback(MessagePa
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t DistributedInputSourceStub::HandleRegisterInputNodeListener(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
sptr<InputNodeListener> callback = iface_cast<InputNodeListener>(data.ReadRemoteObject());
|
||||
if (callback == nullptr) {
|
||||
DHLOGE("HandleRegisterInputNodeListener failed, callback is nullptr.");
|
||||
return ERR_DH_INPUT_POINTER_NULL;
|
||||
}
|
||||
int32_t ret = RegisterInputNodeListener(callback);
|
||||
if (!reply.WriteInt32(ret)) {
|
||||
DHLOGE("HandleRegisterInputNodeListener write ret failed");
|
||||
return ERR_DH_INPUT_SOURCE_STUB_REGISTER_NODE_LISTENER_FAIL;
|
||||
}
|
||||
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t DistributedInputSourceStub::HandleUnRegisterInputNodeListener(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
sptr<InputNodeListener> callback = iface_cast<InputNodeListener>(data.ReadRemoteObject());
|
||||
if (callback == nullptr) {
|
||||
DHLOGE("HandleUnRegisterInputNodeListener failed, callback is nullptr.");
|
||||
return ERR_DH_INPUT_POINTER_NULL;
|
||||
}
|
||||
int32_t ret = RegisterInputNodeListener(callback);
|
||||
if (!reply.WriteInt32(ret)) {
|
||||
DHLOGE("HandleUnRegisterInputNodeListener write ret failed");
|
||||
return ERR_DH_INPUT_SOURCE_STUB_UNREGISTER_NODE_LISTENER_FAIL;
|
||||
}
|
||||
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t DistributedInputSourceStub::HandleRegisterSimulationEventListener(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
sptr<ISimulationEventListener> callback = iface_cast<ISimulationEventListener>(data.ReadRemoteObject());
|
||||
|
||||
@@ -224,30 +224,6 @@ int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::RegisterDelWhite
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::RegisterInputNodeListener(
|
||||
sptr<InputNodeListener> listener)
|
||||
{
|
||||
(void)listener;
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::UnregisterInputNodeListener(
|
||||
sptr<InputNodeListener> listener)
|
||||
{
|
||||
(void)listener;
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::SyncNodeInfoRemoteInput(
|
||||
const std::string &userDevId, const std::string &dhid,
|
||||
const std::string &nodeDesc)
|
||||
{
|
||||
(void)userDevId;
|
||||
(void)dhid;
|
||||
(void)nodeDesc;
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t DInputSourceCallBackTest::TestDInputSourceCallBackStub::RegisterSimulationEventListener(
|
||||
sptr<ISimulationEventListener> listener)
|
||||
{
|
||||
@@ -590,35 +566,6 @@ HWTEST_F(DInputSourceCallBackTest, RegisterDelWhiteListCallback01, testing::ext:
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DInputSourceCallBackTest, RegisterInputNodeListener01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
|
||||
DistributedInputSourceProxy callBackProxy(callBackStubPtr);
|
||||
sptr<TestDInputNodeListenerCallBack> listener(new TestDInputNodeListenerCallBack());
|
||||
int32_t ret = callBackProxy.RegisterInputNodeListener(listener);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DInputSourceCallBackTest, UnregisterInputNodeListener01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
|
||||
DistributedInputSourceProxy callBackProxy(callBackStubPtr);
|
||||
sptr<TestDInputNodeListenerCallBack> listener(new TestDInputNodeListenerCallBack());
|
||||
int32_t ret = callBackProxy.UnregisterInputNodeListener(listener);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DInputSourceCallBackTest, SyncNodeInfoRemoteInput01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
|
||||
DistributedInputSourceProxy callBackProxy(callBackStubPtr);
|
||||
const std::string userDevId = "a4sd654q8w7e9qwe";
|
||||
const std::string dhid = "Input_sd65f46df46s54f";
|
||||
const std::string nodeDesc = "65d4f6s54f6sd4f665d4sf6";
|
||||
int32_t ret = callBackProxy.SyncNodeInfoRemoteInput(userDevId, dhid, nodeDesc);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DInputSourceCallBackTest, RegisterSimulationEventListener01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
sptr<IRemoteObject> callBackStubPtr(new TestDInputSourceCallBackStub());
|
||||
|
||||
@@ -98,11 +98,7 @@ public:
|
||||
|
||||
int32_t RegisterAddWhiteListCallback(sptr<IAddWhiteListInfosCallback> addWhiteListCallback);
|
||||
int32_t RegisterDelWhiteListCallback(sptr<IDelWhiteListInfosCallback> delWhiteListCallback);
|
||||
int32_t RegisterInputNodeListener(sptr<InputNodeListener> listener);
|
||||
int32_t UnregisterInputNodeListener(sptr<InputNodeListener> listener);
|
||||
|
||||
int32_t SyncNodeInfoRemoteInput(const std::string &userDevId, const std::string &dhid,
|
||||
const std::string &nodeDesc);
|
||||
int32_t RegisterSimulationEventListener(sptr<ISimulationEventListener> listener);
|
||||
int32_t UnregisterSimulationEventListener(sptr<ISimulationEventListener> listener);
|
||||
int32_t RegisterSessionStateCb(sptr<ISessionStateCallback> callback);
|
||||
|
||||
@@ -213,34 +213,6 @@ HWTEST_F(DistributedInputIpcTest, IsStartDistributedInput03, testing::ext::TestS
|
||||
EXPECT_EQ(false, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputIpcTest, RegisterInputNodeListener01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
sptr<TestInputNodeListener> listener = nullptr;
|
||||
int32_t ret = DistributedInputClient::GetInstance().RegisterInputNodeListener(listener);
|
||||
EXPECT_EQ(ERR_DH_INPUT_CLIENT_REG_NODE_CB_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputIpcTest, RegisterInputNodeListener02, testing::ext::TestSize.Level1)
|
||||
{
|
||||
sptr<TestInputNodeListener> listener(new TestInputNodeListener());
|
||||
int32_t ret = DistributedInputClient::GetInstance().RegisterInputNodeListener(listener);
|
||||
EXPECT_EQ(ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputIpcTest, UnregisterInputNodeListener01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
sptr<TestInputNodeListener> listener = nullptr;
|
||||
int32_t ret = DistributedInputClient::GetInstance().UnregisterInputNodeListener(listener);
|
||||
EXPECT_EQ(ERR_DH_INPUT_CLIENT_UNREG_NODE_CB_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputIpcTest, UnregisterInputNodeListener02, testing::ext::TestSize.Level1)
|
||||
{
|
||||
sptr<TestInputNodeListener> listener(new TestInputNodeListener());
|
||||
int32_t ret = DistributedInputClient::GetInstance().UnregisterInputNodeListener(listener);
|
||||
EXPECT_EQ(ERR_DH_INPUT_CLIENT_GET_SOURCE_PROXY_FAIL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputIpcTest, RegisterSimulationEventListener01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
sptr<TestSimulationEventListenerStub> listener = nullptr;
|
||||
|
||||
@@ -44,17 +44,12 @@ public:
|
||||
const uint32_t sourcePhyWidth, const uint32_t sourcePhyHeight);
|
||||
int32_t RemoveVirtualTouchScreenNode(const std::string &dhId);
|
||||
int32_t GetVirtualTouchScreenFd();
|
||||
int32_t RegisterInputNodeListener(sptr<InputNodeListener> listener);
|
||||
int32_t UnregisterInputNodeListener(sptr<InputNodeListener> listener);
|
||||
int32_t GetDhIdsByInputType(const std::string &devId, const uint32_t &inputTypes, std::vector<std::string> &dhIds);
|
||||
int32_t RegisterInjectEventCb(sptr<ISessionStateCallback> callback);
|
||||
int32_t UnregisterInjectEventCb();
|
||||
|
||||
void NotifyNodeMgrScanVirNode(const std::string &dhId);
|
||||
void InputDeviceEventInject(const std::shared_ptr<RawEvent> &rawEvent);
|
||||
void SyncNodeOfflineInfo(const std::string &srcDevId, const std::string &sinkDevId, const std::string &sinkNodeId);
|
||||
void SyncNodeOnlineInfo(const std::string &srcDevId, const std::string &sinkDevId, const std::string &sinkNodeId,
|
||||
const std::string &sinkNodeDesc);
|
||||
void GetVirtualKeyboardPathsByDhIds(const std::vector<std::string> &dhIds,
|
||||
std::vector<std::string> &virKeyboardPaths, std::vector<std::string> &virKeyboardDhIds);
|
||||
private:
|
||||
@@ -63,8 +58,6 @@ private:
|
||||
|
||||
std::unique_ptr<DistributedInputNodeManager> inputNodeManager_;
|
||||
std::mutex inputNodeManagerMutex_;
|
||||
std::set<sptr<InputNodeListener>> inputNodeListeners_;
|
||||
std::mutex inputNodeListenersMutex_;
|
||||
};
|
||||
} // namespace DistributedInput
|
||||
} // namespace DistributedHardware
|
||||
|
||||
@@ -61,12 +61,7 @@ int32_t DistributedInputInject::RegisterDistributedHardware(const std::string &d
|
||||
return ERR_DH_INPUT_SERVER_SOURCE_INJECT_REGISTER_FAIL;
|
||||
}
|
||||
|
||||
std::string srcDevId;
|
||||
inputNodeManager_->GetDeviceInfo(srcDevId);
|
||||
DHLOGI("RegisterDistributedHardware called, device type = source, source networkId = %s, sink networkId = %s",
|
||||
GetAnonyString(srcDevId).c_str(), GetAnonyString(devId).c_str());
|
||||
|
||||
SyncNodeOnlineInfo(srcDevId, devId, dhId, GetNodeDesc(parameters));
|
||||
DHLOGI("RegisterDistributedHardware success");
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -94,20 +89,6 @@ int32_t DistributedInputInject::UnregisterDistributedHardware(const std::string
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t DistributedInputInject::RegisterInputNodeListener(sptr<InputNodeListener> listener)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(inputNodeListenersMutex_);
|
||||
this->inputNodeListeners_.insert(listener);
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t DistributedInputInject::UnregisterInputNodeListener(sptr<InputNodeListener> listener)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(inputNodeListenersMutex_);
|
||||
this->inputNodeListeners_.erase(listener);
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t DistributedInputInject::GetDhIdsByInputType(const std::string &devId, const uint32_t &inputTypes,
|
||||
std::vector<std::string> &dhIds)
|
||||
{
|
||||
@@ -165,28 +146,6 @@ void DistributedInputInject::InputDeviceEventInject(const std::shared_ptr<RawEve
|
||||
inputNodeManager_->ProcessInjectEvent(rawEvent);
|
||||
}
|
||||
|
||||
void DistributedInputInject::SyncNodeOnlineInfo(const std::string &srcDevId,
|
||||
const std::string &sinkDevId, const std::string &sinkNodeId, const std::string &sinkNodeDesc)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(inputNodeListenersMutex_);
|
||||
DHLOGI("SyncVirNodeOnlineInfo, srcId: %s, sinkId: %s, dhId: %s", GetAnonyString(srcDevId).c_str(),
|
||||
GetAnonyString(sinkDevId).c_str(), GetAnonyString(sinkNodeId).c_str());
|
||||
for (const auto &listener : inputNodeListeners_) {
|
||||
listener->OnNodeOnLine(srcDevId, sinkDevId, sinkNodeId, sinkNodeDesc);
|
||||
}
|
||||
}
|
||||
|
||||
void DistributedInputInject::SyncNodeOfflineInfo(const std::string &srcDevId,
|
||||
const std::string &sinkDevId, const std::string &sinkNodeId)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(inputNodeListenersMutex_);
|
||||
DHLOGI("SyncVirNodeOfflineInfo, srcId: %s, sinkId: %s, dhId: %s", GetAnonyString(srcDevId).c_str(),
|
||||
GetAnonyString(sinkDevId).c_str(), GetAnonyString(sinkNodeId).c_str());
|
||||
for (const auto &listener : inputNodeListeners_) {
|
||||
listener->OnNodeOffLine(srcDevId, sinkDevId, sinkNodeId);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t DistributedInputInject::RegisterDistributedEvent(RawEvent *buffer, size_t bufferSize)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(inputNodeManagerMutex_);
|
||||
|
||||
-13
@@ -287,19 +287,6 @@ HWTEST_F(DistributedInputSourceInjectTest, RegisterDistributedEvent04, testing::
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_INJECT_NODE_MANAGER_IS_NULL, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceInjectTest, RegisterInputNodeListener, testing::ext::TestSize.Level1)
|
||||
{
|
||||
inputNodelistener_ = (std::make_unique<TestInputNodeListener>()).release();
|
||||
int32_t ret = DistributedInputInject::GetInstance().RegisterInputNodeListener(inputNodelistener_);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceInjectTest, UnRegisterInputNodeListener, testing::ext::TestSize.Level1)
|
||||
{
|
||||
int32_t ret = DistributedInputInject::GetInstance().UnregisterInputNodeListener(inputNodelistener_);
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceInjectTest, GetDhIdsByInputType_001, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::string devId = "umkyu1b165e1be98151891erbe8r91ev";
|
||||
|
||||
@@ -175,11 +175,7 @@ public:
|
||||
|
||||
int32_t RegisterAddWhiteListCallback(sptr<IAddWhiteListInfosCallback> addWhiteListCallback) override;
|
||||
int32_t RegisterDelWhiteListCallback(sptr<IDelWhiteListInfosCallback> delWhiteListCallback) override;
|
||||
int32_t RegisterInputNodeListener(sptr<InputNodeListener> listener) override;
|
||||
int32_t UnregisterInputNodeListener(sptr<InputNodeListener> listener) override;
|
||||
|
||||
int32_t SyncNodeInfoRemoteInput(const std::string &userDevId, const std::string &dhId,
|
||||
const std::string &nodeDesc) override;
|
||||
int32_t RegisterSimulationEventListener(sptr<ISimulationEventListener> listener) override;
|
||||
int32_t UnregisterSimulationEventListener(sptr<ISimulationEventListener> listener) override;
|
||||
|
||||
@@ -443,7 +439,6 @@ private:
|
||||
const std::vector<std::string> &dhIds, sptr<IStartStopDInputsCallback> callback);
|
||||
bool IsStringDataSame(const std::vector<std::string> &oldDhIds, std::vector<std::string> newDhIds);
|
||||
void DeleteNodeInfoAndNotify(const std::string &offlineDevId);
|
||||
void SendExistVirNodeInfos(sptr<InputNodeListener> listener);
|
||||
std::set<BeRegNodeInfo> GetSyncNodeInfo(const std::string &devId);
|
||||
void UpdateSyncNodeInfo(const std::string &devId, const std::string &dhId, const std::string &nodeDesc);
|
||||
void DeleteSyncNodeInfo(const std::string &devId);
|
||||
|
||||
@@ -301,16 +301,7 @@ int32_t DistributedInputSourceManager::RegisterDistributedHardware(const std::st
|
||||
// 4.notify source distributedfwk register hardware success
|
||||
callback->OnResult(devId, dhId, DH_SUCCESS);
|
||||
|
||||
// 5. notify remote side that this side is registerd remote dhid
|
||||
sptr<IDistributedSourceInput> cli = DInputSourceSACliMgr::GetInstance().GetRemoteCli(devId);
|
||||
if (cli == nullptr) {
|
||||
DHLOGE("Get Remote DInput Source Proxy return null");
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
cli->SyncNodeInfoRemoteInput(GetLocalNetworkId(), dhId, GetNodeDesc(parameters));
|
||||
|
||||
// 6. Notify node mgr to scan vir dev node info
|
||||
// 5. Notify node mgr to scan vir dev node info
|
||||
DistributedInputInject::GetInstance().NotifyNodeMgrScanVirNode(dhId);
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
@@ -1147,41 +1138,6 @@ int32_t DistributedInputSourceManager::RegisterDelWhiteListCallback(sptr<IDelWhi
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t DistributedInputSourceManager::RegisterInputNodeListener(sptr<InputNodeListener> listener)
|
||||
{
|
||||
DHLOGI("RegisterInputNodeListener.");
|
||||
if (listener == nullptr) {
|
||||
DHLOGE("RegisterInputNodeListener callback is null.");
|
||||
return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_NODE_LISTENER_CALLBACK_ERR;
|
||||
}
|
||||
DistributedInputInject::GetInstance().RegisterInputNodeListener(listener);
|
||||
SendExistVirNodeInfos(listener);
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t DistributedInputSourceManager::UnregisterInputNodeListener(sptr<InputNodeListener> listener)
|
||||
{
|
||||
DHLOGI("UnregisterInputNodeListener.");
|
||||
if (listener == nullptr) {
|
||||
DHLOGE("UnregisterInputNodeListener callback is null.");
|
||||
return ERR_DH_INPUT_SERVER_SOURCE_MANAGER_NODE_LISTENER_CALLBACK_ERR;
|
||||
}
|
||||
DistributedInputInject::GetInstance().UnregisterInputNodeListener(listener);
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
void DistributedInputSourceManager::SendExistVirNodeInfos(sptr<InputNodeListener> listener)
|
||||
{
|
||||
DHLOGI("SendExistVirNodeInfos call");
|
||||
std::lock_guard<std::mutex> lock(operationMutex_);
|
||||
DevInfo localDevInfo = GetLocalDeviceInfo();
|
||||
for (const auto &node : inputDevice_) {
|
||||
DHLOGI("Send Exist Vir Node: srcId: %s, sinkId: %s, dhId: %s", GetAnonyString(localDevInfo.networkId).c_str(),
|
||||
GetAnonyString(node.devId).c_str(), GetAnonyString(node.dhId).c_str());
|
||||
listener->OnNodeOnLine(localDevInfo.networkId, node.devId, node.dhId, node.nodeDesc);
|
||||
}
|
||||
}
|
||||
|
||||
int32_t DistributedInputSourceManager::RegisterSimulationEventListener(sptr<ISimulationEventListener> listener)
|
||||
{
|
||||
DHLOGI("RegisterSimulationEventListener called.");
|
||||
@@ -1223,16 +1179,6 @@ int32_t DistributedInputSourceManager::UnregisterSessionStateCb()
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t DistributedInputSourceManager::SyncNodeInfoRemoteInput(const std::string &userDevId, const std::string &dhId,
|
||||
const std::string &nodeDesc)
|
||||
{
|
||||
// store info
|
||||
UpdateSyncNodeInfo(userDevId, dhId, nodeDesc);
|
||||
// notify multimodal
|
||||
DistributedInputInject::GetInstance().SyncNodeOnlineInfo(userDevId, GetLocalNetworkId(), dhId, nodeDesc);
|
||||
return DH_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t DistributedInputSourceManager::RelayPrepareRemoteInput(const std::string &srcId, const std::string &sinkId,
|
||||
sptr<IPrepareDInputCallback> callback)
|
||||
{
|
||||
|
||||
-10
@@ -1073,16 +1073,6 @@ HWTEST_F(DistributedInputSourceManagerTest, RegisterDelWhiteListCallback02, test
|
||||
EXPECT_EQ(DH_SUCCESS, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, RegisterInputNodeListener_01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
sptr<TestInputNodeListenerCb> callback = nullptr;
|
||||
int32_t ret = sourceManager_->RegisterInputNodeListener(callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_NODE_LISTENER_CALLBACK_ERR, ret);
|
||||
|
||||
ret = sourceManager_->UnregisterInputNodeListener(callback);
|
||||
EXPECT_EQ(ERR_DH_INPUT_SERVER_SOURCE_MANAGER_NODE_LISTENER_CALLBACK_ERR, ret);
|
||||
}
|
||||
|
||||
HWTEST_F(DistributedInputSourceManagerTest, RegisterSimulationEventListener_01, testing::ext::TestSize.Level1)
|
||||
{
|
||||
sptr<TestSimulationEventCb> callback = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user