void simTest_SimAccess
(
le_sim_Id_t simId
)
{
uint8_t selectDfAdfApdu[] = {0x00, 0xA4, 0x00, 0x0C, 0x02, 0x7F, 0xFF};
uint8_t selectApdu[] = {0x00, 0xA4, 0x00, 0x0C, 0x02, 0x6F, 0x07};
uint8_t readApdu[] = {0x00, 0xB0, 0x00, 0x00, 0x09};
uint8_t rspImsi[SIM_RSP_LEN];
size_t rspImsiLen = SIM_RSP_LEN;
selectDfAdfApdu,
sizeof(selectDfAdfApdu),
rspImsi,
&rspImsiLen));
PrintApdu(rspImsi, rspImsiLen);
rspImsiLen = SIM_RSP_LEN;
selectApdu,
sizeof(selectApdu),
rspImsi,
&rspImsiLen));
PrintApdu(rspImsi, rspImsiLen);
rspImsiLen = SIM_RSP_LEN;
readApdu,
sizeof(readApdu),
rspImsi,
&rspImsiLen));
PrintApdu(rspImsi, rspImsiLen);
size_t rspImsiLen2 = SIM_RSP_LEN;
uint8_t rspImsi2[SIM_RSP_LEN];
uint8_t swi1, swi2;
char dfGsmPath[]="3F007FFF";
LE_SIM_READ_BINARY,
"6F07",
0,
0,
0,
NULL,
0,
dfGsmPath,
&swi1,
&swi2,
rspImsi2,
&rspImsiLen2);
{
LE_WARN(
"le_sim_SendCommand() API not supported by the platform");
return;
}
{
strcpy(dfGsmPath, "3F007F20");
LE_SIM_READ_BINARY,
"6F07",
0,
0,
0,
NULL,
0,
dfGsmPath,
&swi1,
&swi2,
rspImsi2,
&rspImsiLen2);
}
LE_INFO(
"swi1=0x%02X, swi2=0x%02X", swi1, swi2);
PrintApdu(rspImsi2, rspImsiLen2);
LE_ASSERT(0 == memcmp(rspImsi, rspImsi2, rspImsiLen2));
size_t rspLen = SIM_RSP_LEN;
uint8_t rsp[rspLen];
uint8_t dataAdn[] = {0x4A, 0x61, 0x63, 0x6B, 0x79, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x05, 0x81, 0x10, 0x92, 0x90, 0x71,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF};
LE_SIM_UPDATE_RECORD,
"6F3A",
5,
0,
0,
dataAdn,
sizeof(dataAdn),
"3F007F10",
&swi1,
&swi2,
rsp,
&rspLen));
LE_INFO(
"swi1=0x%02X, swi2=0x%02X", swi1, swi2);
rspLen = SIM_RSP_LEN;
LE_SIM_READ_RECORD,
"6F3A",
5,
0,
0,
NULL,
0,
"3F007F10",
&swi1,
&swi2,
rsp,
&rspLen));
LE_INFO(
"swi1=0x%02X, swi2=0x%02X", swi1, swi2);
PrintApdu(rsp, rspLen);
LE_ASSERT(0 == memcmp(rsp, dataAdn, rspLen));
size_t rspLenLi = SIM_RSP_LEN;
uint8_t rspLi[rspLenLi];
LE_SIM_READ_BINARY,
"6F05",
0,
0,
0,
NULL,
0,
dfGsmPath,
&swi1,
&swi2,
rspLi,
&rspLenLi));
LE_INFO(
"swi1=0x%02X, swi2=0x%02X", swi1, swi2);
PrintApdu(rspLi, rspLenLi);
uint8_t dataLi[] = {0xFF, 0xFF};
rspLen = 0;
LE_SIM_UPDATE_BINARY,
"6F05",
0,
0,
0,
dataLi,
sizeof(dataLi),
dfGsmPath,
&swi1,
&swi2,
rsp,
&rspLen));
LE_INFO(
"swi1=0x%02X, swi2=0x%02X", swi1, swi2);
rspLen = SIM_RSP_LEN;
LE_SIM_READ_BINARY,
"6F05",
0,
0,
0,
NULL,
0,
dfGsmPath,
&swi1,
&swi2,
rsp,
&rspLen));
LE_INFO(
"swi1=0x%02X, swi2=0x%02X", swi1, swi2);
PrintApdu(rsp, rspLen);
LE_ASSERT(0 == memcmp(rsp, dataLi,
sizeof(dataLi)));
rspLen = 0;
LE_SIM_UPDATE_BINARY,
"6F05",
0,
0,
0,
rspLi,
rspLenLi,
dfGsmPath,
&swi1,
&swi2,
rsp,
&rspLen));
LE_INFO(
"swi1=0x%02X, swi2=0x%02X", swi1, swi2);
rspLen = SIM_RSP_LEN;
LE_SIM_READ_BINARY,
"6F05",
0,
0,
0,
NULL,
0,
dfGsmPath,
&swi1,
&swi2,
rsp,
&rspLen));
LE_INFO(
"swi1=0x%02X, swi2=0x%02X", swi1, swi2);
PrintApdu(rsp, rspLen);
LE_ASSERT(0 == memcmp(rsp, rspLi,
sizeof(rspLenLi)));
uint8_t channel = 0;
selectDfAdfApdu[0] = channel;
channel,
selectDfAdfApdu,
sizeof(selectDfAdfApdu),
rspImsi,
&rspImsiLen));
PrintApdu(rspImsi, rspImsiLen);
rspImsiLen = SIM_RSP_LEN;
selectApdu[0] = channel;
channel,
selectApdu,
sizeof(selectApdu),
rspImsi,
&rspImsiLen));
PrintApdu(rspImsi, rspImsiLen);
rspImsiLen = SIM_RSP_LEN;
readApdu[0] = channel;
channel,
readApdu,
sizeof(readApdu),
rspImsi,
&rspImsiLen));
PrintApdu(rspImsi, rspImsiLen);
}