1bc2ed2b3Sopenharmony_ci/* 2bc2ed2b3Sopenharmony_ci * Copyright (C) 2023 Huawei Device Co., Ltd. 3bc2ed2b3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4bc2ed2b3Sopenharmony_ci * you may not use this file except in compliance with the License. 5bc2ed2b3Sopenharmony_ci * You may obtain a copy of the License at 6bc2ed2b3Sopenharmony_ci * 7bc2ed2b3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8bc2ed2b3Sopenharmony_ci * 9bc2ed2b3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10bc2ed2b3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11bc2ed2b3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12bc2ed2b3Sopenharmony_ci * See the License for the specific language governing permissions and 13bc2ed2b3Sopenharmony_ci * limitations under the License. 14bc2ed2b3Sopenharmony_ci */ 15bc2ed2b3Sopenharmony_ci#ifndef I_NCI_CE_INTERFACE_H 16bc2ed2b3Sopenharmony_ci#define I_NCI_CE_INTERFACE_H 17bc2ed2b3Sopenharmony_ci#include <string> 18bc2ed2b3Sopenharmony_ci 19bc2ed2b3Sopenharmony_cinamespace OHOS { 20bc2ed2b3Sopenharmony_cinamespace NFC { 21bc2ed2b3Sopenharmony_cinamespace NCI { 22bc2ed2b3Sopenharmony_ciclass INciCeInterface { 23bc2ed2b3Sopenharmony_cipublic: 24bc2ed2b3Sopenharmony_ci class ICeHostListener { 25bc2ed2b3Sopenharmony_ci public: 26bc2ed2b3Sopenharmony_ci virtual ~ICeHostListener() {} 27bc2ed2b3Sopenharmony_ci 28bc2ed2b3Sopenharmony_ci /** 29bc2ed2b3Sopenharmony_ci * @brief The notification for field on. 30bc2ed2b3Sopenharmony_ci */ 31bc2ed2b3Sopenharmony_ci virtual void FieldActivated() = 0; 32bc2ed2b3Sopenharmony_ci 33bc2ed2b3Sopenharmony_ci /** 34bc2ed2b3Sopenharmony_ci * @brief The notification for field off. 35bc2ed2b3Sopenharmony_ci */ 36bc2ed2b3Sopenharmony_ci virtual void FieldDeactivated() = 0; 37bc2ed2b3Sopenharmony_ci /** 38bc2ed2b3Sopenharmony_ci * @brief deal with card emulation data 39bc2ed2b3Sopenharmony_ci * @note 40bc2ed2b3Sopenharmony_ci * @param data: card emulation data 41bc2ed2b3Sopenharmony_ci */ 42bc2ed2b3Sopenharmony_ci virtual void OnCardEmulationData(const std::vector<uint8_t> &data) = 0; 43bc2ed2b3Sopenharmony_ci /** 44bc2ed2b3Sopenharmony_ci * @brief card emulation activate 45bc2ed2b3Sopenharmony_ci * @note 46bc2ed2b3Sopenharmony_ci */ 47bc2ed2b3Sopenharmony_ci virtual void OnCardEmulationActivated() = 0; 48bc2ed2b3Sopenharmony_ci /** 49bc2ed2b3Sopenharmony_ci * @brief card emulation deactivate 50bc2ed2b3Sopenharmony_ci * @note 51bc2ed2b3Sopenharmony_ci */ 52bc2ed2b3Sopenharmony_ci virtual void OnCardEmulationDeactivated() = 0; 53bc2ed2b3Sopenharmony_ci }; 54bc2ed2b3Sopenharmony_ci 55bc2ed2b3Sopenharmony_ci virtual ~INciCeInterface() = default; 56bc2ed2b3Sopenharmony_ci 57bc2ed2b3Sopenharmony_ci /** 58bc2ed2b3Sopenharmony_ci * @brief Set the listener to receive the card emulation notifications. 59bc2ed2b3Sopenharmony_ci * @param listener The listener to receive the card emulation notifications. 60bc2ed2b3Sopenharmony_ci */ 61bc2ed2b3Sopenharmony_ci virtual void SetCeHostListener(std::weak_ptr<ICeHostListener> listener) = 0; 62bc2ed2b3Sopenharmony_ci 63bc2ed2b3Sopenharmony_ci /** 64bc2ed2b3Sopenharmony_ci * @brief compute the routing parameters based on the default payment app 65bc2ed2b3Sopenharmony_ci * and all installed app. 66bc2ed2b3Sopenharmony_ci * @param defaultPaymentType: default payment type 67bc2ed2b3Sopenharmony_ci * @return True if success, otherwise false. 68bc2ed2b3Sopenharmony_ci */ 69bc2ed2b3Sopenharmony_ci virtual bool ComputeRoutingParams(int defaultPaymentType) = 0; 70bc2ed2b3Sopenharmony_ci 71bc2ed2b3Sopenharmony_ci /** 72bc2ed2b3Sopenharmony_ci * @brief Commit the routing parameters to nfc controller. 73bc2ed2b3Sopenharmony_ci * @return True if success, otherwise false. 74bc2ed2b3Sopenharmony_ci */ 75bc2ed2b3Sopenharmony_ci virtual bool CommitRouting() = 0; 76bc2ed2b3Sopenharmony_ci 77bc2ed2b3Sopenharmony_ci /** 78bc2ed2b3Sopenharmony_ci * @brief send raw frame data 79bc2ed2b3Sopenharmony_ci * @param hexCmdData the data to send 80bc2ed2b3Sopenharmony_ci * @return True if success, otherwise false. 81bc2ed2b3Sopenharmony_ci */ 82bc2ed2b3Sopenharmony_ci virtual bool SendRawFrame(std::string &hexCmdData) = 0; 83bc2ed2b3Sopenharmony_ci 84bc2ed2b3Sopenharmony_ci /** 85bc2ed2b3Sopenharmony_ci * @brief add aid routing 86bc2ed2b3Sopenharmony_ci * @param aidStr: aid 87bc2ed2b3Sopenharmony_ci * @param route: route dest 88bc2ed2b3Sopenharmony_ci * @param aidInfo: prefix subset etc 89bc2ed2b3Sopenharmony_ci * @param power: power state 90bc2ed2b3Sopenharmony_ci * @return True if success, otherwise false. 91bc2ed2b3Sopenharmony_ci */ 92bc2ed2b3Sopenharmony_ci virtual bool AddAidRouting(const std::string &aidStr, int route, int aidInfo, int power) = 0; 93bc2ed2b3Sopenharmony_ci /** 94bc2ed2b3Sopenharmony_ci * @brief clear aid table 95bc2ed2b3Sopenharmony_ci * @return True if success, otherwise false. 96bc2ed2b3Sopenharmony_ci */ 97bc2ed2b3Sopenharmony_ci virtual bool ClearAidTable() = 0; 98bc2ed2b3Sopenharmony_ci 99bc2ed2b3Sopenharmony_ci /** 100bc2ed2b3Sopenharmony_ci * @brief get sim bundle name of the vendor 101bc2ed2b3Sopenharmony_ci * @return sim bundle name of the vendor 102bc2ed2b3Sopenharmony_ci */ 103bc2ed2b3Sopenharmony_ci virtual std::string GetSimVendorBundleName() = 0; 104bc2ed2b3Sopenharmony_ci 105bc2ed2b3Sopenharmony_ci /** 106bc2ed2b3Sopenharmony_ci * @brief Notify Default Payment Type 107bc2ed2b3Sopenharmony_ci * @param paymentType see enum DefaultPaymentType 108bc2ed2b3Sopenharmony_ci */ 109bc2ed2b3Sopenharmony_ci virtual void NotifyDefaultPaymentType(int paymentType) = 0; 110bc2ed2b3Sopenharmony_ci}; 111bc2ed2b3Sopenharmony_ci} // namespace NCI 112bc2ed2b3Sopenharmony_ci} // namespace NFC 113bc2ed2b3Sopenharmony_ci} // namespace OHOS 114bc2ed2b3Sopenharmony_ci#endif // I_NCI_CE_INTERFACE_H 115