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 16 #ifndef I_NCI_NATIVE_INTERFACE_H 17 #define I_NCI_NATIVE_INTERFACE_H 18 19 #include <memory> 20 #include "inci_ce_interface.h" 21 #include "inci_nfcc_interface.h" 22 #include "inci_tag_interface.h" 23 24 namespace OHOS { 25 namespace NFC { 26 namespace NCI { 27 class INciNativeInterface { 28 public: 29 virtual ~INciNativeInterface() = default; 30 31 /** 32 * @brief Get the ptr of INciCeInterface 33 * @return thr ptr of INciCeInterface 34 */ 35 virtual std::shared_ptr<INciCeInterface> GetNciCeInterface() = 0; 36 37 /** 38 * @brief Get the ptr of INciNfccInterface 39 * @return thr ptr of INciNfccInterface 40 */ 41 virtual std::shared_ptr<INciNfccInterface> GetNciNfccInterface() = 0; 42 43 /** 44 * @brief Get the ptr of INciTagInterface 45 * @return thr ptr of INciTagInterface 46 */ 47 virtual std::shared_ptr<INciTagInterface> GetNciTagInterface() = 0; 48 }; 49 50 #define DECLARE_NATIVE_INTERFACE(interfaceClass) \ 51 extern "C" INciNativeInterface *NewInterface(void) \ 52 { \ 53 return static_cast<INciNativeInterface *>(new interfaceClass()); \ 54 } \ 55 extern "C" void DeleteInterface(INciNativeInterface *p) \ 56 { \ 57 delete p; \ 58 } 59 } // namespace NCI 60 } // namespace NFC 61 } // namespace OHOS 62 63 #endif