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