• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 "pincode_invalid_callback_proxy.h"
17 #include "macro_utils.h"
18 #include "distributed_device_profile_errors.h"
19 #include "i_distributed_device_profile.h"
20 #include "message_parcel.h"
21 
22 namespace OHOS {
23 namespace DistributedDeviceProfile {
24 namespace {
25     const std::string TAG = "PinCodeInvalidCallbackProxy";
26 }
27 
OnPincodeInvalid(const LocalServiceInfo & localServiceInfo)28 int32_t PinCodeInvalidCallbackProxy::OnPincodeInvalid(const LocalServiceInfo& localServiceInfo)
29 {
30     sptr<IRemoteObject> remote = nullptr;
31     GET_REMOTE_OBJECT(remote);
32     MessageParcel data;
33     if (!data.WriteInterfaceToken(IPincodeInvalidCallback::GetDescriptor())) {
34         HILOGE("write descriptor failed");
35         return ERR_FLATTEN_OBJECT;
36     }
37     if (!localServiceInfo.Marshalling(data)) {
38         HILOGE("dp ipc write parcel fail");
39         return DP_WRITE_PARCEL_FAIL;
40     }
41     MessageParcel reply;
42     SEND_REQUEST(remote, static_cast<uint32_t>(DPInterfaceCode::ON_PINCODE_INVALID), data, reply);
43     return DP_SUCCESS;
44 }
45 } // namespace DistributedDeviceProfile
46 } // namespace OHOS
47 
48