Project

General

Profile

« Previous | Next » 

Revision c24fdd1a

Added by Neels Hofmeyr about 4 years ago

readIMSI, writeIMSI

View differences:

sim-applet/src/org/osmocom/IMSIPseudo/IMSIPseudo.java
285 285

  
286 286
	private void showIMSI() {
287 287
		/* 3GPP TS 31.102 4.2.2: IMSI */
288
		byte[] IMSI = new byte[9];
289 288
		byte[] msg = {'C', 'u', 'r', 'r', 'e', 'n', 't', ' ', 'I', 'M', 'S', 'I', ':', ' ',
290 289
			      ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '};
291 290

  
292
		gsmFile.select((short) SIMView.FID_DF_GSM);
293
		gsmFile.select((short) SIMView.FID_EF_IMSI);
294

  
295 291
		try {
296
			gsmFile.readBinary((short)0, IMSI, (short)0, (short)9);
292
			byte IMSI[] = readIMSI();
293
			mi2str(msg, (byte)14, (byte)16, IMSI, false);
294
			showMsgAndWaitKey(msg);
297 295
		} catch (SIMViewException e) {
298 296
			showError(e.getReason());
299
			return;
300 297
		}
301

  
302
		mi2str(msg, (byte)14, (byte)16, IMSI, false);
303

  
304
		showMsgAndWaitKey(msg);
305 298
	}
306 299

  
307 300
	private void handleMenuResponseMain() {
......
343 336
		byte mi[] = str2mi(imsi, MI_IMSI);
344 337
		showMsgAndWaitKey(hexdump(mi));
345 338
	}
339

  
340
	private byte[] readIMSI()
341
	{
342
		gsmFile.select((short) SIMView.FID_DF_GSM);
343
		gsmFile.select((short) SIMView.FID_EF_IMSI);
344
		byte[] IMSI = new byte[9];
345
		gsmFile.readBinary((short)0, IMSI, (short)0, (short)9);
346
		return IMSI;
347
	}
348

  
349
	private void writeIMSI(byte mi[])
350
	{
351
		gsmFile.select((short) SIMView.FID_DF_GSM);
352
		gsmFile.select((short) SIMView.FID_EF_IMSI);
353
		gsmFile.updateBinary((short)0, mi, (short)0, (short)mi.length);
354
	}
346 355
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 48.8 MB)