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 HCE_SESSION_H 16bc2ed2b3Sopenharmony_ci#define HCE_SESSION_H 17bc2ed2b3Sopenharmony_ci 18bc2ed2b3Sopenharmony_ci#include "element_name.h" 19bc2ed2b3Sopenharmony_ci#include "infc_service.h" 20bc2ed2b3Sopenharmony_ci#include "ihce_session.h" 21bc2ed2b3Sopenharmony_ci#include "hce_session_stub.h" 22bc2ed2b3Sopenharmony_ci#include "host_card_emulation_manager.h" 23bc2ed2b3Sopenharmony_ci#include "ability_info.h" 24bc2ed2b3Sopenharmony_ci 25bc2ed2b3Sopenharmony_cinamespace OHOS { 26bc2ed2b3Sopenharmony_cinamespace NFC { 27bc2ed2b3Sopenharmony_cinamespace HCE { 28bc2ed2b3Sopenharmony_ciusing AppExecFwk::AbilityInfo; 29bc2ed2b3Sopenharmony_ciusing OHOS::AppExecFwk::ElementName; 30bc2ed2b3Sopenharmony_ciclass HceSession final : public HceSessionStub { 31bc2ed2b3Sopenharmony_cipublic: 32bc2ed2b3Sopenharmony_ci // Constructor/Destructor 33bc2ed2b3Sopenharmony_ci explicit HceSession(std::shared_ptr<NFC::INfcService> service); 34bc2ed2b3Sopenharmony_ci ~HceSession() override; 35bc2ed2b3Sopenharmony_ci 36bc2ed2b3Sopenharmony_ci HceSession(const HceSession &) = delete; 37bc2ed2b3Sopenharmony_ci HceSession &operator=(const HceSession &) = delete; 38bc2ed2b3Sopenharmony_ci 39bc2ed2b3Sopenharmony_ci KITS::ErrorCode RegHceCmdCallbackByToken(const sptr<KITS::IHceCmdCallback> &callback, const std::string &type, 40bc2ed2b3Sopenharmony_ci Security::AccessToken::AccessTokenID callerToken) override; 41bc2ed2b3Sopenharmony_ci 42bc2ed2b3Sopenharmony_ci KITS::ErrorCode UnRegHceCmdCallback(const std::string &type, 43bc2ed2b3Sopenharmony_ci Security::AccessToken::AccessTokenID callerToken) override; 44bc2ed2b3Sopenharmony_ci KITS::ErrorCode UnRegAllCallback(Security::AccessToken::AccessTokenID callerToken) override; 45bc2ed2b3Sopenharmony_ci KITS::ErrorCode HandleWhenRemoteDie(Security::AccessToken::AccessTokenID callerToken) override; 46bc2ed2b3Sopenharmony_ci 47bc2ed2b3Sopenharmony_ci int SendRawFrameByToken(std::string hexCmdData, bool raw, std::string &hexRespData, 48bc2ed2b3Sopenharmony_ci Security::AccessToken::AccessTokenID callerToken) override; 49bc2ed2b3Sopenharmony_ci 50bc2ed2b3Sopenharmony_ci int GetPaymentServices(std::vector<AbilityInfo> &abilityInfos) override; 51bc2ed2b3Sopenharmony_ci 52bc2ed2b3Sopenharmony_ci KITS::ErrorCode IsDefaultService(ElementName &element, const std::string &type, bool &isDefaultService) override; 53bc2ed2b3Sopenharmony_ci 54bc2ed2b3Sopenharmony_ci KITS::ErrorCode StartHce(const ElementName &element, const std::vector<std::string> &aids) override; 55bc2ed2b3Sopenharmony_ci 56bc2ed2b3Sopenharmony_ci KITS::ErrorCode StopHce(const ElementName &element, Security::AccessToken::AccessTokenID callerToken) override; 57bc2ed2b3Sopenharmony_ci 58bc2ed2b3Sopenharmony_ci int32_t Dump(int32_t fd, const std::vector<std::u16string> &args) override; 59bc2ed2b3Sopenharmony_ci 60bc2ed2b3Sopenharmony_ciprivate: 61bc2ed2b3Sopenharmony_ci std::string GetDumpInfo(); 62bc2ed2b3Sopenharmony_ci#ifdef NFC_SIM_FEATURE 63bc2ed2b3Sopenharmony_ci void AppendSimBundle(std::vector<AbilityInfo> &paymentAbilityInfos); 64bc2ed2b3Sopenharmony_ci#endif 65bc2ed2b3Sopenharmony_ci std::weak_ptr<NFC::INfcService> nfcService_{}; 66bc2ed2b3Sopenharmony_ci std::weak_ptr<CeService> ceService_{}; 67bc2ed2b3Sopenharmony_ci}; 68bc2ed2b3Sopenharmony_ci} // namespace HCE 69bc2ed2b3Sopenharmony_ci} // namespace NFC 70bc2ed2b3Sopenharmony_ci} // namespace OHOS 71bc2ed2b3Sopenharmony_ci#endif 72