9-SIM数据交互之-F2(STATUS)

F2-STATUS

F2即读取所处文件的状态信息,F2只能对于MF/DF文件有效,对于EF文件是无效的,如果读EF文件,则返回的是其上一层DF的fcp。读取的内容该指令一般当设备拨上号后大概30秒左右就会有一次心跳数据,

F2指令比较固定:80 F2 P1 P2 XX(XX代表要读取的长度)

b8 b7 b6 b5 b4 b3 b2 b1 含义
0 0 0 0 0 0 0 0 无指示
0 0 0 0 0 0 0 1 当前的应用正在被初始化
0 0 0 0 0 0 1 0 终端将要终止当前应用
b8 b7 b6 b5 b4 b3 b2 b1 含义
0 0 0 0 0 0 0 0 与SELECT 命令相同
0 0 0 0 0 0 0 1 返回当前选择应用的DFNAME TLV
0 0 0 0 1 1 0 0 无数据返回

注意:F2只能对于MF/DF文件有效,对于EF文件是无效的,如果读EF文件,则返回的是其上一层DF的fcp

1.正常读取

指令格式:80 F2 00 00 XX

3F00

=>00 A4 00 04 02
<=A4
=>3F 00
<=61 2F
=>80 F2 00 00 2F 
<=F2 622D8202782183023F00A50780017183024DB48A01058B062F0601020002C60F90016095010083010183018183010A 90 00 

3F00->7F20

=>00 A4 00 04 02
<=A4
=>3F 00
<=61 2F
=>00 A4 00 04 02
<=A4
=>7f 20
<=61 1A
=>80 F2 00 00 1A 
<=F2 62188202782183027F208A01058B032F0602C606900100830101 90 00 

3F00->7F20->6F07

=>00 A4 00 04 02
<=A4
=>3F 00
<=61 2F
=>00 A4 00 04 02
<=A4
=>7f 20
<=61 1A
=>00 A4 00 04 02
<=A4
=>6F 07
<=61 19
=>80 F2 00 00 19 
<=F2 62188202782183027F208A01058B032F0602C6069001008301 61 01  //返回的其实还是,2F20的数据,所以直接用7F20的长度读取
=>80 F2 00 00 1A 
<=F2 62188202782183027F208A01058B032F0602C606900100830101 90 00

指令格式:80 F2 00 0C 00

3F00

=>00 A4 00 04 02
<=A4
=>3F 00
<=61 2F
=>80 F2 00 0C 00
<=90 00

指令格式:80 F2 01 01 XX

3F00

=>00 A4 00 04 02
<=A4
=>3F 00
<=61 2F
=>80 F2 01 01 12
<=F2 8410A0000000871002FF86FFFF89FFFFFFFF 90 00

AID,即2F00的B2记录中的一段
2F00 B2

=>00 A4 00 04 02
<=A4
=>3F 00
<=61 2F
=>00 A4 00 04 02
<=A4
=>2F 00
<=61 1C
=>00 b2 01 04 26
<=B2 61244F10A0000000871002FF86FFFF89FFFFFFFF5010434D43435744374D503176322E302020 90 00

2.读取少于原有记录长度

虽然F2读取的内容和C0读取的一样,都是fcp。但是不像C0的读取,没读取完需要接着读取剩余的字节数,而是你要读多少就给你多少,然后告诉你剩余多少就行了。

=>00 A4 00 04 02
<=A4
=>3F 00
=>80 F2 00 00 20 
<=F2 622D8202782183023F00A50780017183024DB48A01058B062F0601020002C60F 61 0F //还剩余0F的长度没有读取完成
=>80 F2 00 00 0F 
<=F2 622D8202782183023F00A507800171 61 20 //还剩余20的长度没有读取完成

3.读取多于/00原有数据

=>00 A4 00 04 02
<=A4
=>3F 00
=>80 F2 00 00 00 
<=6C 2F  //返回数据长度
=>80 F2 00 0C 00
<=6C 2F  //返回数据长度
=>80 F2 00 00 2F 
<=F2 622D8202782183023F00A50780017183024DB48A01058B062F0601020002C60F90016095010083010183018183010A 90 00 

你可能感兴趣的:(9-SIM数据交互之-F2(STATUS))