1bc2ed2b3Sopenharmony_ci/*
2bc2ed2b3Sopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd.
3bc2ed2b3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4bc2ed2b3Sopenharmony_ci * you may not use this file except in compliance with the License.
5bc2ed2b3Sopenharmony_ci * You may obtain a copy of the License at
6bc2ed2b3Sopenharmony_ci *
7bc2ed2b3Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8bc2ed2b3Sopenharmony_ci *
9bc2ed2b3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10bc2ed2b3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11bc2ed2b3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12bc2ed2b3Sopenharmony_ci * See the License for the specific language governing permissions and
13bc2ed2b3Sopenharmony_ci * limitations under the License.
14bc2ed2b3Sopenharmony_ci */
15bc2ed2b3Sopenharmony_ci#ifndef NFC_CONTROLLER_STUB_H
16bc2ed2b3Sopenharmony_ci#define NFC_CONTROLLER_STUB_H
17bc2ed2b3Sopenharmony_ci
18bc2ed2b3Sopenharmony_ci#include "indef_msg_callback.h"
19bc2ed2b3Sopenharmony_ci#include "infc_controller_callback.h"
20bc2ed2b3Sopenharmony_ci#include "infc_controller_service.h"
21bc2ed2b3Sopenharmony_ci#ifdef VENDOR_APPLICATIONS_ENABLED
22bc2ed2b3Sopenharmony_ci#include "iquery_app_info_callback.h"
23bc2ed2b3Sopenharmony_ci#endif
24bc2ed2b3Sopenharmony_ci#include "iremote_stub.h"
25bc2ed2b3Sopenharmony_ci#include "nfc_controller_callback_proxy.h"
26bc2ed2b3Sopenharmony_ci#include "nfc_sdk_common.h"
27bc2ed2b3Sopenharmony_ci#include "message_parcel.h"
28bc2ed2b3Sopenharmony_ci#include "access_token.h"
29bc2ed2b3Sopenharmony_ci
30bc2ed2b3Sopenharmony_cinamespace OHOS {
31bc2ed2b3Sopenharmony_cinamespace NFC {
32bc2ed2b3Sopenharmony_ciclass NfcControllerStub : public OHOS::IRemoteStub<OHOS::NFC::INfcControllerService> {
33bc2ed2b3Sopenharmony_cipublic:
34bc2ed2b3Sopenharmony_ci    int OnRemoteRequest(uint32_t code,                /* [in] */
35bc2ed2b3Sopenharmony_ci                        OHOS::MessageParcel& data,    /* [in] */
36bc2ed2b3Sopenharmony_ci                        OHOS::MessageParcel& reply,   /* [out] */
37bc2ed2b3Sopenharmony_ci                        OHOS::MessageOption& option) override; /* [in] */
38bc2ed2b3Sopenharmony_ci
39bc2ed2b3Sopenharmony_ci    NfcControllerStub() {}
40bc2ed2b3Sopenharmony_ci    virtual ~NfcControllerStub() {}
41bc2ed2b3Sopenharmony_ci    virtual KITS::ErrorCode RegisterCallBack(const sptr<INfcControllerCallback> &callback,
42bc2ed2b3Sopenharmony_ci        const std::string& type, Security::AccessToken::AccessTokenID callerToken) = 0;
43bc2ed2b3Sopenharmony_ci    virtual KITS::ErrorCode UnRegisterCallBack(const std::string& type,
44bc2ed2b3Sopenharmony_ci        Security::AccessToken::AccessTokenID callerToken) = 0;
45bc2ed2b3Sopenharmony_ci    virtual KITS::ErrorCode UnRegisterAllCallBack(Security::AccessToken::AccessTokenID callerToken) = 0;
46bc2ed2b3Sopenharmony_ci    virtual KITS::ErrorCode RegNdefMsgCallback(const sptr<INdefMsgCallback> &callback) = 0;
47bc2ed2b3Sopenharmony_ci    void RemoveNfcDeathRecipient(const wptr<IRemoteObject> &remote);
48bc2ed2b3Sopenharmony_ci
49bc2ed2b3Sopenharmony_ciprivate:
50bc2ed2b3Sopenharmony_ci    int HandleGetState(OHOS::MessageParcel& data, OHOS::MessageParcel& reply);
51bc2ed2b3Sopenharmony_ci    int HandleTurnOn(OHOS::MessageParcel& data, OHOS::MessageParcel& reply);
52bc2ed2b3Sopenharmony_ci    int HandleTurnOff(OHOS::MessageParcel& data, OHOS::MessageParcel& reply);
53bc2ed2b3Sopenharmony_ci    int HandleIsNfcOpen(OHOS::MessageParcel& data, OHOS::MessageParcel& reply);
54bc2ed2b3Sopenharmony_ci    int HandleRegisterCallBack(OHOS::MessageParcel& data, OHOS::MessageParcel& reply);
55bc2ed2b3Sopenharmony_ci    int HandleUnRegisterCallBack(OHOS::MessageParcel& data, OHOS::MessageParcel& reply);
56bc2ed2b3Sopenharmony_ci    int HandleGetNfcTagInterface(MessageParcel& data, MessageParcel& reply);
57bc2ed2b3Sopenharmony_ci    int HandleRegNdefMsgCb(MessageParcel& data, MessageParcel& reply);
58bc2ed2b3Sopenharmony_ci#ifdef VENDOR_APPLICATIONS_ENABLED
59bc2ed2b3Sopenharmony_ci    int HandleRegQueryApplicationCb(MessageParcel& data, MessageParcel& reply);
60bc2ed2b3Sopenharmony_ci    int HandleRegCardEmulationNotifyCb(MessageParcel& data, MessageParcel& reply);
61bc2ed2b3Sopenharmony_ci    int HandleNotifyEventStatus(MessageParcel& data, MessageParcel& reply);
62bc2ed2b3Sopenharmony_ci#endif
63bc2ed2b3Sopenharmony_ci    int HandleGetNfcHceInterface(MessageParcel &data, MessageParcel &reply);
64bc2ed2b3Sopenharmony_ci
65bc2ed2b3Sopenharmony_ciprivate:
66bc2ed2b3Sopenharmony_ci    KITS::ErrorCode RegisterCallBack(const sptr<INfcControllerCallback> &callback,
67bc2ed2b3Sopenharmony_ci        const std::string& type) override;
68bc2ed2b3Sopenharmony_ci    KITS::ErrorCode UnRegisterCallBack(const std::string& type) override;
69bc2ed2b3Sopenharmony_ci    KITS::ErrorCode RegNdefMsgCb(const sptr<INdefMsgCallback> &callback) override;
70bc2ed2b3Sopenharmony_ci
71bc2ed2b3Sopenharmony_ciprivate:
72bc2ed2b3Sopenharmony_ci    std::mutex mutex_ {};
73bc2ed2b3Sopenharmony_ci    sptr<INfcControllerCallback> callback_;
74bc2ed2b3Sopenharmony_ci    sptr<INdefMsgCallback> ndefCallback_;
75bc2ed2b3Sopenharmony_ci#ifdef VENDOR_APPLICATIONS_ENABLED
76bc2ed2b3Sopenharmony_ci    sptr<IQueryAppInfoCallback> queryAppInfoCallback_ {nullptr};
77bc2ed2b3Sopenharmony_ci    sptr<IOnCardEmulationNotifyCb> onCardEmulationNotifyCb_ {nullptr};
78bc2ed2b3Sopenharmony_ci#endif
79bc2ed2b3Sopenharmony_ci    sptr<IRemoteObject::DeathRecipient> deathRecipient_ {nullptr};
80bc2ed2b3Sopenharmony_ci};
81bc2ed2b3Sopenharmony_ci}  // namespace NFC
82bc2ed2b3Sopenharmony_ci}  // namespace OHOS
83bc2ed2b3Sopenharmony_ci#endif  // NFC_CONTROLLER_STUB_H
84