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