1
0
mirror of synced 2024-11-27 17:11:01 +01:00

结构体改为可变长度数组;读取felica block失败时,返回空数据。

This commit is contained in:
Sucareto 2022-04-23 15:57:53 +08:00
parent 9d4ddf8d9e
commit 118f2a8178

8
cmd.h
View File

@ -72,7 +72,7 @@ typedef union packet_req {
uint8_t blockList[1][2];//长度可变 uint8_t blockList[1][2];//长度可变
uint8_t blockData[16];//WriteWithoutEncryption,ignore uint8_t blockData[16];//WriteWithoutEncryption,ignore
}; };
uint8_t felica_payload[113]; uint8_t felica_payload[1];
}; };
}; };
}; };
@ -118,7 +118,7 @@ typedef union packet_res {
uint8_t numBlock;//NDA_06 uint8_t numBlock;//NDA_06
uint8_t blockData[1][1][16];//NDA_06 uint8_t blockData[1][1][16];//NDA_06
}; };
uint8_t felica_payload[112]; uint8_t felica_payload[1];
}; };
}; };
}; };
@ -295,9 +295,7 @@ static void sg_nfc_cmd_felica_encap() {
for (uint8_t i = 0; i < req.numBlock; i++) { for (uint8_t i = 0; i < req.numBlock; i++) {
uint16_t blockList[1] = {(uint16_t)(req.blockList[i][0] << 8 | req.blockList[i][1])}; uint16_t blockList[1] = {(uint16_t)(req.blockList[i][0] << 8 | req.blockList[i][1])};
if (nfc.felica_ReadWithoutEncryption(1, serviceCodeList, 1, blockList, res.blockData[i]) != 1) { if (nfc.felica_ReadWithoutEncryption(1, serviceCodeList, 1, blockList, res.blockData[i]) != 1) {
sg_res_init(); memset(res.blockData[i], 0, 16);//dummy data
res.status = 1;
return;
} }
} }
res.RW_status[0] = 0; res.RW_status[0] = 0;