• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 REQUEST_APDU_BUILD_H
17 #define REQUEST_APDU_BUILD_H
18 
19 #include <list>
20 #include <mutex>
21 #include "apdu_command.h"
22 
23 namespace OHOS {
24 namespace Telephony {
25 class RequestApduBuild {
26 public:
RequestApduBuild(int32_t channelId)27     explicit RequestApduBuild(int32_t channelId): channelId_(channelId) {}
28     void BuildStoreData(const std::string &cmdHex);
29     std::list<std::unique_ptr<ApduCommand>> GetCommands();
30 
31 private:
32     void AddApdu(const ApduData &apduData);
33     void ConstructApduData(uint32_t packetTag, uint32_t packetIndex, uint32_t packetLen,
34         const std::string &cmdHex, ApduData &apduData);
35     int32_t channelId_ = 0;
36     std::list<std::unique_ptr<ApduCommand>> apduCommandLst_;
37     std::mutex mutex_;
38 };
39 } // namespace Telephony
40 } // namespace OHOS
41 #endif