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 HCE_SERVICE_H
17 #define HCE_SERVICE_H
18 
19 #include "nfc_sdk_common.h"
20 #include "ihce_cmd_callback.h"
21 #include "ihce_session.h"
22 #include "ability_info.h"
23 
24 namespace OHOS {
25 namespace NFC {
26 namespace KITS {
27 using OHOS::AppExecFwk::ElementName;
28 using AppExecFwk::AbilityInfo;
29 class HceService final {
30 public:
31     explicit HceService();
32     ~HceService();
33 
34     static HceService &GetInstance();
35 
36     ErrorCode RegHceCmdCallback(const sptr<KITS::IHceCmdCallback> &callback, const std::string &type);
37     ErrorCode StopHce(ElementName &element);
38     ErrorCode IsDefaultService(ElementName &element, const std::string &type, bool &isDefaultService);
39     int SendRawFrame(std::string hexCmdData, bool raw, std::string &hexRespData);
40     int GetPaymentServices(std::vector<AbilityInfo> &abilityInfos);
41     KITS::ErrorCode StartHce(const ElementName &element, const std::vector<std::string> &aids);
42 
43 protected:
44     OHOS::sptr<HCE::IHceSession> GetHceSessionProxy();
45 
46 private:
47     OHOS::sptr<HCE::IHceSession> hceSessionProxy_;
48 };
49 } // namespace KITS
50 } // namespace NFC
51 } // namespace OHOS
52 #endif