• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 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 #ifndef I_NCI_NFCC_INTERFACE_H
16 #define I_NCI_NFCC_INTERFACE_H
17 #include <string>
18 #include "want.h"
19 
20 namespace OHOS {
21 namespace NFC {
22 namespace NCI {
23 class INciNfccInterface {
24 public:
25     virtual ~INciNfccInterface() = default;
26 
27     /**
28      * @brief Initialize when turn on NFC
29      * @return True if success, otherwise false.
30      */
31     virtual bool Initialize() = 0;
32 
33     /**
34      * @brief Deinitialize when turn off NFC
35      * @return True if success, otherwise false.
36      */
37     virtual bool Deinitialize() = 0;
38 
39     /**
40      * @brief Start polling and listening
41      * @param techMask bitmask of the technologies
42      * @param enableReaderMode if enable tag polling
43      * @param enableHostRouting if enable host routing
44      * @param restart true if need restart, otherwise false.
45      */
46     virtual void EnableDiscovery(uint16_t techMask, bool enableReaderMode, bool enableHostRouting, bool restart) = 0;
47 
48     /**
49      * @brief Stop polling and listening
50      */
51     virtual void DisableDiscovery() = 0;
52 
53     /**
54      * @brief Set the screen statue to nfc controller.
55      * @param screenStateMask the bitmask of the screen state
56      * @return True if success, otherwise false.
57      */
58     virtual bool SetScreenStatus(uint8_t screenStateMask) = 0;
59 
60     /**
61      * @brief Get Nci version supprted by nfc controller.
62      * @return 0x20 if it's NCI2.0, otherwise 0x10 if it's NCI1.0.
63      */
64     virtual int GetNciVersion() = 0;
65 
66     /**
67      * @brief Abort the nfc controller if NCI timeout.
68      */
69     virtual void Abort() = 0;
70 
71     /**
72      * @brief Do factory reset for nfc controller.
73      */
74     virtual void FactoryReset() = 0;
75 
76     /**
77      * @brief Shutdown the device. Enable the nfc functionality if support power off case.
78      */
79     virtual void Shutdown() = 0;
80 
81     /**
82      * @brief Send a custom message to vendor
83     */
84     virtual void NotifyMessageToVendor(int key, const std::string& value) = 0;
85 
86     /**
87      * @brief Send want to vendor update
88     */
89     virtual void UpdateWantExtInfoByVendor(AAFwk::Want& want, const std::string& uri) = 0;
90 };
91 }  // namespace NCI
92 }  // namespace NFC
93 }  // namespace OHOS
94 #endif  // I_NCI_NFCC_INTERFACE_H
95