Typically, in the ICC file handler in the Android telephony framework, we have to handle the GET RESPONSE data as below:
1. Check the response data 1st byte:
if (data[0] == 0x62) {
// we should use the parsing based on the UICC card TLV format, as 0x62 is FCP tag for UICC card
UsimResponseDataParsing(data);
} else {
// we should use the parsing based on ICC card response data format, which already done by Android
SimResponseDataParsing(data);
}
in UsimResponseDataParsing(data) {
1. Read TLV data of tag 0x80 (File size tag) (Refer 11.1.1.4.1 of ETSI TS 102 221)
Byte 1 - TLV Tag
Byte 2 - TLV length
Byte 3+ will be File size
From you eg: for tag 80 its 02 00 1C
File size = 1C
2. Read TLV data of tag 0x82 (File descriptor tag) (Refer 11.1.1.4.3 of ETSI TS 102 221)
Byte 1 - TLV Tag
Byte 2 - TLV length
Byte 3 - File decriptor byte
Byte 4 - Data coding byte (should be 0x21)
Byte 5,6 - Record length
Byte 7 - Number of records
From you eg: for tag 82 its 05 02 21 00 1C 01
Record size = 00 1C
Number of Records = 01
From this info, using the READ RECORD (178), record number 1 and data of 28 bytes is read using (AT+CRSM=178,28480,1,4,28)
}
READ RECORD response data format will be same for SIM and USIM, so the exisiting code should work there after.
BR,
Rajesh