1 /*
2 * Copyright (c) 2021-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 "unprepare_d_input_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 {
UnprepareDInputCallbackStub()27 UnprepareDInputCallbackStub::UnprepareDInputCallbackStub()
28 {
29 }
30
~UnprepareDInputCallbackStub()31 UnprepareDInputCallbackStub::~UnprepareDInputCallbackStub()
32 {
33 }
34
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)35 int32_t UnprepareDInputCallbackStub::OnRemoteRequest(
36 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
37 {
38 if (data.ReadInterfaceToken() != GetDescriptor()) {
39 DHLOGE("UnprepareDInputCallbackStub read token valid failed");
40 return ERR_DH_INPUT_IPC_READ_TOKEN_VALID_FAIL;
41 }
42 IUnprepareDInputCallback::Message msgCode = static_cast<IUnprepareDInputCallback::Message>(code);
43 switch (msgCode) {
44 case IUnprepareDInputCallback::Message::RESULT: {
45 std::string deviceId = data.ReadString();
46 int32_t status = data.ReadInt32();
47 OnResult(deviceId, status);
48 break;
49 }
50 default:
51 return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
52 }
53 return DH_SUCCESS;
54 }
55 } // namespace DistributedInput
56 } // namespace DistributedHardware
57 } // namespace OHOS
58