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 #ifndef I_NFC_CONTROLLER_SERVICE_H
16 #define I_NFC_CONTROLLER_SERVICE_H
17 
18 #include "nfc_sdk_common.h"
19 #include "indef_msg_callback.h"
20 #include "infc_controller_callback.h"
21 #ifdef VENDOR_APPLICATIONS_ENABLED
22 #include "ion_card_emulation_notify_cb.h"
23 #include "iquery_app_info_callback.h"
24 #endif
25 #include "iremote_broker.h"
26 #include "element_name.h"
27 
28 namespace OHOS {
29 namespace NFC {
30 class INfcControllerService : public OHOS::IRemoteBroker {
31 public:
32     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.nfc.INfcControllerService");
33 
~INfcControllerService()34     virtual ~INfcControllerService() {}
35     /**
36      * @brief  Get the NFC state
37      * @return The NFC State
38      */
39     virtual int GetState() = 0;
40     /**
41      * @brief Turn On NFC
42      * @return The status code of calling function.
43      */
44     virtual int TurnOn() = 0;
45     /**
46      * @brief Turn Off NFC
47      * @return The status code of calling function.
48      */
49     virtual int TurnOff() = 0;
50      /**
51      * @brief NFC enable
52      * @param isOpen The output for checking nfc is open or not.
53      * @return The status code of calling function.
54      */
55     virtual int IsNfcOpen(bool &isOpen) = 0;
56 
57     virtual KITS::ErrorCode RegisterCallBack(const sptr<INfcControllerCallback> &callback,
58         const std::string& type) = 0;
59     virtual KITS::ErrorCode UnRegisterCallBack(const std::string& type) = 0;
60     virtual OHOS::sptr<IRemoteObject> GetTagServiceIface() = 0;
61     virtual OHOS::sptr<IRemoteObject> GetHceServiceIface() = 0;
62     virtual KITS::ErrorCode RegNdefMsgCb(const sptr<INdefMsgCallback> &callback) = 0;
63 #ifdef VENDOR_APPLICATIONS_ENABLED
64     virtual KITS::ErrorCode RegQueryApplicationCb(sptr<IQueryAppInfoCallback> callback) = 0;
65     virtual KITS::ErrorCode RegCardEmulationNotifyCb(sptr<IOnCardEmulationNotifyCb> callback) = 0;
66     virtual KITS::ErrorCode NotifyEventStatus(int eventType, int arg1, std::string arg2) = 0;
67 #endif
68 };
69 }  // namespace NFC
70 }  // namespace OHOS
71 #endif  // I_NFC_CONTROLLER_SERVICE_H
72