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 OHOS_HDI_SE_IMPL_H
17 #define OHOS_HDI_SE_IMPL_H
18 #include "se_vendor_adaptions.h"
19 #include "v1_0/isecure_element_interface.h"
20 
21 namespace OHOS {
22 namespace HDI {
23 namespace SecureElement {
24 using OHOS::HDI::SecureElement::V1_0::ISecureElementInterface;
25 using OHOS::HDI::SecureElement::V1_0::ISecureElementCallback;
26 using OHOS::HDI::SecureElement::V1_0::SecureElementStatus;
27 
28 class SeImpl : public ISecureElementInterface {
29 public:
~SeImpl()30     virtual ~SeImpl() {}
31 
32     int32_t init(const sptr<ISecureElementCallback>& clientCallback, SecureElementStatus& status) override;
33 
34     int32_t getAtr(std::vector<uint8_t>& response) override;
35 
36     int32_t isSecureElementPresent(bool& present) override;
37 
38     int32_t openLogicalChannel(const std::vector<uint8_t>& aid, uint8_t p2, std::vector<uint8_t>& response,
39          uint8_t& channelNumber, SecureElementStatus& status) override;
40 
41     int32_t openBasicChannel(const std::vector<uint8_t>& aid, uint8_t p2, std::vector<uint8_t>& response,
42          SecureElementStatus& status) override;
43 
44     int32_t closeChannel(uint8_t channelNumber, SecureElementStatus& status) override;
45 
46     int32_t transmit(const std::vector<uint8_t>& command, std::vector<uint8_t>& response,
47          SecureElementStatus& status) override;
48 
49     int32_t reset(SecureElementStatus& status) override;
50 private:
51     SeVendorAdaptions adaptor_;
52 };
53 } // SecureElement
54 } // HDI
55 } // OHOS
56 
57 #endif // OHOS_HDI_SE_IMPL_H