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_HCE_SESSION_H 16 #define I_HCE_SESSION_H 17 18 #include "element_name.h" 19 #include "ihce_cmd_callback.h" 20 #include "iremote_broker.h" 21 #include "nfc_sdk_common.h" 22 #include "parcel.h" 23 #include "ability_info.h" 24 25 namespace OHOS { 26 namespace NFC { 27 namespace HCE { 28 using AppExecFwk::AbilityInfo; 29 using AppExecFwk::ElementName; 30 class IHceSession : public OHOS::IRemoteBroker { 31 public: 32 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.nfc.cardemulation.IHceSession"); 33 ~IHceSession()34 virtual ~IHceSession() {} 35 /** 36 * @brief register on hce cmd 37 * @param callback: callback 38 * @param type: register type hcecmd 39 * @return result 40 */ 41 virtual KITS::ErrorCode RegHceCmdCallback(const sptr<KITS::IHceCmdCallback> &callback, 42 const std::string &type) = 0; 43 /** 44 * @brief unregister off hce cmd 45 * @param callback: callback 46 * @param type: unregister type hcecmd 47 * @return result 48 */ 49 virtual KITS::ErrorCode UnregHceCmdCallback( 50 const sptr<KITS::IHceCmdCallback> &callback, const std::string &type) = 0; 51 /** 52 * @brief js service send raw data 53 * @param hexCmdData: raw data from js service 54 * @param raw: raw if true 55 * @param hexRespData: response data 56 * @return result 57 */ 58 virtual int SendRawFrame(std::string hexCmdData, bool raw, std::string &hexRespData) = 0; 59 /** 60 * @brief get payment services 61 * @param abilityInfos: payment services 62 * @return result 63 */ 64 virtual int GetPaymentServices(std::vector<AbilityInfo> &abilityInfos) = 0; 65 /** 66 * @brief stop hce, unregister callback and unset foreground service 67 * @param element: the element service want to stop hce 68 * @return result 69 */ 70 virtual KITS::ErrorCode StopHce(ElementName &element) = 0; 71 /** 72 * @brief whether the element is default service or not 73 * @param element: element to be judged 74 * @param type: card type 75 * @param isDefaultService: is default service 76 * @return result 77 */ 78 virtual KITS::ErrorCode IsDefaultService(ElementName &element, const std::string &type, 79 bool &isDefaultService) = 0; 80 /** 81 * @brief start hce 82 * @param element: foreground element 83 * @param aids: dynamic aid 84 * @return result 85 */ 86 virtual KITS::ErrorCode StartHce(const ElementName &element, const std::vector<std::string> &aids) = 0; 87 88 private: 89 }; 90 } // namespace HCE 91 } // namespace NFC 92 } // namespace OHOS 93 #endif 94