Revision 483f5a4f
Added by Neels Hofmeyr about 4 years ago
sim-applet/src/org/osmocom/IMSIPseudo/MobileIdentity.java | ||
---|---|---|
52 | 52 |
return rc; |
53 | 53 |
} |
54 | 54 |
|
55 |
public static byte mi2str(byte dst[], byte dst_ofs, byte dst_len, |
|
56 |
byte mi[], boolean allow_hex) |
|
55 |
public static byte[] mi2str(byte mi[]) |
|
57 | 56 |
{ |
58 | 57 |
/* The IMSI byte array by example: |
59 | 58 |
* 08 99 10 07 00 00 10 74 90 |
... | ... | |
92 | 91 |
boolean odd_nr_of_digits = ((mi_type & 0x08) != 0); |
93 | 92 |
byte start_nibble = 2 + 1; // 2 to skip the bytelen, 1 to skip the mi_type |
94 | 93 |
byte end_nibble = (byte)(2 + bytelen * 2 - (odd_nr_of_digits ? 0 : 1)); |
95 |
bcd2str(dst, dst_ofs, dst_len, mi, start_nibble, end_nibble, allow_hex); |
|
96 |
return (byte)(end_nibble - start_nibble); |
|
94 |
byte str[] = new byte[end_nibble - start_nibble]; |
|
95 |
bcd2str(str, (byte)0, (byte)str.length, mi, start_nibble, end_nibble, true); |
|
96 |
return str; |
|
97 | 97 |
} |
98 | 98 |
|
99 | 99 |
public static byte char2bcd(byte c) |
Also available in: Unified diff
refactor the menu, the mi2str() implementation, and tests
Instead of a sub-menu for changing the IMSI, just offer a dialog with the
current IMSI pre-filled in an edit field.
"Show IMSI" becomes just "Change IMSI" without changing anything.
Change mi2str() so that it simply returns a byte[] of the right size.
Test new mi2str()