1 /* 2 * Copyright (c) 2021-2023 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 "del_white_list_infos_call_back_proxy.h" 17 18 #include "ipc_types.h" 19 #include "parcel.h" 20 21 #include "dinput_log.h" 22 23 namespace OHOS { 24 namespace DistributedHardware { 25 namespace DistributedInput { DelWhiteListInfosCallbackProxy(const sptr<IRemoteObject> & object)26DelWhiteListInfosCallbackProxy::DelWhiteListInfosCallbackProxy(const sptr<IRemoteObject> &object) 27 : IRemoteProxy<IDelWhiteListInfosCallback>(object) 28 { 29 } 30 ~DelWhiteListInfosCallbackProxy()31DelWhiteListInfosCallbackProxy::~DelWhiteListInfosCallbackProxy() 32 { 33 } 34 OnResult(const std::string & deviceId)35void DelWhiteListInfosCallbackProxy::OnResult(const std::string &deviceId) 36 { 37 sptr<IRemoteObject> remote = Remote(); 38 if (remote == nullptr) { 39 return; 40 } 41 42 MessageParcel data; 43 MessageParcel reply; 44 MessageOption option; 45 if (!data.WriteInterfaceToken(GetDescriptor())) { 46 DHLOGE("DelWhiteListInfosCallbackProxy write token valid failed"); 47 return; 48 } 49 if (!data.WriteString(deviceId)) { 50 DHLOGE("DelWhiteListInfosCallbackProxy write deviceId failed"); 51 return; 52 } 53 remote->SendRequest(static_cast<uint32_t>(IDelWhiteListInfosCallback::Message::RESULT), data, reply, option); 54 } 55 } // namespace DistributedInput 56 } // namespace DistributedHardware 57 } // namespace OHOS 58