Revision 2259cb9f
Added by osmith about 4 years ago
sim-applet/src/org/osmocom/IMSIPseudo/IMSIPseudo.java | ||
---|---|---|
9 | 9 |
// which has a limited number of write cycles. |
10 | 10 |
|
11 | 11 |
private byte STKServicesMenuId; |
12 |
private SIMView gsmFile; |
|
12 | 13 |
static byte[] LUCounter = new byte[] { '0', 'x', ' ', 'L', 'U' }; |
13 | 14 |
|
14 | 15 |
/* Main menu */ |
... | ... | |
27 | 28 |
private Object[] itemListChangeIMSI = {changeIMSI, setDigit1, setDigit2}; |
28 | 29 |
|
29 | 30 |
private IMSIPseudo() { |
31 |
gsmFile = SIMSystem.getTheSIMView(); |
|
32 |
|
|
30 | 33 |
/* Register menu and trigger on location updates */ |
31 | 34 |
ToolkitRegistry reg = ToolkitRegistry.getEntry(); |
32 | 35 |
STKServicesMenuId = reg.initMenuEntry(title, (short)0, (short)title.length, PRO_CMD_SELECT_ITEM, false, |
... | ... | |
88 | 91 |
return; |
89 | 92 |
} |
90 | 93 |
|
94 |
private void showIMSI() { |
|
95 |
/* 3GPP TS 31.102 4.2.2: IMSI */ |
|
96 |
byte[] IMSI = new byte[9]; |
|
97 |
byte[] msg = {'C', 'u', 'r', 'r', 'e', 'n', 't', ' ', 'I', 'M', 'S', 'I', ':', ' ', |
|
98 |
'_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_'}; |
|
99 |
|
|
100 |
gsmFile.select((short) SIMView.FID_DF_GSM); |
|
101 |
gsmFile.select((short) SIMView.FID_EF_IMSI); |
|
102 |
gsmFile.readBinary((short)0, IMSI, (short)0, (short)9); |
|
103 |
|
|
104 |
for (byte i = (byte)0; i < (byte)15; i++) { |
|
105 |
byte msg_i = (byte)(14 + i); |
|
106 |
if (i >= IMSI[0]) { |
|
107 |
msg[msg_i] = ' '; |
|
108 |
} else if (i % (byte)2 == (byte)0) { |
|
109 |
msg[msg_i] = (byte)('0' + (IMSI[i / (byte)2] & 0x0f)); |
|
110 |
} else { |
|
111 |
msg[msg_i] = (byte)('0' + (IMSI[i / (byte)2] >>> 4)); |
|
112 |
} |
|
113 |
} |
|
114 |
showMsg(msg); |
|
115 |
} |
|
116 |
|
|
91 | 117 |
private void handleMenuResponseMain() { |
92 | 118 |
ProactiveResponseHandler rspHdlr = ProactiveResponseHandler.getTheHandler(); |
93 | 119 |
|
... | ... | |
96 | 122 |
showMsg(LUCounter); |
97 | 123 |
break; |
98 | 124 |
case 2: /* Show IMSI */ |
99 |
/* TODO */
|
|
125 |
showIMSI();
|
|
100 | 126 |
break; |
101 | 127 |
case 3: /* Change IMSI */ |
102 | 128 |
showMenu(itemListChangeIMSI, (byte)3); |
Also available in: Unified diff
IMSIPseudo: implement "Show IMSI" (WIP)
This will need some adjustments before it actually works.