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