1 package net.sf.atmodem4j.core.gsm;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 public class Entry7BitEncoding {
32
33 public static final Entry7BitEncoding[] table = new Entry7BitEncoding[]{
34 new Entry7BitEncoding(0x00, '@'),
35 new Entry7BitEncoding(0x01, '£'),
36 new Entry7BitEncoding(0x02, '$'),
37 new Entry7BitEncoding(0x03, '¥'),
38 new Entry7BitEncoding(0x04, 'è'),
39 new Entry7BitEncoding(0x05, 'é'),
40 new Entry7BitEncoding(0x06, 'ù'),
41 new Entry7BitEncoding(0x07, 'ì'),
42 new Entry7BitEncoding(0x08, 'ò'),
43 new Entry7BitEncoding(0x09, 'Ç'),
44 new Entry7BitEncoding(0x0A, '\n'),
45 new Entry7BitEncoding(0x0B, 'Ø'),
46 new Entry7BitEncoding(0x0C, 'ø'),
47 new Entry7BitEncoding(0x0D, '\r'),
48 new Entry7BitEncoding(0x0E, 'Å'),
49 new Entry7BitEncoding(0x0F, 'å'),
50 new Entry7BitEncoding(0x10, 'Δ'),
51 new Entry7BitEncoding(0x11, '_'),
52 new Entry7BitEncoding(0x12, 'Φ'),
53 new Entry7BitEncoding(0x13, 'Γ'),
54 new Entry7BitEncoding(0x14, 'Λ'),
55 new Entry7BitEncoding(0x15, 'Ω'),
56 new Entry7BitEncoding(0x16, 'Π'),
57 new Entry7BitEncoding(0x17, 'Ψ'),
58 new Entry7BitEncoding(0x18, 'Σ'),
59 new Entry7BitEncoding(0x19, 'Θ'),
60 new Entry7BitEncoding(0x1A, 'Ξ'),
61 new Entry7BitEncoding(0x1B0A, '\f'),
62 new Entry7BitEncoding(0x1B14, '^'),
63 new Entry7BitEncoding(0x1B28, '{'),
64 new Entry7BitEncoding(0x1B29, '}'),
65 new Entry7BitEncoding(0x1B2F, '\\'),
66 new Entry7BitEncoding(0x1B3C, '['),
67 new Entry7BitEncoding(0x1B3D, '~'),
68 new Entry7BitEncoding(0x1B3E, ']'),
69 new Entry7BitEncoding(0x1B40, '|'),
70 new Entry7BitEncoding(0x1B65, '€'),
71 new Entry7BitEncoding(0x1C, 'Æ'),
72 new Entry7BitEncoding(0x1D, 'æ'),
73 new Entry7BitEncoding(0x1E, 'ß'),
74 new Entry7BitEncoding(0x1F, 'É'),
75 new Entry7BitEncoding(0x20, ' '),
76 new Entry7BitEncoding(0x21, '!'),
77 new Entry7BitEncoding(0x22, '"'),
78 new Entry7BitEncoding(0x23, '#'),
79 new Entry7BitEncoding(0x24, '¤'),
80 new Entry7BitEncoding(0x25, '%'),
81 new Entry7BitEncoding(0x26, '&'),
82 new Entry7BitEncoding(0x27, '\''),
83 new Entry7BitEncoding(0x28, '('),
84 new Entry7BitEncoding(0x29, ')'),
85 new Entry7BitEncoding(0x2A, '*'),
86 new Entry7BitEncoding(0x2B, '+'),
87 new Entry7BitEncoding(0x2C, ','),
88 new Entry7BitEncoding(0x2D, '-'),
89 new Entry7BitEncoding(0x2E, '.'),
90 new Entry7BitEncoding(0x2F, '/'),
91 new Entry7BitEncoding(0x30, '0'),
92 new Entry7BitEncoding(0x31, '1'),
93 new Entry7BitEncoding(0x32, '2'),
94 new Entry7BitEncoding(0x33, '3'),
95 new Entry7BitEncoding(0x34, '4'),
96 new Entry7BitEncoding(0x35, '5'),
97 new Entry7BitEncoding(0x36, '6'),
98 new Entry7BitEncoding(0x37, '7'),
99 new Entry7BitEncoding(0x38, '8'),
100 new Entry7BitEncoding(0x39, '9'),
101 new Entry7BitEncoding(0x3A, ':'),
102 new Entry7BitEncoding(0x3B, ';'),
103 new Entry7BitEncoding(0x3C, '<'),
104 new Entry7BitEncoding(0x3D, '='),
105 new Entry7BitEncoding(0x3E, '>'),
106 new Entry7BitEncoding(0x3F, '?'),
107 new Entry7BitEncoding(0x40, '¡'),
108 new Entry7BitEncoding(0x41, 'A'),
109 new Entry7BitEncoding(0x42, 'B'),
110 new Entry7BitEncoding(0x43, 'C'),
111 new Entry7BitEncoding(0x44, 'D'),
112 new Entry7BitEncoding(0x45, 'E'),
113 new Entry7BitEncoding(0x46, 'F'),
114 new Entry7BitEncoding(0x47, 'G'),
115 new Entry7BitEncoding(0x48, 'H'),
116 new Entry7BitEncoding(0x49, 'I'),
117 new Entry7BitEncoding(0x4A, 'J'),
118 new Entry7BitEncoding(0x4B, 'K'),
119 new Entry7BitEncoding(0x4C, 'L'),
120 new Entry7BitEncoding(0x4D, 'M'),
121 new Entry7BitEncoding(0x4E, 'N'),
122 new Entry7BitEncoding(0x4F, 'O'),
123 new Entry7BitEncoding(0x50, 'P'),
124 new Entry7BitEncoding(0x51, 'Q'),
125 new Entry7BitEncoding(0x52, 'R'),
126 new Entry7BitEncoding(0x53, 'S'),
127 new Entry7BitEncoding(0x54, 'T'),
128 new Entry7BitEncoding(0x55, 'U'),
129 new Entry7BitEncoding(0x56, 'V'),
130 new Entry7BitEncoding(0x57, 'W'),
131 new Entry7BitEncoding(0x58, 'X'),
132 new Entry7BitEncoding(0x59, 'Y'),
133 new Entry7BitEncoding(0x5A, 'Z'),
134 new Entry7BitEncoding(0x5B, 'Ä'),
135 new Entry7BitEncoding(0x5C, 'Ö'),
136 new Entry7BitEncoding(0x5D, 'Ñ'),
137 new Entry7BitEncoding(0x5E, 'Ü'),
138 new Entry7BitEncoding(0x5F, '§'),
139 new Entry7BitEncoding(0x60, '¿'),
140 new Entry7BitEncoding(0x61, 'a'),
141 new Entry7BitEncoding(0x62, 'b'),
142 new Entry7BitEncoding(0x63, 'c'),
143 new Entry7BitEncoding(0x64, 'd'),
144 new Entry7BitEncoding(0x65, 'e'),
145 new Entry7BitEncoding(0x66, 'f'),
146 new Entry7BitEncoding(0x67, 'g'),
147 new Entry7BitEncoding(0x68, 'h'),
148 new Entry7BitEncoding(0x69, 'i'),
149 new Entry7BitEncoding(0x6A, 'j'),
150 new Entry7BitEncoding(0x6B, 'k'),
151 new Entry7BitEncoding(0x6C, 'l'),
152 new Entry7BitEncoding(0x6D, 'm'),
153 new Entry7BitEncoding(0x6E, 'n'),
154 new Entry7BitEncoding(0x6F, 'o'),
155 new Entry7BitEncoding(0x70, 'p'),
156 new Entry7BitEncoding(0x71, 'q'),
157 new Entry7BitEncoding(0x72, 'r'),
158 new Entry7BitEncoding(0x73, 's'),
159 new Entry7BitEncoding(0x74, 't'),
160 new Entry7BitEncoding(0x75, 'u'),
161 new Entry7BitEncoding(0x76, 'v'),
162 new Entry7BitEncoding(0x77, 'w'),
163 new Entry7BitEncoding(0x78, 'x'),
164 new Entry7BitEncoding(0x79, 'y'),
165 new Entry7BitEncoding(0x7A, 'z'),
166 new Entry7BitEncoding(0x7B, 'ä'),
167 new Entry7BitEncoding(0x7C, 'ö'),
168 new Entry7BitEncoding(0x7D, 'ñ'),
169 new Entry7BitEncoding(0x7E, 'ü'),
170 new Entry7BitEncoding(0x7F, 'à'),
171 };
172
173 static final byte ESC_IN_PDU_OCTET = 0x1B;
174 static final short ESC_SHORT = 0x1B00;
175 final short pdu;
176 final char c;
177
178 Entry7BitEncoding(final int pdu, final char c) {
179 super();
180 this.pdu = (short) pdu;
181 this.c = c;
182 }
183
184 public boolean isEscaped() {
185 return (pdu & 65280) != 0;
186 }
187
188 public static Entry7BitEncoding findByChar(char c) {
189 for (Entry7BitEncoding e : table) {
190 if (e.c == c) {
191 return e;
192 }
193 }
194 return null;
195 }
196
197 public static Entry7BitEncoding findByPdu(int pdu) {
198 for (Entry7BitEncoding e : table) {
199 if (e.pdu == pdu) {
200 return e;
201 }
202 }
203 return null;
204 }
205
206 }