add ipc code modify

Signed-off-by: hwzhangchuang <zhangchuang.zhang@huawei.com>
This commit is contained in:
hwzhangchuang
2023-05-16 11:18:23 +08:00
parent 5a2aedb65a
commit 622248f44a
37 changed files with 184 additions and 168 deletions
+23 -23
View File
@@ -42,29 +42,29 @@ enum class IDInputSinkInterfaceCode : uint32_t {
/* SAID: 4809 */
enum class IDInputSourceInterfaceCode : uint32_t {
INIT = 0xf001,
RELEASE = 0xf002,
REGISTER_REMOTE_INPUT = 0xf003,
UNREGISTER_REMOTE_INPUT = 0xf004,
PREPARE_REMOTE_INPUT = 0xf005,
UNPREPARE_REMOTE_INPUT = 0xf006,
START_REMOTE_INPUT = 0xf007,
STOP_REMOTE_INPUT = 0xf008,
PREPARE_RELAY_REMOTE_INPUT = 0xf00a,
UNPREPARE_RELAY_REMOTE_INPUT = 0xf00b,
START_RELAY_TYPE_REMOTE_INPUT = 0xf00c,
STOP_RELAY_TYPE_REMOTE_INPUT = 0xf00d,
START_DHID_REMOTE_INPUT = 0xf00e,
STOP_DHID_REMOTE_INPUT = 0xf00f,
START_RELAY_DHID_REMOTE_INPUT = 0xf010,
STOP_RELAY_DHID_REMOTE_INPUT = 0xf011,
REGISTER_ADD_WHITE_LIST_CB_REMOTE_INPUT = 0xf013,
REGISTER_DEL_WHITE_LIST_CB_REMOTE_INPUT = 0xf014,
REGISTER_NODE_LISTENER = 0xf015,
UNREGISTER_NODE_LISTENER = 0xf016,
REGISTER_SIMULATION_EVENT_LISTENER = 0xf017,
UNREGISTER_SIMULATION_EVENT_LISTENER = 0xf018,
SYNC_NODE_INFO_REMOTE_INPUT = 0xf019,
INIT = 0xf001U,
RELEASE = 0xf002U,
REGISTER_REMOTE_INPUT = 0xf003U,
UNREGISTER_REMOTE_INPUT = 0xf004U,
PREPARE_REMOTE_INPUT = 0xf005U,
UNPREPARE_REMOTE_INPUT = 0xf006U,
START_REMOTE_INPUT = 0xf007U,
STOP_REMOTE_INPUT = 0xf008U,
PREPARE_RELAY_REMOTE_INPUT = 0xf00aU,
UNPREPARE_RELAY_REMOTE_INPUT = 0xf00bU,
START_RELAY_TYPE_REMOTE_INPUT = 0xf00cU,
STOP_RELAY_TYPE_REMOTE_INPUT = 0xf00dU,
START_DHID_REMOTE_INPUT = 0xf00eU,
STOP_DHID_REMOTE_INPUT = 0xf00fU,
START_RELAY_DHID_REMOTE_INPUT = 0xf010U,
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,
};
/* SAID: 4810 */
@@ -53,15 +53,6 @@ public:
virtual int32_t NotifyStopDScreen(const std::string &srcScreenInfoKey) = 0;
virtual int32_t RegisterSharingDhIdListener(sptr<ISharingDhIdListener> sharingDhIdListener) = 0;
enum {
INIT = 0xf011U,
RELEASE = 0xf012U,
NOTIFY_START_DSCREEN = 0xf013U,
NOTIFY_STOP_DSCREEN = 0xf014U,
REGISTER_SHARING_DHID_LISTENER = 0xf015U,
GET_SINK_SCREEN_INFOS = 0xf016U,
};
};
} // namespace DistributedInput
} // namespace DistributedHardware
@@ -98,32 +98,6 @@ public:
const std::string &nodeDesc) = 0;
virtual int32_t RegisterSimulationEventListener(sptr<ISimulationEventListener> listener) = 0;
virtual int32_t UnregisterSimulationEventListener(sptr<ISimulationEventListener> listener) = 0;
enum class MessageCode {
INIT = 0xf001,
RELEASE = 0xf002,
REGISTER_REMOTE_INPUT = 0xf003,
UNREGISTER_REMOTE_INPUT = 0xf004,
PREPARE_REMOTE_INPUT = 0xf005,
UNPREPARE_REMOTE_INPUT = 0xf006,
START_REMOTE_INPUT = 0xf007,
STOP_REMOTE_INPUT = 0xf008,
PREPARE_RELAY_REMOTE_INPUT = 0xf00a,
UNPREPARE_RELAY_REMOTE_INPUT = 0xf00b,
START_RELAY_TYPE_REMOTE_INPUT = 0xf00c,
STOP_RELAY_TYPE_REMOTE_INPUT = 0xf00d,
START_DHID_REMOTE_INPUT = 0xf00e,
STOP_DHID_REMOTE_INPUT = 0xf00f,
START_RELAY_DHID_REMOTE_INPUT = 0xf010,
STOP_RELAY_DHID_REMOTE_INPUT = 0xf011,
REGISTER_ADD_WHITE_LIST_CB_REMOTE_INPUT = 0xf013,
REGISTER_DEL_WHITE_LIST_CB_REMOTE_INPUT = 0xf014,
REGISTER_NODE_LISTENER = 0xf015,
UNREGISTER_NODE_LISTENER = 0xf016,
REGISTER_SIMULATION_EVENT_LISTENER = 0xf017,
UNREGISTER_SIMULATION_EVENT_LISTENER = 0xf018,
SYNC_NODE_INFO_REMOTE_INPUT = 0xf019,
};
};
} // namespace DistributedInput
} // namespace DistributedHardware
@@ -85,7 +85,7 @@ public:
int32_t UnregisterSimulationEventListener(sptr<ISimulationEventListener> listener) override;
private:
bool SendRequest(const IDistributedSourceInput::MessageCode code, MessageParcel &data, MessageParcel &reply);
bool SendRequest(const uint32_t code, MessageParcel &data, MessageParcel &reply);
static inline BrokerDelegator<DistributedInputSourceProxy> delegator_;
};
@@ -15,6 +15,7 @@
#include "add_white_list_infos_call_back_proxy.h"
#include "dinput_ipc_interface_code.h"
#include "ipc_types.h"
#include "parcel.h"
@@ -54,7 +55,7 @@ void AddWhiteListInfosCallbackProxy::OnResult(const std::string& deviceId, const
DHLOGE("AddWhiteListInfosCallbackProxy write strJson failed");
return;
}
remote->SendRequest(static_cast<int32_t>(IAddWhiteListInfosCallback::Message::RESULT), data, reply, option);
remote->SendRequest(static_cast<uint32_t>(IAddWhiteListInfosCBInterfaceCode::RESULT), data, reply, option);
}
} // namespace DistributedInput
} // namespace DistributedHardware
@@ -19,6 +19,7 @@
#include "constants_dinput.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -39,9 +40,9 @@ int32_t AddWhiteListInfosCallbackStub::OnRemoteRequest(
DHLOGE("AddWhiteListInfosCallbackStub read token valid failed");
return ERR_DH_INPUT_IPC_READ_TOKEN_VALID_FAIL;
}
IAddWhiteListInfosCallback::Message msgCode = static_cast<IAddWhiteListInfosCallback::Message>(code);
IAddWhiteListInfosCBInterfaceCode msgCode = static_cast<IAddWhiteListInfosCBInterfaceCode>(code);
switch (msgCode) {
case IAddWhiteListInfosCallback::Message::RESULT: {
case IAddWhiteListInfosCBInterfaceCode::RESULT: {
std::string deviceId = data.ReadString();
std::string strJsion = data.ReadString();
OnResult(deviceId, strJsion);
@@ -15,6 +15,7 @@
#include "del_white_list_infos_call_back_proxy.h"
#include "dinput_ipc_interface_code.h"
#include "ipc_types.h"
#include "parcel.h"
@@ -50,7 +51,7 @@ void DelWhiteListInfosCallbackProxy::OnResult(const std::string& deviceId)
DHLOGE("DelWhiteListInfosCallbackProxy write deviceId failed");
return;
}
remote->SendRequest(static_cast<int32_t>(IDelWhiteListInfosCallback::Message::RESULT), data, reply, option);
remote->SendRequest(static_cast<uint32_t>(IDelWhiteListInfosCBInterfaceCode::RESULT), data, reply, option);
}
} // namespace DistributedInput
} // namespace DistributedHardware
@@ -19,6 +19,7 @@
#include "constants_dinput.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -39,9 +40,9 @@ int32_t DelWhiteListInfosCallbackStub::OnRemoteRequest(
DHLOGE("DelWhiteListInfosCallbackStub read token valid failed");
return ERR_DH_INPUT_IPC_READ_TOKEN_VALID_FAIL;
}
IDelWhiteListInfosCallback::Message msgCode = static_cast<IDelWhiteListInfosCallback::Message>(code);
IDelWhiteListInfosCBInterfaceCode msgCode = static_cast<IDelWhiteListInfosCBInterfaceCode>(code);
switch (msgCode) {
case IDelWhiteListInfosCallback::Message::RESULT: {
case IDelWhiteListInfosCBInterfaceCode::RESULT: {
std::string deviceId = data.ReadString();
OnResult(deviceId);
break;
@@ -18,6 +18,7 @@
#include "anonymous_string.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
#include "dinput_utils_tool.h"
#include "i_get_sink_screen_infos_call_back.h"
@@ -41,7 +42,7 @@ int32_t DistributedInputSinkProxy::Init()
return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL;
}
int32_t result = ERR_DH_INPUT_SINK_PROXY_INIT_FAIL;
bool ret = SendRequest(INIT, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSinkInterfaceCode::INIT), data, reply);
if (!ret) {
DHLOGE("SendRequest fail!");
return ERR_DH_INPUT_SINK_PROXY_INIT_FAIL;
@@ -59,7 +60,7 @@ int32_t DistributedInputSinkProxy::Release()
return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL;
}
int32_t result = ERR_DH_INPUT_SINK_PROXY_RELEASE_FAIL;
bool ret = SendRequest(RELEASE, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSinkInterfaceCode::RELEASE), data, reply);
if (!ret) {
DHLOGE("SendRequest fail!");
return ERR_DH_INPUT_SINK_PROXY_RELEASE_FAIL;
@@ -85,7 +86,7 @@ int32_t DistributedInputSinkProxy::RegisterGetSinkScreenInfosCallback(sptr<IGetS
}
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SINK_PROXY_REGISTER_GETSINKSCREENINFOS_FAIL;
bool ret = SendRequest(GET_SINK_SCREEN_INFOS, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSinkInterfaceCode::GET_SINK_SCREEN_INFOS), data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -114,7 +115,7 @@ int32_t DistributedInputSinkProxy::NotifyStartDScreen(const SrcScreenInfo &remot
return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL;
}
int32_t result = ERR_DH_INPUT_NOTIFY_START_DSCREEN_FAIL;
bool ret = SendRequest(NOTIFY_START_DSCREEN, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSinkInterfaceCode::NOTIFY_START_DSCREEN), data, reply);
if (!ret) {
DHLOGE("SendRequest fail!");
return ERR_DH_INPUT_NOTIFY_START_DSCREEN_FAIL;
@@ -136,7 +137,7 @@ int32_t DistributedInputSinkProxy::NotifyStopDScreen(const std::string &srcScree
return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL;
}
int32_t result = ERR_DH_INPUT_NOTIFY_STOP_DSCREEN_FAIL;
bool ret = SendRequest(NOTIFY_STOP_DSCREEN, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSinkInterfaceCode::NOTIFY_STOP_DSCREEN), data, reply);
if (!ret) {
DHLOGE("SendRequest fail!");
return ERR_DH_INPUT_NOTIFY_STOP_DSCREEN_FAIL;
@@ -159,7 +160,8 @@ int32_t DistributedInputSinkProxy::RegisterSharingDhIdListener(sptr<ISharingDhId
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SINK_PROXY_REGISTER_SHARING_DHID_LISTENER_FAIL;
bool ret = SendRequest(REGISTER_SHARING_DHID_LISTENER, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSinkInterfaceCode::REGISTER_SHARING_DHID_LISTENER),
data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -19,6 +19,7 @@
#include "constants_dinput.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
#include "i_sharing_dhid_listener.h"
@@ -28,12 +29,18 @@ namespace DistributedInput {
DistributedInputSinkStub::DistributedInputSinkStub()
{
DHLOGI("DistributedInputSinkStub ctor!");
memberFuncMap_[INIT] = &DistributedInputSinkStub::InitInner;
memberFuncMap_[RELEASE] = &DistributedInputSinkStub::ReleaseInner;
memberFuncMap_[NOTIFY_START_DSCREEN] = &DistributedInputSinkStub::NotifyStartDScreenInner;
memberFuncMap_[NOTIFY_STOP_DSCREEN] = &DistributedInputSinkStub::NotifyStopDScreenInner;
memberFuncMap_[REGISTER_SHARING_DHID_LISTENER] = &DistributedInputSinkStub::RegisterSharingDhIdListenerInner;
memberFuncMap_[GET_SINK_SCREEN_INFOS] = &DistributedInputSinkStub::RegisterGetSinkScreenInfosInner;
memberFuncMap_[static_cast<uint32_t>(IDInputSinkInterfaceCode::INIT)] =
&DistributedInputSinkStub::InitInner;
memberFuncMap_[static_cast<uint32_t>(IDInputSinkInterfaceCode::RELEASE)] =
&DistributedInputSinkStub::ReleaseInner;
memberFuncMap_[static_cast<uint32_t>(IDInputSinkInterfaceCode::NOTIFY_START_DSCREEN)] =
&DistributedInputSinkStub::NotifyStartDScreenInner;
memberFuncMap_[static_cast<uint32_t>(IDInputSinkInterfaceCode::NOTIFY_STOP_DSCREEN)] =
&DistributedInputSinkStub::NotifyStopDScreenInner;
memberFuncMap_[static_cast<uint32_t>(IDInputSinkInterfaceCode::REGISTER_SHARING_DHID_LISTENER)] =
&DistributedInputSinkStub::RegisterSharingDhIdListenerInner;
memberFuncMap_[static_cast<uint32_t>(IDInputSinkInterfaceCode::GET_SINK_SCREEN_INFOS)] =
&DistributedInputSinkStub::RegisterGetSinkScreenInfosInner;
}
DistributedInputSinkStub::~DistributedInputSinkStub()
@@ -16,6 +16,7 @@
#include "distributed_input_source_proxy.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -37,7 +38,7 @@ int32_t DistributedInputSourceProxy::Init()
return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL;
}
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_INIT_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::INIT, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::INIT), data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -53,7 +54,7 @@ int32_t DistributedInputSourceProxy::Release()
DHLOGE("DistributedInputSourceProxy write token valid failed");
return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL;
}
bool ret = SendRequest(IDistributedSourceInput::MessageCode::RELEASE, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::RELEASE), data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -86,7 +87,7 @@ int32_t DistributedInputSourceProxy::RegisterDistributedHardware(const std::stri
}
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_REGISTER_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::REGISTER_REMOTE_INPUT, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::REGISTER_REMOTE_INPUT), data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -115,7 +116,7 @@ int32_t DistributedInputSourceProxy::UnregisterDistributedHardware(const std::st
}
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_UNREGISTER_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::UNREGISTER_REMOTE_INPUT, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::UNREGISTER_REMOTE_INPUT), data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -141,7 +142,7 @@ int32_t DistributedInputSourceProxy::PrepareRemoteInput(
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_PREPARE_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::PREPARE_REMOTE_INPUT, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::PREPARE_REMOTE_INPUT), data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -167,7 +168,7 @@ int32_t DistributedInputSourceProxy::UnprepareRemoteInput(const std::string &dev
}
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_UNPREPARE_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::UNPREPARE_REMOTE_INPUT, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::UNPREPARE_REMOTE_INPUT), data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -198,7 +199,7 @@ int32_t DistributedInputSourceProxy::StartRemoteInput(
}
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_START_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::START_REMOTE_INPUT, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::START_REMOTE_INPUT), data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -228,7 +229,7 @@ int32_t DistributedInputSourceProxy::StopRemoteInput(
}
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_STOP_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::STOP_REMOTE_INPUT, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::STOP_REMOTE_INPUT), data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -262,7 +263,7 @@ int32_t DistributedInputSourceProxy::StartRemoteInput(const std::string& srcId,
}
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_START_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::START_RELAY_TYPE_REMOTE_INPUT, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::START_RELAY_TYPE_REMOTE_INPUT), data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -296,7 +297,8 @@ int32_t DistributedInputSourceProxy::StopRemoteInput(const std::string& srcId, c
}
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_STOP_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::STOP_RELAY_TYPE_REMOTE_INPUT, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::STOP_RELAY_TYPE_REMOTE_INPUT),
data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -326,7 +328,7 @@ int32_t DistributedInputSourceProxy::PrepareRemoteInput(const std::string &srcId
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_PREPARE_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::PREPARE_RELAY_REMOTE_INPUT, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::PREPARE_RELAY_REMOTE_INPUT), data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -356,7 +358,8 @@ int32_t DistributedInputSourceProxy::UnprepareRemoteInput(const std::string &src
}
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_UNPREPARE_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::UNPREPARE_RELAY_REMOTE_INPUT, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::UNPREPARE_RELAY_REMOTE_INPUT),
data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -394,7 +397,7 @@ int32_t DistributedInputSourceProxy::StartRemoteInput(const std::string &sinkId,
}
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_START_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::START_DHID_REMOTE_INPUT, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::START_DHID_REMOTE_INPUT), data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -432,7 +435,7 @@ int32_t DistributedInputSourceProxy::StopRemoteInput(const std::string &sinkId,
}
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_STOP_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::STOP_DHID_REMOTE_INPUT, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::STOP_DHID_REMOTE_INPUT), data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -474,7 +477,8 @@ int32_t DistributedInputSourceProxy::StartRemoteInput(const std::string &srcId,
}
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_START_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::START_RELAY_DHID_REMOTE_INPUT, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::START_RELAY_DHID_REMOTE_INPUT),
data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -516,7 +520,8 @@ int32_t DistributedInputSourceProxy::StopRemoteInput(const std::string &srcId, c
}
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_STOP_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::STOP_RELAY_DHID_REMOTE_INPUT, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::STOP_RELAY_DHID_REMOTE_INPUT),
data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -541,7 +546,8 @@ int32_t DistributedInputSourceProxy::RegisterAddWhiteListCallback(sptr<IAddWhite
}
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_REGISTER_WHITELIST_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::REGISTER_ADD_WHITE_LIST_CB_REMOTE_INPUT, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::REGISTER_ADD_WHITE_LIST_CB_REMOTE_INPUT),
data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -565,7 +571,8 @@ int32_t DistributedInputSourceProxy::RegisterDelWhiteListCallback(sptr<IDelWhite
}
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_REGISTER_WHITELIST_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::REGISTER_DEL_WHITE_LIST_CB_REMOTE_INPUT, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::REGISTER_DEL_WHITE_LIST_CB_REMOTE_INPUT),
data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -586,7 +593,8 @@ int32_t DistributedInputSourceProxy::RegisterInputNodeListener(sptr<InputNodeLis
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_REGISTER_NODE_LISTENER_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::REGISTER_NODE_LISTENER, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::REGISTER_NODE_LISTENER),
data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -608,7 +616,8 @@ int32_t DistributedInputSourceProxy::UnregisterInputNodeListener(sptr<InputNodeL
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_UNREGISTER_NODE_LISTENER_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::UNREGISTER_NODE_LISTENER, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::UNREGISTER_NODE_LISTENER),
data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -637,7 +646,8 @@ int32_t DistributedInputSourceProxy::SyncNodeInfoRemoteInput(const std::string &
}
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_SYNC_NODE_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::SYNC_NODE_INFO_REMOTE_INPUT, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::SYNC_NODE_INFO_REMOTE_INPUT),
data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -660,7 +670,8 @@ int32_t DistributedInputSourceProxy::RegisterSimulationEventListener(sptr<ISimul
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_REGISTER_SIMULATION_LISTENER_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::REGISTER_SIMULATION_EVENT_LISTENER, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::REGISTER_SIMULATION_EVENT_LISTENER),
data, reply);
if (ret) {
result = reply.ReadInt32();
}
@@ -682,14 +693,15 @@ int32_t DistributedInputSourceProxy::UnregisterSimulationEventListener(sptr<ISim
MessageParcel reply;
int32_t result = ERR_DH_INPUT_SOURCE_PROXY_UNREGISTER_SIMULATION_LISTENER_FAIL;
bool ret = SendRequest(IDistributedSourceInput::MessageCode::UNREGISTER_SIMULATION_EVENT_LISTENER, data, reply);
bool ret = SendRequest(static_cast<uint32_t>(IDInputSourceInterfaceCode::UNREGISTER_SIMULATION_EVENT_LISTENER),
data, reply);
if (ret) {
result = reply.ReadInt32();
}
return result;
}
bool DistributedInputSourceProxy::SendRequest(const IDistributedSourceInput::MessageCode code, MessageParcel &data,
bool DistributedInputSourceProxy::SendRequest(const uint32_t code, MessageParcel &data,
MessageParcel &reply)
{
sptr<IRemoteObject> remote = Remote();
@@ -17,6 +17,7 @@
#include "constants_dinput.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -393,73 +394,73 @@ int32_t DistributedInputSourceStub::OnRemoteRequest(
return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL;
}
switch (code) {
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::INIT): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::INIT): {
return HandleInitDistributedHardware(reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::RELEASE): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::RELEASE): {
return HandleReleaseDistributedHardware(reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::REGISTER_REMOTE_INPUT): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::REGISTER_REMOTE_INPUT): {
return HandleRegisterDistributedHardware(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::UNREGISTER_REMOTE_INPUT): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::UNREGISTER_REMOTE_INPUT): {
return HandleUnregisterDistributedHardware(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::PREPARE_REMOTE_INPUT): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::PREPARE_REMOTE_INPUT): {
return HandlePrepareRemoteInput(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::UNPREPARE_REMOTE_INPUT): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::UNPREPARE_REMOTE_INPUT): {
return HandleUnprepareRemoteInput(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::START_REMOTE_INPUT): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::START_REMOTE_INPUT): {
return HandleStartRemoteInput(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::STOP_REMOTE_INPUT): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::STOP_REMOTE_INPUT): {
return HandleStopRemoteInput(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::START_RELAY_TYPE_REMOTE_INPUT): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::START_RELAY_TYPE_REMOTE_INPUT): {
return HandleStartRelayTypeRemoteInput(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::STOP_RELAY_TYPE_REMOTE_INPUT): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::STOP_RELAY_TYPE_REMOTE_INPUT): {
return HandleStopRelayTypeRemoteInput(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::PREPARE_RELAY_REMOTE_INPUT): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::PREPARE_RELAY_REMOTE_INPUT): {
return HandlePrepareRelayRemoteInput(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::UNPREPARE_RELAY_REMOTE_INPUT): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::UNPREPARE_RELAY_REMOTE_INPUT): {
return HandleUnprepareRelayRemoteInput(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::START_DHID_REMOTE_INPUT): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::START_DHID_REMOTE_INPUT): {
return HandleStartDhidRemoteInput(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::STOP_DHID_REMOTE_INPUT): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::STOP_DHID_REMOTE_INPUT): {
return HandleStopDhidRemoteInput(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::START_RELAY_DHID_REMOTE_INPUT): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::START_RELAY_DHID_REMOTE_INPUT): {
return HandleStartRelayDhidRemoteInput(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::STOP_RELAY_DHID_REMOTE_INPUT): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::STOP_RELAY_DHID_REMOTE_INPUT): {
return HandleStopRelayDhidRemoteInput(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::REGISTER_ADD_WHITE_LIST_CB_REMOTE_INPUT): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::REGISTER_ADD_WHITE_LIST_CB_REMOTE_INPUT): {
return HandleRegisterAddWhiteListCallback(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::REGISTER_DEL_WHITE_LIST_CB_REMOTE_INPUT): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::REGISTER_DEL_WHITE_LIST_CB_REMOTE_INPUT): {
return HandleRegisterDelWhiteListCallback(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::REGISTER_NODE_LISTENER): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::REGISTER_NODE_LISTENER): {
return HandleRegisterInputNodeListener(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::UNREGISTER_NODE_LISTENER): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::UNREGISTER_NODE_LISTENER): {
return HandleUnRegisterInputNodeListener(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::REGISTER_SIMULATION_EVENT_LISTENER): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::REGISTER_SIMULATION_EVENT_LISTENER): {
return HandleRegisterSimulationEventListener(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::UNREGISTER_SIMULATION_EVENT_LISTENER): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::UNREGISTER_SIMULATION_EVENT_LISTENER): {
return HandleUnregisterSimulationEventListener(data, reply);
}
case static_cast<uint32_t>(IDistributedSourceInput::MessageCode::SYNC_NODE_INFO_REMOTE_INPUT): {
case static_cast<uint32_t>(IDInputSourceInterfaceCode::SYNC_NODE_INFO_REMOTE_INPUT): {
return HandleSyncNodeInfoRemoteInput(data, reply);
}
default:
@@ -18,6 +18,7 @@
#include "ipc_types.h"
#include "parcel.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -50,7 +51,7 @@ void GetSinkScreenInfosCallbackProxy::OnResult(const std::string& strJson)
DHLOGE("write strJson failed");
return;
}
remote->SendRequest(static_cast<int32_t>(IGetSinkScreenInfosCallback::Message::RESULT), data, reply, option);
remote->SendRequest(static_cast<uint32_t>(IGetSinkScreenInfosCBInterfaceCode::RESULT), data, reply, option);
}
} // namespace DistributedInput
} // namespace DistributedHardware
@@ -19,6 +19,7 @@
#include "constants_dinput.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -39,9 +40,9 @@ int32_t GetSinkScreenInfosCallbackStub::OnRemoteRequest(
DHLOGE("GetSinkScreenInfosCallbackStub read token valid failed");
return ERR_DH_INPUT_IPC_READ_TOKEN_VALID_FAIL;
}
IGetSinkScreenInfosCallback::Message msgCode = static_cast<IGetSinkScreenInfosCallback::Message>(code);
IGetSinkScreenInfosCBInterfaceCode msgCode = static_cast<IGetSinkScreenInfosCBInterfaceCode>(code);
switch (msgCode) {
case IGetSinkScreenInfosCallback::Message::RESULT: {
case IGetSinkScreenInfosCBInterfaceCode::RESULT: {
std::string strJson = data.ReadString();
OnResult(strJson);
break;
@@ -18,6 +18,7 @@
#include "ipc_types.h"
#include "parcel.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -61,7 +62,7 @@ void InputNodeListenerProxy::OnNodeOnLine(const std::string srcDevId, const std:
DHLOGE("InputNodeListenerProxy write sinkNodeDesc failed");
return;
}
int32_t ret = remote->SendRequest(static_cast<int32_t>(InputNodeListener::Message::RESULT_ON), data, reply, option);
int32_t ret = remote->SendRequest(static_cast<uint32_t>(InputNodeListenerInterfaceCode::RESULT_ON), data, reply, option);
if (ret != 0) {
return;
}
@@ -95,7 +96,7 @@ void InputNodeListenerProxy::OnNodeOffLine(const std::string srcDevId, const std
return;
}
int32_t ret =
remote->SendRequest(static_cast<int32_t>(InputNodeListener::Message::RESULT_OFF), data, reply, option);
remote->SendRequest(static_cast<uint32_t>(InputNodeListenerInterfaceCode::RESULT_OFF), data, reply, option);
if (ret != 0) {
return;
}
@@ -19,6 +19,7 @@
#include "constants_dinput.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -35,9 +36,9 @@ int32_t InputNodeListenerStub::OnRemoteRequest(
DHLOGE("InputNodeListenerStub read token valid failed");
return ERR_DH_INPUT_IPC_READ_TOKEN_VALID_FAIL;
}
InputNodeListener::Message msgCode = static_cast<InputNodeListener::Message>(code);
InputNodeListenerInterfaceCode msgCode = static_cast<InputNodeListenerInterfaceCode>(code);
switch (msgCode) {
case InputNodeListener::Message::RESULT_ON: {
case InputNodeListenerInterfaceCode::RESULT_ON: {
std::string srcDevId = data.ReadString();
std::string sinkDevId = data.ReadString();
std::string sinkNodeId = data.ReadString();
@@ -45,7 +46,7 @@ int32_t InputNodeListenerStub::OnRemoteRequest(
OnNodeOnLine(srcDevId, sinkDevId, sinkNodeId, sinkNodeDesc);
break;
}
case InputNodeListener::Message::RESULT_OFF: {
case InputNodeListenerInterfaceCode::RESULT_OFF: {
std::string srcDevId = data.ReadString();
std::string sinkDevId = data.ReadString();
std::string sinkNodeId = data.ReadString();
@@ -18,6 +18,7 @@
#include "ipc_types.h"
#include "parcel.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -53,7 +54,7 @@ void PrepareDInputCallbackProxy::OnResult(const std::string& deviceId, const int
return;
}
int32_t ret = remote->SendRequest(
static_cast<int32_t>(IPrepareDInputCallback::Message::RESULT), data, reply, option);
static_cast<uint32_t>(IPrepareDInputCBInterfaceCode::RESULT), data, reply, option);
if (ret != 0) {
return;
}
@@ -19,6 +19,7 @@
#include "constants_dinput.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -39,9 +40,9 @@ int32_t PrepareDInputCallbackStub::OnRemoteRequest(
DHLOGE("PrepareDInputCallbackStub read token valid failed");
return ERR_DH_INPUT_IPC_READ_TOKEN_VALID_FAIL;
}
IPrepareDInputCallback::Message msgCode = static_cast<IPrepareDInputCallback::Message>(code);
IPrepareDInputCBInterfaceCode msgCode = static_cast<IPrepareDInputCBInterfaceCode>(code);
switch (msgCode) {
case IPrepareDInputCallback::Message::RESULT: {
case IPrepareDInputCBInterfaceCode::RESULT: {
std::string deviceId = data.ReadString();
int32_t status = data.ReadInt32();
OnResult(deviceId, status);
@@ -18,6 +18,7 @@
#include "ipc_types.h"
#include "parcel.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -56,7 +57,7 @@ void RegisterDInputCallbackProxy::OnResult(const std::string& devId, const std::
return;
}
int32_t ret = remote->SendRequest(
static_cast<int32_t>(IRegisterDInputCallback::Message::RESULT), data, reply, option);
static_cast<uint32_t>(IRegisterDInputCBInterfaceCode::RESULT), data, reply, option);
if (ret != 0) {
return;
}
@@ -19,6 +19,7 @@
#include "constants_dinput.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -39,9 +40,9 @@ int32_t RegisterDInputCallbackStub::OnRemoteRequest(
DHLOGE("RegisterDInputCallbackStub read token valid failed");
return ERR_DH_INPUT_IPC_READ_TOKEN_VALID_FAIL;
}
IRegisterDInputCallback::Message msgCode = static_cast<IRegisterDInputCallback::Message>(code);
IRegisterDInputCBInterfaceCode msgCode = static_cast<IRegisterDInputCBInterfaceCode>(code);
switch (msgCode) {
case IRegisterDInputCallback::Message::RESULT: {
case IRegisterDInputCBInterfaceCode::RESULT: {
std::string devId = data.ReadString();
std::string dhId = data.ReadString();
int32_t status = data.ReadInt32();
@@ -19,6 +19,7 @@
#include "parcel.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -53,7 +54,7 @@ int32_t SharingDhIdListenerProxy::OnSharing(std::string dhId)
}
int32_t ret =
remote->SendRequest(static_cast<int32_t>(ISharingDhIdListener::Message::SHARING), data, reply, option);
remote->SendRequest(static_cast<uint32_t>(ISharingDhIdListenerInterfaceCode::SHARING), data, reply, option);
if (ret == DH_SUCCESS) {
result = reply.ReadInt32();
} else {
@@ -84,7 +85,7 @@ int32_t SharingDhIdListenerProxy::OnNoSharing(std::string dhId)
}
int32_t ret =
remote->SendRequest(static_cast<int32_t>(ISharingDhIdListener::Message::NO_SHARING), data, reply, option);
remote->SendRequest(static_cast<uint32_t>(ISharingDhIdListenerInterfaceCode::NO_SHARING), data, reply, option);
if (ret == DH_SUCCESS) {
result = reply.ReadInt32();
} else {
@@ -19,6 +19,7 @@
#include "constants_dinput.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -35,9 +36,9 @@ int32_t SharingDhIdListenerStub::OnRemoteRequest(
DHLOGE("SharingDhIdListenerStub read token valid failed");
return ERR_DH_INPUT_IPC_READ_TOKEN_VALID_FAIL;
}
ISharingDhIdListener::Message msgCode = static_cast<ISharingDhIdListener::Message>(code);
ISharingDhIdListenerInterfaceCode msgCode = static_cast<ISharingDhIdListenerInterfaceCode>(code);
switch (msgCode) {
case ISharingDhIdListener::Message::SHARING: {
case ISharingDhIdListenerInterfaceCode::SHARING: {
std::string dhId = data.ReadString();
int32_t ret = OnSharing(dhId);
if (!reply.WriteInt32(ret)) {
@@ -46,7 +47,7 @@ int32_t SharingDhIdListenerStub::OnRemoteRequest(
}
break;
}
case ISharingDhIdListener::Message::NO_SHARING: {
case ISharingDhIdListenerInterfaceCode::NO_SHARING: {
std::string dhId = data.ReadString();
int32_t ret = OnNoSharing(dhId);
if (!reply.WriteInt32(ret)) {
@@ -19,6 +19,7 @@
#include "parcel.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -60,7 +61,7 @@ int32_t SimulationEventListenerProxy::OnSimulationEvent(uint32_t type, uint32_t
return ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL;
}
int32_t ret =
remote->SendRequest(static_cast<int32_t>(ISimulationEventListener::Message::RESULT_ON), data, reply, option);
remote->SendRequest(static_cast<uint32_t>(ISimulationEventListenerInterfaceCode::RESULT_ON), data, reply, option);
if (ret == DH_SUCCESS) {
result = reply.ReadInt32();
} else {
@@ -19,6 +19,7 @@
#include "constants_dinput.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -35,9 +36,9 @@ int32_t SimulationEventListenerStub::OnRemoteRequest(
DHLOGE("SimulationEventListenerStub read token valid failed");
return ERR_DH_INPUT_IPC_READ_TOKEN_VALID_FAIL;
}
ISimulationEventListener::Message msgCode = static_cast<ISimulationEventListener::Message>(code);
ISimulationEventListenerInterfaceCode msgCode = static_cast<ISimulationEventListenerInterfaceCode>(code);
switch (msgCode) {
case ISimulationEventListener::Message::RESULT_ON: {
case ISimulationEventListenerInterfaceCode::RESULT_ON: {
uint32_t eventType = data.ReadUint32();
uint32_t eventCode = data.ReadUint32();
int32_t eventValue = data.ReadInt32();
@@ -18,6 +18,7 @@
#include "ipc_types.h"
#include "parcel.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -59,7 +60,7 @@ void StartDInputCallbackProxy::OnResult(const std::string& devId, const uint32_t
return;
}
int32_t ret = remote->SendRequest(
static_cast<int32_t>(IStartDInputCallback::Message::RESULT), data, reply, option);
static_cast<uint32_t>(IStartDInputCBInterfaceCode::RESULT), data, reply, option);
if (ret != 0) {
return;
}
@@ -19,6 +19,7 @@
#include "constants_dinput.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -39,9 +40,9 @@ int32_t StartDInputCallbackStub::OnRemoteRequest(
DHLOGE("StartDInputCallbackStub read token valid failed");
return ERR_DH_INPUT_IPC_READ_TOKEN_VALID_FAIL;
}
IStartDInputCallback::Message msgCode = static_cast<IStartDInputCallback::Message>(code);
IStartDInputCBInterfaceCode msgCode = static_cast<IStartDInputCBInterfaceCode>(code);
switch (msgCode) {
case IStartDInputCallback::Message::RESULT: {
case IStartDInputCBInterfaceCode::RESULT: {
std::string deviceId = data.ReadString();
uint32_t inputTypes = data.ReadUint32();
int32_t status = data.ReadInt32();
@@ -18,6 +18,7 @@
#include "ipc_types.h"
#include "parcel.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -52,7 +53,7 @@ void StartStopDInputsCallbackProxy::OnResultDhids(const std::string &devId, cons
DHLOGE("StartStopDInputsCallbackProxy write status valid failed");
return;
}
int32_t ret = remote->SendRequest(static_cast<int32_t>(IStartStopDInputsCallback::Message::RESULT_STRING),
int32_t ret = remote->SendRequest(static_cast<uint32_t>(IStartStopDInputsCBInterfaceCode::RESULT_STRING),
data, reply, option);
if (ret != 0) {
DHLOGE("OnResultDhids error, ret = %d", ret);
@@ -19,6 +19,7 @@
#include "constants_dinput.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -35,9 +36,9 @@ int32_t StartStopDInputsCallbackStub::OnRemoteRequest(
if (descriptor != IStartStopDInputsCallback::GetDescriptor()) {
return ERR_DH_INPUT_IPC_INVALID_DESCRIPTOR;
}
IStartStopDInputsCallback::Message msgCode = static_cast<IStartStopDInputsCallback::Message>(code);
IStartStopDInputsCBInterfaceCode msgCode = static_cast<IStartStopDInputsCBInterfaceCode>(code);
switch (msgCode) {
case IStartStopDInputsCallback::Message::RESULT_STRING: {
case IStartStopDInputsCBInterfaceCode::RESULT_STRING: {
std::string devId = data.ReadString();
int32_t status = data.ReadInt32();
DHLOGW("OnResultDhids received.");
@@ -17,6 +17,7 @@
#include "parcel.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
#include "start_stop_result_call_back_proxy.h"
@@ -67,7 +68,7 @@ void StartStopResultCallbackProxy::OnStart(
}
int32_t ret =
remote->SendRequest(static_cast<int32_t>(IStartStopResultCallback::Message::RESULT_START), data, reply, option);
remote->SendRequest(static_cast<uint32_t>(IStartStopResultCBInterfaceCode::RESULT_START), data, reply, option);
if (ret != 0) {
DHLOGE("StartStopResultCallbackProxy SendRequest errno:%d", ret);
return;
@@ -112,7 +113,7 @@ void StartStopResultCallbackProxy::OnStop(
}
int32_t ret =
remote->SendRequest(static_cast<int32_t>(IStartStopResultCallback::Message::RESULT_STOP), data, reply, option);
remote->SendRequest(static_cast<uint32_t>(IStartStopResultCBInterfaceCode::RESULT_STOP), data, reply, option);
if (ret != 0) {
DHLOGE("StartStopResultCallbackProxy SendRequest errno:%d", ret);
return;
@@ -19,6 +19,7 @@
#include "constants_dinput.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -35,9 +36,9 @@ int32_t StartStopResultCallbackStub::OnRemoteRequest(
if (descriptor != IStartStopResultCallback::GetDescriptor()) {
return ERR_DH_INPUT_IPC_INVALID_DESCRIPTOR;
}
IStartStopResultCallback::Message msgCode = static_cast<IStartStopResultCallback::Message>(code);
IStartStopResultCBInterfaceCode msgCode = static_cast<IStartStopResultCBInterfaceCode>(code);
switch (msgCode) {
case IStartStopResultCallback::Message::RESULT_START: {
case IStartStopResultCBInterfaceCode::RESULT_START: {
std::string srcId = data.ReadString();
std::string sinkId = data.ReadString();
uint32_t size = data.ReadUint32();
@@ -54,7 +55,7 @@ int32_t StartStopResultCallbackStub::OnRemoteRequest(
OnStart(srcId, sinkId, dhIds);
break;
}
case IStartStopResultCallback::Message::RESULT_STOP: {
case IStartStopResultCBInterfaceCode::RESULT_STOP: {
std::string srcId = data.ReadString();
std::string sinkId = data.ReadString();
uint32_t size = data.ReadUint32();
@@ -18,6 +18,7 @@
#include "ipc_types.h"
#include "parcel.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -59,7 +60,7 @@ void StopDInputCallbackProxy::OnResult(const std::string& devId, const uint32_t&
return;
}
int32_t ret = remote->SendRequest(
static_cast<int32_t>(IStopDInputCallback::Message::RESULT), data, reply, option);
static_cast<uint32_t>(IStopDInputCBInterfaceCode::RESULT), data, reply, option);
if (ret != 0) {
return;
}
@@ -19,6 +19,7 @@
#include "constants_dinput.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -39,9 +40,9 @@ int32_t StopDInputCallbackStub::OnRemoteRequest(
DHLOGE("StopDInputCallbackStub read token valid failed");
return ERR_DH_INPUT_IPC_READ_TOKEN_VALID_FAIL;
}
IStopDInputCallback::Message msgCode = static_cast<IStopDInputCallback::Message>(code);
IStopDInputCBInterfaceCode msgCode = static_cast<IStopDInputCBInterfaceCode>(code);
switch (msgCode) {
case IStopDInputCallback::Message::RESULT: {
case IStopDInputCBInterfaceCode::RESULT: {
std::string deviceId = data.ReadString();
uint32_t inputTypes = data.ReadUint32();
int32_t status = data.ReadInt32();
@@ -18,6 +18,7 @@
#include "ipc_types.h"
#include "parcel.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -55,7 +56,7 @@ void UnprepareDInputCallbackProxy::OnResult(const std::string& deviceId, const i
return;
}
int32_t ret = remote->SendRequest(
static_cast<int32_t>(IUnprepareDInputCallback::Message::RESULT), data, reply, option);
static_cast<uint32_t>(IUnprepareDInputCBInterfaceCode::RESULT), data, reply, option);
if (ret != 0) {
return;
}
@@ -19,6 +19,7 @@
#include "constants_dinput.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -39,9 +40,9 @@ int32_t UnprepareDInputCallbackStub::OnRemoteRequest(
DHLOGE("UnprepareDInputCallbackStub read token valid failed");
return ERR_DH_INPUT_IPC_READ_TOKEN_VALID_FAIL;
}
IUnprepareDInputCallback::Message msgCode = static_cast<IUnprepareDInputCallback::Message>(code);
IUnprepareDInputCBInterfaceCode msgCode = static_cast<IUnprepareDInputCBInterfaceCode>(code);
switch (msgCode) {
case IUnprepareDInputCallback::Message::RESULT: {
case IUnprepareDInputCBInterfaceCode::RESULT: {
std::string deviceId = data.ReadString();
int32_t status = data.ReadInt32();
OnResult(deviceId, status);
@@ -18,6 +18,7 @@
#include "ipc_types.h"
#include "parcel.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -59,7 +60,7 @@ void UnregisterDInputCallbackProxy::OnResult(const std::string& devId, const std
return;
}
int32_t ret = remote->SendRequest(
static_cast<int32_t>(IUnregisterDInputCallback::Message::RESULT), data, reply, option);
static_cast<uint32_t>(IUnregisterDInputCBInterfaceCode::RESULT), data, reply, option);
if (ret != 0) {
return;
}
@@ -19,6 +19,7 @@
#include "constants_dinput.h"
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
#include "dinput_log.h"
namespace OHOS {
@@ -39,9 +40,9 @@ int32_t UnregisterDInputCallbackStub::OnRemoteRequest(
DHLOGE("UnregisterDInputCallbackStub read token valid failed");
return ERR_DH_INPUT_IPC_READ_TOKEN_VALID_FAIL;
}
IUnregisterDInputCallback::Message msgCode = static_cast<IUnregisterDInputCallback::Message>(code);
IUnregisterDInputCBInterfaceCode msgCode = static_cast<IUnregisterDInputCBInterfaceCode>(code);
switch (msgCode) {
case IUnregisterDInputCallback::Message::RESULT: {
case IUnregisterDInputCBInterfaceCode::RESULT: {
std::string devId = data.ReadString();
std::string dhId = data.ReadString();
int32_t status = data.ReadInt32();
@@ -17,6 +17,7 @@
#include <memory>
#include "dinput_errcode.h"
#include "dinput_ipc_interface_code.h"
namespace OHOS {
namespace DistributedHardware {
@@ -352,10 +353,10 @@ HWTEST_F(DInputSourceCallBackTest, SendRequest01, testing::ext::TestSize.Level1)
{
sptr<IRemoteObject> callBackStubPtr = new TestDInputSourceCallBackStub();
DistributedInputSourceProxy callBackProxy(callBackStubPtr);
IDistributedSourceInput::MessageCode code = IDistributedSourceInput::MessageCode::INIT;
IDInputSourceInterfaceCode code = IDInputSourceInterfaceCode::INIT;
MessageParcel data;
MessageParcel reply;
bool ret = callBackProxy.SendRequest(code, data, reply);
bool ret = callBackProxy.SendRequest(static_cast<uint32_t>(code), data, reply);
EXPECT_EQ(false, ret);
}