View Javadoc
1   package net.sf.atmodem4j.core.gsm;
2   
3   /*
4    * #%L
5    * ATModem4J Core
6    * %%
7    * Copyright (C) 2009 - 2014 atmodem4j
8    * %%
9    * atmodem4j - Drivers for the AT modem - http://atmodem4j.sourceforge.net/
10   * Copyright (C) 2009-2014, atmodem4j.sf.net, and individual contributors as indicated
11   * by the @authors tag. See the copyright.txt in the distribution for a
12   * full listing of individual contributors.
13   * 
14   * This is free software; you can redistribute it and/or modify it
15   * under the terms of the GNU General Public License as
16   * published by the Free Software Foundation; either version 3 of
17   * the License, or (at your option) any later version.
18   * 
19   * This software is distributed in the hope that it will be useful,
20   * but WITHOUT ANY WARRANTY; without even the implied warranty of
21   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22   * Lesser General Public License for more details.
23   * 
24   * You should have received a copy of the GNU Lesser General Public
25   * License along with this software; if not, write to the Free
26   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
27   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
28   * #L%
29   */
30  
31  public class Entry7BitEncoding {
32  
33      public static final Entry7BitEncoding[] table = new Entry7BitEncoding[]{ // Character Name (ISO-8859-1 DEC)
34          new Entry7BitEncoding(0x00, '@'), // COMMERCIAL AT (64)
35          new Entry7BitEncoding(0x01, '£'), // POUND SIGN	(163)
36          new Entry7BitEncoding(0x02, '$'), // DOLLAR SIGN	(36)
37          new Entry7BitEncoding(0x03, '¥'), // YEN SIGN	(165)
38          new Entry7BitEncoding(0x04, 'è'), // LATIN SMALL LETTER E WITH GRAVE (232)
39          new Entry7BitEncoding(0x05, 'é'), // LATIN SMALL LETTER E WITH ACUTE	(233)
40          new Entry7BitEncoding(0x06, 'ù'), // LATIN SMALL LETTER U WITH GRAVE (249)
41          new Entry7BitEncoding(0x07, 'ì'), // LATIN SMALL LETTER I WITH GRAVE	(236)
42          new Entry7BitEncoding(0x08, 'ò'), // LATIN SMALL LETTER O WITH GRAVE	(242)
43          new Entry7BitEncoding(0x09, 'Ç'), // LATIN CAPITAL LETTER C WITH CEDILLA (199)
44          new Entry7BitEncoding(0x0A, '\n'), // LINE FEED (10)
45          new Entry7BitEncoding(0x0B, 'Ø'), // LATIN CAPITAL LETTER O WITH STROKE (216)
46          new Entry7BitEncoding(0x0C, 'ø'), // LATIN SMALL LETTER O WITH STROKE (248)
47          new Entry7BitEncoding(0x0D, '\r'), // CARRIAGE RETURN (13)
48          new Entry7BitEncoding(0x0E, 'Å'), // LATIN CAPITAL LETTER A WITH RING ABOVE (197)
49          new Entry7BitEncoding(0x0F, 'å'), // LATIN SMALL LETTER A WITH RING ABOVE (229)
50          new Entry7BitEncoding(0x10, 'Δ'), //	GREEK CAPITAL LETTER DELTA
51          new Entry7BitEncoding(0x11, '_'), // LOW LINE (95)
52          new Entry7BitEncoding(0x12, 'Φ'), // GREEK CAPITAL LETTER PHI
53          new Entry7BitEncoding(0x13, 'Γ'), // GREEK CAPITAL LETTER GAMMA
54          new Entry7BitEncoding(0x14, 'Λ'), // GREEK CAPITAL LETTER LAMBDA
55          new Entry7BitEncoding(0x15, 'Ω'), // GREEK CAPITAL LETTER OMEGA
56          new Entry7BitEncoding(0x16, 'Π'), // GREEK CAPITAL LETTER PI
57          new Entry7BitEncoding(0x17, 'Ψ'), // GREEK CAPITAL LETTER PSI
58          new Entry7BitEncoding(0x18, 'Σ'), // GREEK CAPITAL LETTER SIGMA
59          new Entry7BitEncoding(0x19, 'Θ'), // GREEK CAPITAL LETTER THETA
60          new Entry7BitEncoding(0x1A, 'Ξ'), // GREEK CAPITAL LETTER XI
61          new Entry7BitEncoding(0x1B0A, '\f'), // FORM FEED (12)
62          new Entry7BitEncoding(0x1B14, '^'), // CIRCUMFLEX ACCENT (94)
63          new Entry7BitEncoding(0x1B28, '{'), // LEFT CURLY BRACKET (123)
64          new Entry7BitEncoding(0x1B29, '}'), // RIGHT CURLY BRACKET	(125)
65          new Entry7BitEncoding(0x1B2F, '\\'), // REVERSE SOLIDUS (BACKSLASH) (92)
66          new Entry7BitEncoding(0x1B3C, '['), // LEFT SQUARE BRACKET (91)
67          new Entry7BitEncoding(0x1B3D, '~'), // TILDE (126)
68          new Entry7BitEncoding(0x1B3E, ']'), // RIGHT SQUARE BRACKET (93)
69          new Entry7BitEncoding(0x1B40, '|'), // VERTICAL BAR (124)
70          new Entry7BitEncoding(0x1B65, '€'), // EURO SIGN (164 (ISO-8859-15))
71          new Entry7BitEncoding(0x1C, 'Æ'), // LATIN CAPITAL LETTER AE	(198)
72          new Entry7BitEncoding(0x1D, 'æ'), // LATIN SMALL LETTER AE (230)
73          new Entry7BitEncoding(0x1E, 'ß'), // LATIN SMALL LETTER SHARP S (German) (223)
74          new Entry7BitEncoding(0x1F, 'É'), // LATIN CAPITAL LETTER E WITH ACUTE (201(
75          new Entry7BitEncoding(0x20, ' '), // SPACE	(32)
76          new Entry7BitEncoding(0x21, '!'), // EXCLAMATION MARK (33)
77          new Entry7BitEncoding(0x22, '"'), // QUOTATION MARK (34)
78          new Entry7BitEncoding(0x23, '#'), // NUMBER SIGN	(35)
79          new Entry7BitEncoding(0x24, '¤'), // CURRENCY SIGN (164 (ISO-8859-1))
80          new Entry7BitEncoding(0x25, '%'), // PERCENT SIGN (37)
81          new Entry7BitEncoding(0x26, '&'), // AMPERSAND (38)
82          new Entry7BitEncoding(0x27, '\''), // APOSTROPHE (39)
83          new Entry7BitEncoding(0x28, '('), // LEFT PARENTHESIS (40)
84          new Entry7BitEncoding(0x29, ')'), // RIGHT PARENTHESIS (41)
85          new Entry7BitEncoding(0x2A, '*'), // ASTERISK (42)
86          new Entry7BitEncoding(0x2B, '+'), // PLUS SIGN (43)
87          new Entry7BitEncoding(0x2C, ','), // COMMA (44)
88          new Entry7BitEncoding(0x2D, '-'), // HYPHEN-MINUS (45)
89          new Entry7BitEncoding(0x2E, '.'), // FULL STOP (46)
90          new Entry7BitEncoding(0x2F, '/'), // SOLIDUS (SLASH) (47)
91          new Entry7BitEncoding(0x30, '0'), // DIGIT ZERO (48)
92          new Entry7BitEncoding(0x31, '1'), // DIGIT ONE (49)
93          new Entry7BitEncoding(0x32, '2'), // DIGIT TWO (50)
94          new Entry7BitEncoding(0x33, '3'), // DIGIT THREE (51)
95          new Entry7BitEncoding(0x34, '4'), // DIGIT FOUR (52)
96          new Entry7BitEncoding(0x35, '5'), // DIGIT FIVE (53)
97          new Entry7BitEncoding(0x36, '6'), // DIGIT SIX (54)
98          new Entry7BitEncoding(0x37, '7'), // DIGIT SEVEN (55)
99          new Entry7BitEncoding(0x38, '8'), // DIGIT EIGHT (56)
100         new Entry7BitEncoding(0x39, '9'), // DIGIT NINE (57)
101         new Entry7BitEncoding(0x3A, ':'), // COLON (58)
102         new Entry7BitEncoding(0x3B, ';'), // SEMICOLON (59)
103         new Entry7BitEncoding(0x3C, '<'), // LESS-THAN SIGN (60)
104         new Entry7BitEncoding(0x3D, '='), // EQUALS SIGN (61)
105         new Entry7BitEncoding(0x3E, '>'), // GREATER-THAN SIGN (62)
106         new Entry7BitEncoding(0x3F, '?'), // QUESTION MARK (63)
107         new Entry7BitEncoding(0x40, '¡'), // INVERTED EXCLAMATION MARK (161)
108         new Entry7BitEncoding(0x41, 'A'), // LATIN CAPITAL LETTER A (65)
109         new Entry7BitEncoding(0x42, 'B'), // LATIN CAPITAL LETTER B (66)
110         new Entry7BitEncoding(0x43, 'C'), // LATIN CAPITAL LETTER C (67)
111         new Entry7BitEncoding(0x44, 'D'), // LATIN CAPITAL LETTER D (68)
112         new Entry7BitEncoding(0x45, 'E'), // LATIN CAPITAL LETTER E (69)
113         new Entry7BitEncoding(0x46, 'F'), // LATIN CAPITAL LETTER F (70)
114         new Entry7BitEncoding(0x47, 'G'), // LATIN CAPITAL LETTER G (71)
115         new Entry7BitEncoding(0x48, 'H'), // LATIN CAPITAL LETTER H (72)
116         new Entry7BitEncoding(0x49, 'I'), // LATIN CAPITAL LETTER I (73
117         new Entry7BitEncoding(0x4A, 'J'), // LATIN CAPITAL LETTER J (74
118         new Entry7BitEncoding(0x4B, 'K'), // LATIN CAPITAL LETTER K (75
119         new Entry7BitEncoding(0x4C, 'L'), // LATIN CAPITAL LETTER L (76
120         new Entry7BitEncoding(0x4D, 'M'), // LATIN CAPITAL LETTER M (77
121         new Entry7BitEncoding(0x4E, 'N'), // LATIN CAPITAL LETTER N (78
122         new Entry7BitEncoding(0x4F, 'O'), // LATIN CAPITAL LETTER O (79
123         new Entry7BitEncoding(0x50, 'P'), // LATIN CAPITAL LETTER P (80
124         new Entry7BitEncoding(0x51, 'Q'), // LATIN CAPITAL LETTER Q (81
125         new Entry7BitEncoding(0x52, 'R'), // LATIN CAPITAL LETTER R (82
126         new Entry7BitEncoding(0x53, 'S'), // LATIN CAPITAL LETTER S (83
127         new Entry7BitEncoding(0x54, 'T'), // LATIN CAPITAL LETTER T (84
128         new Entry7BitEncoding(0x55, 'U'), // LATIN CAPITAL LETTER U (85
129         new Entry7BitEncoding(0x56, 'V'), // LATIN CAPITAL LETTER V (86
130         new Entry7BitEncoding(0x57, 'W'), // LATIN CAPITAL LETTER W (87
131         new Entry7BitEncoding(0x58, 'X'), // LATIN CAPITAL LETTER X (88
132         new Entry7BitEncoding(0x59, 'Y'), // LATIN CAPITAL LETTER Y (89
133         new Entry7BitEncoding(0x5A, 'Z'), // LATIN CAPITAL LETTER Z (90
134         new Entry7BitEncoding(0x5B, 'Ä'), // LATIN CAPITAL LETTER A WITH DIAERESIS (	196
135         new Entry7BitEncoding(0x5C, 'Ö'), // LATIN CAPITAL LETTER O WITH DIAERESIS (214
136         new Entry7BitEncoding(0x5D, 'Ñ'), // LATIN CAPITAL LETTER N WITH TILDE (209
137         new Entry7BitEncoding(0x5E, 'Ü'), // LATIN CAPITAL LETTER U WITH DIAERESIS (220
138         new Entry7BitEncoding(0x5F, '§'), // SECTION SIGN (167
139         new Entry7BitEncoding(0x60, '¿'), // INVERTED QUESTION MARK (191
140         new Entry7BitEncoding(0x61, 'a'), // LATIN SMALL LETTER A (97
141         new Entry7BitEncoding(0x62, 'b'), // LATIN SMALL LETTER B (98
142         new Entry7BitEncoding(0x63, 'c'), // LATIN SMALL LETTER C (99
143         new Entry7BitEncoding(0x64, 'd'), // LATIN SMALL LETTER D (100
144         new Entry7BitEncoding(0x65, 'e'), // LATIN SMALL LETTER E (101
145         new Entry7BitEncoding(0x66, 'f'), // LATIN SMALL LETTER F (102
146         new Entry7BitEncoding(0x67, 'g'), // LATIN SMALL LETTER G (103
147         new Entry7BitEncoding(0x68, 'h'), // LATIN SMALL LETTER H (104
148         new Entry7BitEncoding(0x69, 'i'), // LATIN SMALL LETTER I (105
149         new Entry7BitEncoding(0x6A, 'j'), // LATIN SMALL LETTER J (106
150         new Entry7BitEncoding(0x6B, 'k'), // LATIN SMALL LETTER K (107
151         new Entry7BitEncoding(0x6C, 'l'), // LATIN SMALL LETTER L (108
152         new Entry7BitEncoding(0x6D, 'm'), // LATIN SMALL LETTER M (109
153         new Entry7BitEncoding(0x6E, 'n'), // LATIN SMALL LETTER N (110
154         new Entry7BitEncoding(0x6F, 'o'), // LATIN SMALL LETTER O (111
155         new Entry7BitEncoding(0x70, 'p'), // LATIN SMALL LETTER P (112
156         new Entry7BitEncoding(0x71, 'q'), // LATIN SMALL LETTER Q (113
157         new Entry7BitEncoding(0x72, 'r'), // LATIN SMALL LETTER R (114
158         new Entry7BitEncoding(0x73, 's'), // LATIN SMALL LETTER S (115
159         new Entry7BitEncoding(0x74, 't'), // LATIN SMALL LETTER T (116
160         new Entry7BitEncoding(0x75, 'u'), // LATIN SMALL LETTER U (117
161         new Entry7BitEncoding(0x76, 'v'), // LATIN SMALL LETTER V (118
162         new Entry7BitEncoding(0x77, 'w'), // LATIN SMALL LETTER W (119
163         new Entry7BitEncoding(0x78, 'x'), // LATIN SMALL LETTER X (120
164         new Entry7BitEncoding(0x79, 'y'), // LATIN SMALL LETTER Y (121
165         new Entry7BitEncoding(0x7A, 'z'), // LATIN SMALL LETTER Z (122
166         new Entry7BitEncoding(0x7B, 'ä'), // LATIN SMALL LETTER A WITH DIAERESIS (228
167         new Entry7BitEncoding(0x7C, 'ö'), // LATIN SMALL LETTER O WITH DIAERESIS (246
168         new Entry7BitEncoding(0x7D, 'ñ'), // LATIN SMALL LETTER N WITH TILDE (241
169         new Entry7BitEncoding(0x7E, 'ü'), // LATIN SMALL LETTER U WITH DIAERESIS (252
170         new Entry7BitEncoding(0x7F, 'à'), // LATIN SMALL LETTER A WITH GRAVE (224
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 }