1 /* 2 * Copyright (C) 2024 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 APDU_COMMAND_H 17 #define APDU_COMMAND_H 18 19 #include <cstdint> 20 #include <string> 21 22 namespace OHOS { 23 namespace Telephony { 24 struct ApduData { 25 /* Class of an APDU as defined in GlobalPlatform Card Specification v.2.3. */ 26 uint32_t cla = 0; 27 28 /* Instruction of an APDU as defined in GlobalPlatform Card Specification v.2.3. */ 29 uint32_t ins = 0; 30 31 /* Parameter 1 of an APDU as defined in GlobalPlatform Card Specification v.2.3. */ 32 uint32_t p1 = 0; 33 34 /* Parameter 2 of an APDU as defined in GlobalPlatform Card Specification v.2.3. */ 35 uint32_t p2 = 0; 36 37 /* Parameter 3 of an APDU as defined in GlobalPlatform Card Specification v.2.3. */ 38 uint32_t p3 = 0; 39 40 /* Command data of an APDU as defined in GlobalPlatform Card Specification v.2.3. */ 41 std::string cmdHex = ""; 42 }; 43 44 struct ApduCommand { 45 /* Channel of an APDU as defined in GlobalPlatform Card Specification v.2.3. */ 46 uint32_t channel = 0; 47 48 /* Apdu data. */ 49 ApduData data; 50 ApduCommandOHOS::Telephony::ApduCommand51 ApduCommand(int32_t channelId, const ApduData &apduData) : channel(channelId), data(apduData) {} 52 }; 53 } // namespace Telephony 54 } // namespace OHOS 55 #endif // APDU_COMMAND_H