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 NCI_NFCC_PROXY_H 16 #define NCI_NFCC_PROXY_H 17 #include "inci_nfcc_interface.h" 18 19 namespace OHOS { 20 namespace NFC { 21 namespace NCI { 22 class NciNfccProxy final : public INciNfccInterface { 23 public: 24 NciNfccProxy(); 25 26 /** 27 * @brief Initialize when turn on NFC 28 * @return True if success, otherwise false. 29 */ 30 bool Initialize() override; 31 32 /** 33 * @brief Deinitialize when turn off NFC 34 * @return True if success, otherwise false. 35 */ 36 bool Deinitialize() override; 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 void EnableDiscovery(uint16_t techMask, bool enableReaderMode, bool enableHostRouting, bool restart) override; 46 47 /** 48 * @brief Stop polling and listening 49 */ 50 void DisableDiscovery() override; 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 bool SetScreenStatus(uint8_t screenStateMask) override; 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 int GetNciVersion() override; 64 65 /** 66 * @brief Abort the nfc controller if NCI timeout. 67 */ 68 void Abort() override; 69 70 /** 71 * @brief Do factory reset for nfc controller. 72 */ 73 void FactoryReset() override; 74 75 /** 76 * @brief Shutdown the device. Enable the nfc functionality if support power off case. 77 */ 78 void Shutdown() override; 79 80 /** 81 * @brief Send a custom message to vendor 82 */ 83 void NotifyMessageToVendor(int key, const std::string& value) override; 84 private: 85 std::shared_ptr<INciNfccInterface> nfccInterface_; 86 }; 87 } // namespace NCI 88 } // namespace NFC 89 } // namespace OHOS 90 #endif /* NCI_NFCC_PROXY_H */