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 SE_VENDOR_ADAPTIONS_H 17 #define SE_VENDOR_ADAPTIONS_H 18 19 #include "isecure_element_vendor.h" 20 21 #include "remote_death_recipient.h" 22 23 namespace OHOS { 24 namespace HDI { 25 namespace SecureElement { 26 class SeVendorAdaptions : public ISecureElementVendor { 27 public: 28 SeVendorAdaptions(); 29 ~SeVendorAdaptions() override; 30 31 int32_t init(const sptr<ISecureElementCallback>& clientCallback, SecureElementStatus& status) override; 32 33 int32_t getAtr(std::vector<uint8_t>& response) override; 34 35 int32_t isSecureElementPresent(bool& present) override; 36 37 int32_t openLogicalChannel(const std::vector<uint8_t>& aid, uint8_t p2, std::vector<uint8_t>& response, 38 uint8_t& channelNumber, SecureElementStatus& status) override; 39 40 int32_t openBasicChannel(const std::vector<uint8_t>& aid, uint8_t p2, std::vector<uint8_t>& response, 41 SecureElementStatus& status) override; 42 43 int32_t closeChannel(uint8_t channelNumber, SecureElementStatus& status) override; 44 45 int32_t transmit(const std::vector<uint8_t>& command, std::vector<uint8_t>& response, 46 SecureElementStatus& status) override; 47 48 int32_t reset(SecureElementStatus& status) override; 49 50 SecureElementStatus getStatusBySW(uint8_t sw1, uint8_t sw2) const; 51 52 private: 53 void OnRemoteDied(const wptr<IRemoteObject> &object); 54 int32_t AddSecureElementDeathRecipient(const sptr<ISecureElementCallback> &callbackObj); 55 int32_t RemoveSecureElementDeathRecipient(const sptr<ISecureElementCallback> &callbackObj); 56 57 sptr<RemoteDeathRecipient> remoteDeathRecipient_ = nullptr; 58 }; 59 } // SecureElement 60 } // HDI 61 } // OHOS 62 63 #endif // SE_VENDOR_ADAPTIONS_H 64