16#include "ByteArrayUtil.h"
25using namespace keyple::core::util;
26using namespace keyple::core::util::cpp;
29 const std::vector<uint8_t>& cardResponse,
const int offset)
30: mOffset(offset), mCardResponse(cardResponse) {}
39 return ByteArrayUtil::extractInt(mCardResponse, mOffset + 8, 3,
true);
44 return ByteArrayUtil::extractInt(mCardResponse, mOffset + 5, 3,
true);
49 std::vector<uint8_t> loadTime(2);
50 loadTime[0] = mCardResponse[mOffset + 11];
51 loadTime[1] = mCardResponse[mOffset + 12];
58 std::vector<uint8_t> loadDate(2);
59 loadDate[0] = mCardResponse[mOffset + 0];
60 loadDate[1] = mCardResponse[mOffset + 1];
67 std::vector<uint8_t> freeData(2);
68 freeData[0] = mCardResponse[mOffset + 2];
69 freeData[1] = mCardResponse[mOffset + 4];
76 return mCardResponse[mOffset + 3];
81 std::vector<uint8_t> samId(4);
82 System::arraycopy(mCardResponse, mOffset + 13, samId, 0, 4);
89 std::vector<uint8_t> tnNum(2);
90 tnNum[0] = mCardResponse[mOffset + 20];
91 tnNum[1] = mCardResponse[mOffset + 21];
93 return ByteArrayUtil::extractInt(tnNum, 0, 2,
false);
98 std::vector<uint8_t> samTNum(3);
99 System::arraycopy(mCardResponse, mOffset + 17, samTNum, 0, 3);
101 return ByteArrayUtil::extractInt(samTNum, 0, 3,
false);
106 os <<
"SV_LOAD_LOG_RECORD_ADAPTER: {"
112 <<
"KVC: " << ra.
getKvc() <<
", "
113 <<
"SAM_ID: " << ra.
getSamId() <<
", "
114 <<
"SV_TRANSACTION_NUMBER: " << ra.
getSvTNum() <<
", "
115 <<
"SV_SAM_TRANSACTION_NUMBER: " << ra.
getSamTNum()
121std::ostream&
operator<<(std::ostream& os,
const std::shared_ptr<SvLoadLogRecordAdapter> ra)
124 os <<
"SV_LOAD_LOG_RECORD_ADAPTER: null";
135 "\"amount\":" + std::to_string(
getAmount()) +
", " \
136 "\"balance\":" + std::to_string(
getBalance()) +
", " \
137 "\"debitDate\":" + HexUtil::toHex(
getLoadDate()) +
", " \
138 "\"loadTime\":" + HexUtil::toHex(
getLoadDate()) +
", " \
139 "\"freeBytes\": \"" + HexUtil::toHex(
getFreeData()) +
"\", " \
140 "\"kvc\":" + std::to_string(
getKvc()) +
", " \
141 "\"samId\": \"" + HexUtil::toHex(
getSamId()) +
"\", " \
142 "\"svTransactionNumber\":" + std::to_string(
getSvTNum()) +
", " \
143 "\"svSamTransactionNumber\":" + std::to_string(
getSamTNum()) +
"" \
const std::vector< uint8_t > & getRawData() const override
const std::vector< uint8_t > getSamId() const override
uint8_t getKvc() const override
int getAmount() const override
const std::vector< uint8_t > getLoadTime() const override
const std::string toJSONString() const
const std::vector< uint8_t > getFreeData() const override
int getSvTNum() const override
int getSamTNum() const override
SvLoadLogRecordAdapter(const std::vector< uint8_t > &cardResponse, const int offset)
int getBalance() const override
const std::vector< uint8_t > getLoadDate() const override
std::ostream & operator<<(std::ostream &os, const std::shared_ptr< ApduRequestAdapter > ara)