16#include "ByteArrayUtil.h"
24using namespace keyple::core::util;
25using namespace keyple::core::util::cpp;
28 const std::vector<uint8_t>& cardResponse,
const int offset)
29: mOffset(offset), mCardResponse(cardResponse) {}
38 return ByteArrayUtil::threeBytesSignedToInt(mCardResponse, mOffset + 8);
43 return ByteArrayUtil::threeBytesSignedToInt(mCardResponse, mOffset + 5);
48 std::vector<uint8_t> loadTime(2);
49 loadTime[0] = mCardResponse[mOffset + 11];
50 loadTime[1] = mCardResponse[mOffset + 12];
57 std::vector<uint8_t> loadDate(2);
58 loadDate[0] = mCardResponse[mOffset + 0];
59 loadDate[1] = mCardResponse[mOffset + 1];
66 std::vector<uint8_t> freeData(2);
67 freeData[0] = mCardResponse[mOffset + 2];
68 freeData[1] = mCardResponse[mOffset + 4];
75 return mCardResponse[mOffset + 3];
80 std::vector<uint8_t> samId(4);
81 System::arraycopy(mCardResponse, mOffset + 13, samId, 0, 4);
88 std::vector<uint8_t> tnNum(2);
89 tnNum[0] = mCardResponse[mOffset + 20];
90 tnNum[1] = mCardResponse[mOffset + 21];
92 return ByteArrayUtil::twoBytesToInt(tnNum, 0);
97 std::vector<uint8_t> samTNum(3);
98 System::arraycopy(mCardResponse, mOffset + 17, samTNum, 0, 3);
100 return ByteArrayUtil::threeBytesToInt(samTNum, 0);
105 os <<
"SV_LOAD_LOG_RECORD_ADAPTER: {"
111 <<
"KVC: " << ra.
getKvc() <<
", "
112 <<
"SAM_ID: " << ra.
getSamId() <<
", "
113 <<
"SV_TRANSACTION_NUMBER: " << ra.
getSvTNum() <<
", "
114 <<
"SV_SAM_TRANSACTION_NUMBER: " << ra.
getSamTNum()
120std::ostream&
operator<<(std::ostream& os,
const std::shared_ptr<SvLoadLogRecordAdapter> ra)
123 os <<
"SV_LOAD_LOG_RECORD_ADAPTER: null";
134 "\"amount\":" + std::to_string(
getAmount()) +
", " \
135 "\"balance\":" + std::to_string(
getBalance()) +
", " \
136 "\"debitDate\":" + ByteArrayUtil::toHex(
getLoadDate()) +
", " \
137 "\"loadTime\":" + ByteArrayUtil::toHex(
getLoadDate()) +
", " \
138 "\"freeBytes\": \"" + ByteArrayUtil::toHex(
getFreeData()) +
"\", " \
139 "\"kvc\":" + std::to_string(
getKvc()) +
", " \
140 "\"samId\": \"" + ByteArrayUtil::toHex(
getSamId()) +
"\", " \
141 "\"svTransactionNumber\":" + std::to_string(
getSvTNum()) +
", " \
142 "\"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)