1 /*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "get_sink_screen_infos_call_back_stub.h"
17
18 #include "string_ex.h"
19
20 #include "constants_dinput.h"
21 #include "dinput_errcode.h"
22 #include "dinput_log.h"
23
24 namespace OHOS {
25 namespace DistributedHardware {
26 namespace DistributedInput {
GetSinkScreenInfosCallbackStub()27 GetSinkScreenInfosCallbackStub::GetSinkScreenInfosCallbackStub()
28 {
29 }
30
~GetSinkScreenInfosCallbackStub()31 GetSinkScreenInfosCallbackStub::~GetSinkScreenInfosCallbackStub()
32 {
33 }
34
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)35 int32_t GetSinkScreenInfosCallbackStub::OnRemoteRequest(
36 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
37 {
38 if (data.ReadInterfaceToken() != GetDescriptor()) {
39 DHLOGE("GetSinkScreenInfosCallbackStub read token valid failed");
40 return ERR_DH_INPUT_IPC_READ_TOKEN_VALID_FAIL;
41 }
42 IGetSinkScreenInfosCallback::Message msgCode = static_cast<IGetSinkScreenInfosCallback::Message>(code);
43 switch (msgCode) {
44 case IGetSinkScreenInfosCallback::Message::RESULT: {
45 std::string strJson = data.ReadString();
46 OnResult(strJson);
47 break;
48 }
49 default:
50 return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
51 }
52 return DH_SUCCESS;
53 }
54 } // namespace DistributedInput
55 } // namespace DistributedHardware
56 } // namespace OHOS
57