Mercurial > 510Connectbot
comparison app/src/main/java/org/tn5250j/framework/tn5250/tnvt.java @ 445:8fa8e73e2f5c
update to tn5250j version 0.7.7, svn r1270
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 04 Jan 2016 15:52:25 -0800 |
parents | d29cce60f393 |
children | 5ce5235adde6 |
comparison
equal
deleted
inserted
replaced
444:5a74f1b7c1db | 445:8fa8e73e2f5c |
---|---|
298 Log.w(TAG, "setCursorOff " + excc.getMessage()); | 298 Log.w(TAG, "setCursorOff " + excc.getMessage()); |
299 } | 299 } |
300 | 300 |
301 producer = new DataStreamProducer(this, bin, dsq, abyte0); | 301 producer = new DataStreamProducer(this, bin, dsq, abyte0); |
302 pthread = new Thread(producer); | 302 pthread = new Thread(producer); |
303 // pthread.setPriority(pthread.MIN_PRIORITY); | |
304 pthread.setPriority(Thread.NORM_PRIORITY); | 303 pthread.setPriority(Thread.NORM_PRIORITY); |
305 // pthread.setPriority(Thread.NORM_PRIORITY / 2); | |
306 pthread.start(); | 304 pthread.start(); |
307 | 305 |
308 try { | 306 try { |
309 screen52.getOIA().setInputInhibited(ScreenOIA.INPUTINHIBITED_NOTINHIBITED, | 307 screen52.getOIA().setInputInhibited(ScreenOIA.INPUTINHIBITED_NOTINHIBITED, |
310 ScreenOIA.OIA_LEVEL_INPUT_INHIBITED); | 308 ScreenOIA.OIA_LEVEL_INPUT_INHIBITED); |
574 // Client sends header 000D12A0000004000003####F3FFEF | 572 // Client sends header 000D12A0000004000003####F3FFEF |
575 // operation code 3 | 573 // operation code 3 |
576 // row - first ## | 574 // row - first ## |
577 // column - second ## | 575 // column - second ## |
578 // F3 - Help Aid Key | 576 // F3 - Help Aid Key |
579 // System.out.println("Help request sent"); | |
580 baosp.write(screen52.getCurrentRow()); | 577 baosp.write(screen52.getCurrentRow()); |
581 baosp.write(screen52.getCurrentCol()); | 578 baosp.write(screen52.getCurrentCol()); |
582 baosp.write(AID_HELP); | 579 baosp.write(AID_HELP); |
583 | 580 |
584 try { | 581 try { |
607 // bit 1 - ATN Attention | 604 // bit 1 - ATN Attention |
608 // bits 2-4 - reserved | 605 // bits 2-4 - reserved |
609 // bit 5 - SRQ system request | 606 // bit 5 - SRQ system request |
610 // bit 6 - TRQ Test request key | 607 // bit 6 - TRQ Test request key |
611 // bit 7 - HLP | 608 // bit 7 - HLP |
612 | |
613 // System.out.println("Attention key sent"); | |
614 try { | 609 try { |
615 Log.i(TAG, "sendAttentionKey() writeGDS()"); | 610 Log.i(TAG, "sendAttentionKey() writeGDS()"); |
616 writeGDS(0x40, 0, null); | 611 writeGDS(0x40, 0, null); |
617 } | 612 } |
618 catch (IOException ioe) { | 613 catch (IOException ioe) { |
829 int str = 11; | 824 int str = 11; |
830 char c; | 825 char c; |
831 ScreenPlanes planes = screen52.getPlanes(); | 826 ScreenPlanes planes = screen52.getPlanes(); |
832 c = planes.getChar(str); | 827 c = planes.getChar(str); |
833 boolean waitFor = !(c == 'a'); | 828 boolean waitFor = !(c == 'a'); |
834 StringBuffer command = new StringBuffer(); | 829 StringBuilder command = new StringBuilder(); |
835 | 830 |
836 for (int i = str + 1; i < 132; i++) { | 831 for (int i = str + 1; i < 132; i++) { |
837 c = planes.getChar(i); | 832 c = planes.getChar(i); |
838 | 833 |
839 if (Character.isISOControl(c)) | 834 if (Character.isISOControl(c)) |
875 * Activate or deactivate the command scanning behaviour. | 870 * Activate or deactivate the command scanning behaviour. |
876 * | 871 * |
877 * @param scan | 872 * @param scan |
878 * if true, scanning is enabled; disabled otherwise. | 873 * if true, scanning is enabled; disabled otherwise. |
879 * | 874 * |
880 * @see scan4Cmd() | 875 * @see #scan() |
881 */ | 876 */ |
882 public void setScanningEnabled(boolean scan) { | 877 public void setScanningEnabled(boolean scan) { |
883 this.scan = scan; | 878 this.scan = scan; |
884 } | 879 } |
885 | 880 |
897 /** | 892 /** |
898 * When command scanning is activated, the terminal reads the first and | 893 * When command scanning is activated, the terminal reads the first and |
899 * second character in the datastream (the zero position allows to | 894 * second character in the datastream (the zero position allows to |
900 * devisualize the scan stream). If the sequence <code>#!</code> is | 895 * devisualize the scan stream). If the sequence <code>#!</code> is |
901 * encountered and if this sequence is <strong>not </strong> followed by a | 896 * encountered and if this sequence is <strong>not </strong> followed by a |
902 * blank character, the {@link parseCommand(ScreenChar[])}is called. | 897 * blank character, the {@link parseCommand()}is called. |
903 */ | 898 */ |
904 private void scan() { | 899 private void scan() { |
905 // System.out.println("Checking command : " + | |
906 // screen52.screen[1].getChar() + screen52.screen[2].getChar()); | 900 // screen52.screen[1].getChar() + screen52.screen[2].getChar()); |
907 // ScreenChar[] screen = screen52.screen; | 901 // ScreenChar[] screen = screen52.screen; |
908 ScreenPlanes planes = screen52.getPlanes(); | 902 ScreenPlanes planes = screen52.getPlanes(); |
909 | 903 |
910 if ((planes.getChar(STRSCAN) == '#') | 904 if ((planes.getChar(STRSCAN) == '#') |
1078 } | 1072 } |
1079 else { | 1073 else { |
1080 strpccmd(); | 1074 strpccmd(); |
1081 } | 1075 } |
1082 } | 1076 } |
1083 catch (Exception exd) { | 1077 catch (RuntimeException e) { |
1084 Log.w(TAG, " tnvt.run: " + exd.getMessage()); | 1078 Log.w(TAG, " tnvt.run: " + e.getMessage()); |
1085 exd.printStackTrace(); | 1079 exd.printStackTrace(); |
1086 } | 1080 } |
1087 | 1081 |
1088 if (pendingUnlock && !screen52.isStatusErrorCode()) { | 1082 if (pendingUnlock && !screen52.isStatusErrorCode()) { |
1089 screen52.getOIA().setKeyBoardLocked(false); | 1083 screen52.getOIA().setKeyBoardLocked(false); |
1107 | 1101 |
1108 | 1102 |
1109 private final void readScreen() throws IOException { | 1103 private final void readScreen() throws IOException { |
1110 int rows = screen52.getRows(); | 1104 int rows = screen52.getRows(); |
1111 int cols = screen52.getColumns(); | 1105 int cols = screen52.getColumns(); |
1112 byte abyte0[] = new byte[rows * cols]; | 1106 byte screenArray[] = new byte[rows * cols]; |
1113 fillScreenArray(abyte0, rows, cols); | 1107 fillScreenArray(screenArray, rows, cols); |
1114 Log.i(TAG, "readScreen() writeGDS()"); | 1108 Log.i(TAG, "readScreen() writeGDS()"); |
1115 writeGDS(0, 0, abyte0); | 1109 writeGDS(0, 0, screenArray); |
1116 abyte0 = null; | 1110 } |
1117 } | 1111 |
1118 | 1112 private final void fillScreenArray(byte[] sa) { |
1119 private final void fillScreenArray(byte[] sa, int rows, int cols) { | |
1120 int la = 32; | |
1121 int sac = 0; | |
1122 int len = rows * cols; | |
1123 ScreenPlanes planes = screen52.planes; | 1113 ScreenPlanes planes = screen52.planes; |
1124 | 1114 |
1125 try { | 1115 try { |
1126 for (int y = 0; y < len; y++) { // save the screen data | 1116 for (int i = 0; i < sa.length; i++) { // save the screen data |
1127 if (planes.isAttributePlace(y)) { | 1117 if (planes.isAttributePlace(i)) { |
1128 la = planes.getCharAttr(y); | 1118 sa[i] = (byte) planes.getCharAttr(i); |
1129 sa[sac++] = (byte) la; | |
1130 } | 1119 } |
1131 else { | 1120 else { |
1132 // The characters on screen are in unicode | 1121 // The characters on screen are in unicode |
1133 char ch = planes.getChar(y); | 1122 char ch = planes.getChar(i); |
1134 byte byteCh; | 1123 byte byteCh; |
1135 if (isDataUnicode(ch)) byteCh = codePage.uni2ebcdic(ch); | 1124 if (isDataUnicode(ch)) byteCh = codePage.uni2ebcdic(ch); |
1136 else byteCh = (byte) ch; | 1125 else byteCh = (byte) ch; |
1137 sa[sac++] = byteCh; | 1126 sa[i] = byteCh; |
1138 } | 1127 } |
1139 } | 1128 } |
1140 } | 1129 } |
1141 catch (Exception exc) { | 1130 catch (Exception exc) { |
1142 Log.i(TAG, exc.getMessage()); | 1131 Log.i(TAG, exc.getMessage()); |
1143 exc.printStackTrace(); | 1132 exc.printStackTrace(); |
1144 } | 1133 } |
1145 } | 1134 } |
1146 | 1135 |
1147 private final void fillRegenerationBuffer(ByteArrayOutputStream sc, int rows, int cols) | 1136 private byte[] createRegenerationBuffer(int len) throws IOException { |
1148 throws IOException { | |
1149 int la = 32; | 1137 int la = 32; |
1150 int sac = 0; | 1138 int sac = 0; |
1151 int len = rows * cols; | |
1152 ScreenPlanes planes = screen52.planes; | 1139 ScreenPlanes planes = screen52.planes; |
1153 byte[] sa = new byte[len]; | 1140 byte[] sa = new byte[len]; |
1154 | 1141 |
1155 try { | 1142 try { |
1156 boolean guiExists = sfParser != null && sfParser.isGuisExists(); | 1143 boolean guiExists = sfParser != null && sfParser.isGuisExists(); |
1157 | 1144 |
1158 for (int y = 0; y < len; y++) { // save the screen data | 1145 for (int i = 0; i < len; i++) { // save the screen data |
1159 if (guiExists) { | 1146 if (guiExists) { |
1160 byte[] guiSeg = sfParser.getSegmentAtPos(y); | 1147 byte[] guiSeg = sfParser.getSegmentAtPos(i); |
1161 | 1148 |
1162 if (guiSeg != null) { | 1149 if (guiSeg != null) { |
1163 //Log.i(TAG," gui saved at " + y + " - " + screen52.getRow(y) + "," + | 1150 //Log.i(TAG," gui saved at " + y + " - " + screen52.getRow(y) + "," + |
1164 // screen52.getCol(y)); | 1151 // screen52.getCol(y)); |
1165 byte[] gsa = new byte[sa.length + guiSeg.length + 2]; | 1152 byte[] gsa = new byte[sa.length + guiSeg.length + 2]; |
1168 sa = new byte[gsa.length]; | 1155 sa = new byte[gsa.length]; |
1169 System.arraycopy(gsa, 0, sa, 0, gsa.length); | 1156 System.arraycopy(gsa, 0, sa, 0, gsa.length); |
1170 sa[sac++] = (byte)0x04; | 1157 sa[sac++] = (byte)0x04; |
1171 sa[sac++] = (byte)0x11; | 1158 sa[sac++] = (byte)0x11; |
1172 sac += guiSeg.length; | 1159 sac += guiSeg.length; |
1173 //y--; | |
1174 // continue; | |
1175 } | 1160 } |
1176 } | 1161 } |
1177 | 1162 |
1178 if (planes.isAttributePlace(y)) { | 1163 if (planes.isAttributePlace(i)) { |
1179 la = planes.getCharAttr(y); | 1164 la = planes.getCharAttr(i); |
1180 sa[sac++] = (byte) la; | 1165 sa[sac++] = (byte) la; |
1181 } | 1166 } |
1182 else { | 1167 else { |
1183 // The characters on screen are in unicode | 1168 // The characters on screen are in unicode |
1184 char ch = planes.getChar(y); | 1169 char ch = planes.getChar(i); |
1185 byte byteCh; | 1170 byte byteCh; |
1186 if (isDataUnicode(ch)) byteCh = codePage.uni2ebcdic(ch); | 1171 if (isDataUnicode(ch)) byteCh = codePage.uni2ebcdic(ch); |
1187 else byteCh = (byte) ch; | 1172 else byteCh = (byte) ch; |
1188 sa[sac++] = byteCh; | 1173 sa[sac++] = byteCh; |
1189 } | 1174 } |
1191 } | 1176 } |
1192 catch (Exception exc) { | 1177 catch (Exception exc) { |
1193 Log.i(TAG, exc.getMessage()); | 1178 Log.i(TAG, exc.getMessage()); |
1194 exc.printStackTrace(); | 1179 exc.printStackTrace(); |
1195 } | 1180 } |
1196 | 1181 return sa; |
1197 sc.write(sa); | |
1198 } | 1182 } |
1199 | 1183 |
1200 public final void saveScreen() throws IOException { | 1184 public final void saveScreen() throws IOException { |
1201 ByteArrayOutputStream sc = new ByteArrayOutputStream(); | 1185 ByteArrayOutputStream sc = new ByteArrayOutputStream(); |
1202 sc.write(4); | 1186 sc.write(new byte[] {4, 0x12, 0, 0}); |
1203 sc.write(0x12); // 18 | 1187 sc.write((byte) screen52.getRows()); // store the current size |
1204 sc.write(0); // 18 | 1188 sc.write((byte) screen52.getColumns()); // "" |
1205 sc.write(0); // 18 | |
1206 sc.write((byte) screen52.getRows()); // store the current size | |
1207 sc.write((byte) screen52.getColumns()); // "" | |
1208 int cp = screen52.getCurrentPos(); // save off current position | 1189 int cp = screen52.getCurrentPos(); // save off current position |
1209 // fix below submitted by Mitch Blevins | 1190 sc.write((byte)(cp >> 8 & 0xff)); // "" |
1210 //int cp = screen52.getScreenFields().getCurrentFieldPos(); | 1191 sc.write((byte)(cp & 0xff)); // "" |
1211 // save off current position | |
1212 sc.write((byte)(cp >> 8 & 0xff)); // "" | |
1213 sc.write((byte)(cp & 0xff)); // "" | |
1214 sc.write((byte)(screen52.homePos >> 8 & 0xff)); // save home pos | 1192 sc.write((byte)(screen52.homePos >> 8 & 0xff)); // save home pos |
1215 sc.write((byte)(screen52.homePos & 0xff)); // "" | 1193 sc.write((byte)(screen52.homePos & 0xff)); // "" |
1216 int rows = screen52.getRows(); // store the current size | 1194 sc.write(createRegenerationBuffer(screen52.getRows() * screen52.getColumns())); |
1217 int cols = screen52.getColumns(); // "" | |
1218 // byte[] sa = new byte[rows * cols]; | |
1219 fillRegenerationBuffer(sc, rows, cols); | |
1220 // fillScreenArray(sa, rows, cols); | |
1221 // | |
1222 // sc.write(sa); | |
1223 // sa = null; | |
1224 int sizeFields = screen52.getScreenFields().getSize(); | 1195 int sizeFields = screen52.getScreenFields().getSize(); |
1225 sc.write((byte)(sizeFields >> 8 & 0xff)); // "" | 1196 sc.write((byte)(sizeFields >> 8 & 0xff)); // save number of fields |
1226 sc.write((byte)(sizeFields & 0xff)); // "" | 1197 sc.write((byte)(sizeFields & 0xff)); // "" |
1227 | 1198 |
1228 if (sizeFields > 0) { | 1199 if (sizeFields > 0) { |
1229 int x = 0; | 1200 int x = 0; |
1230 int s = screen52.getScreenFields().getSize(); | 1201 int s = screen52.getScreenFields().getSize(); |
1231 ScreenField sf = null; | |
1232 | 1202 |
1233 while (x < s) { | 1203 while (x < s) { |
1234 sf = screen52.getScreenFields().getField(x); | 1204 ScreenField sf = screen52.getScreenFields().getField(x); |
1235 sc.write((byte) sf.getAttr()); // attribute | 1205 sc.write((byte) sf.getAttr()); // attribute |
1236 int sp = sf.startPos(); | 1206 int sp = sf.startPos(); |
1237 sc.write((byte)(sp >> 8 & 0xff)); // "" | 1207 sc.write((byte)(sp >> 8 & 0xff)); // position |
1238 sc.write((byte)(sp & 0xff)); // "" | 1208 sc.write((byte)(sp & 0xff)); // "" |
1239 | 1209 |
1240 if (sf.mdt) | 1210 if (sf.mdt) |
1241 sc.write((byte) 1); | 1211 sc.write((byte) 1); |
1242 else | 1212 else |
1243 sc.write((byte) 0); | 1213 sc.write((byte) 0); |
1244 | 1214 |
1245 sc.write((byte)(sf.getLength() >> 8 & 0xff)); // "" | 1215 sc.write((byte)(sf.getLength() >> 8 & 0xff)); |
1246 sc.write((byte)(sf.getLength() & 0xff)); // "" | 1216 sc.write((byte)(sf.getLength() & 0xff)); |
1247 sc.write((byte) sf.getFFW1() & 0xff); | 1217 sc.write((byte) sf.getFFW1() & 0xff); |
1248 sc.write((byte) sf.getFFW2() & 0xff); | 1218 sc.write((byte) sf.getFFW2() & 0xff); |
1249 sc.write((byte) sf.getFCW1() & 0xff); | 1219 sc.write((byte) sf.getFCW1() & 0xff); |
1250 sc.write((byte) sf.getFCW2() & 0xff); | 1220 sc.write((byte) sf.getFCW2() & 0xff); |
1251 Log.d(TAG, "Saved "); | 1221 Log.d(TAG, "Saved "); |
1252 Log.d(TAG, sf.toString()); | 1222 Log.d(TAG, sf.toString()); |
1253 x++; | 1223 x++; |
1254 } | 1224 } |
1255 | |
1256 sf = null; | |
1257 } | 1225 } |
1258 | 1226 |
1259 // The following two lines of code looks to have caused all sorts of | 1227 // The following two lines of code looks to have caused all sorts of |
1260 // problems so for now we have commented them out. | 1228 // problems so for now we have commented them out. |
1261 // screen52.getScreenFields().setCurrentField(null); // set it to null | 1229 // screen52.getScreenFields().setCurrentField(null); // set it to null |
1267 writeGDS(0, 3, sc.toByteArray()); | 1235 writeGDS(0, 3, sc.toByteArray()); |
1268 } | 1236 } |
1269 catch (IOException ioe) { | 1237 catch (IOException ioe) { |
1270 Log.w(TAG, ioe.getMessage()); | 1238 Log.w(TAG, ioe.getMessage()); |
1271 } | 1239 } |
1272 | |
1273 sc = null; | |
1274 Log.d(TAG, "Save Screen end "); | 1240 Log.d(TAG, "Save Screen end "); |
1275 } | 1241 } |
1276 | 1242 |
1277 /** | 1243 /** |
1278 * | 1244 * |
1884 // no break: so every chars arrives | 1850 // no break: so every chars arrives |
1885 // on the screen for later parsing | 1851 // on the screen for later parsing |
1886 //break; | 1852 //break; |
1887 | 1853 |
1888 default: // all others must be output to screen | 1854 default: // all others must be output to screen |
1889 //Log.d(TAG,"all others must be output to screen"); | |
1890 byte byte0 = bk.getByteOffset(-1); | 1855 byte byte0 = bk.getByteOffset(-1); |
1891 | 1856 |
1892 if (isAttribute(byte0)) { | 1857 if (isAttribute(byte0)) { |
1893 screen52.setAttr(byte0); | 1858 screen52.setAttr(byte0); |
1894 } | 1859 } |
1924 done = true; | 1889 done = true; |
1925 } | 1890 } |
1926 } | 1891 } |
1927 catch (Exception e) { | 1892 catch (Exception e) { |
1928 Log.w(TAG, "write to display " + e.getMessage()); | 1893 Log.w(TAG, "write to display " + e.getMessage()); |
1929 e.printStackTrace(); | |
1930 } | 1894 } |
1931 | 1895 |
1932 ; | 1896 ; |
1933 | 1897 |
1934 processCC1(control1); | 1898 processCC1(control1); |
2055 } | 2019 } |
2056 else | 2020 else |
2057 pendingUnlock = false; | 2021 pendingUnlock = false; |
2058 | 2022 |
2059 if (resetMDT || resetMDTAll || nullMDT || nullAll) { | 2023 if (resetMDT || resetMDTAll || nullMDT || nullAll) { |
2060 ScreenField sf; | |
2061 int f = screen52.getScreenFields().getSize(); | 2024 int f = screen52.getScreenFields().getSize(); |
2062 | 2025 |
2063 for (int x = 0; x < f; x++) { | 2026 for (int x = 0; x < f; x++) { |
2064 sf = screen52.getScreenFields().getField(x); | 2027 ScreenField sf = screen52.getScreenFields().getField(x); |
2065 | |
2066 if (!sf.isBypassField()) { | 2028 if (!sf.isBypassField()) { |
2067 if ((nullMDT && sf.mdt) || nullAll) { | 2029 if ((nullMDT && sf.mdt) || nullAll) { |
2068 sf.setFieldChar((char) 0x0); | 2030 sf.setFieldChar((char) 0x0); |
2069 screen52.drawField(sf); | 2031 screen52.drawField(sf); |
2070 } | 2032 } |
2071 } | 2033 } |
2072 | 2034 |
2073 if (resetMDTAll || (resetMDT && !sf.isBypassField())) | 2035 if (resetMDTAll || (resetMDT && !sf.isBypassField())) |
2074 sf.resetMDT(); | 2036 sf.resetMDT(); |
2075 } | 2037 } |
2076 | |
2077 sf = null; | |
2078 } | 2038 } |
2079 } | 2039 } |
2080 | 2040 |
2081 private void processCC1(byte byte1) { | 2041 private void processCC1(byte byte1) { |
2082 Log.d(TAG, " Control byte1 " + Integer.toBinaryString(byte1 & 0xff)); | 2042 Log.d(TAG, " Control byte1 " + Integer.toBinaryString(byte1 & 0xff)); |
2152 //LDC - 12/02/2003 - Test if the unicode character is a displayable | 2112 //LDC - 12/02/2003 - Test if the unicode character is a displayable |
2153 // character. | 2113 // character. |
2154 // The first 32 characters are non displayable characters | 2114 // The first 32 characters are non displayable characters |
2155 // This is normally the inverse of isDataEBCDIC (That's why there is a | 2115 // This is normally the inverse of isDataEBCDIC (That's why there is a |
2156 // check on 255 -> 0xFFFF | 2116 // check on 255 -> 0xFFFF |
2157 private boolean isDataUnicode(int byte0) { | 2117 private boolean isDataUnicode(int data) { |
2158 return (((byte0 < 0) || (byte0 >= 32)) && (byte0 != 0xFFFF)); | 2118 return (((data < 0) || (data >= 32)) && (data != 0xFFFF)); |
2159 } | 2119 } |
2160 | 2120 |
2161 private void writeStructuredField() { | 2121 private void writeStructuredField() { |
2162 boolean done = false; | 2122 boolean done = false; |
2163 | 2123 |
2377 writeByte(baosp.toByteArray()); | 2337 writeByte(baosp.toByteArray()); |
2378 baosp.reset(); | 2338 baosp.reset(); |
2379 break; | 2339 break; |
2380 | 2340 |
2381 case TIMING_MARK: // 6 rfc860 | 2341 case TIMING_MARK: // 6 rfc860 |
2382 // System.out.println("Timing Mark Received and notifying " + | 2342 Log.d(TAG, "Timing Mark Received and notifying the server that we will not do it."); |
2383 // "the server that we will not do it"); | |
2384 baosp.write(IAC); | 2343 baosp.write(IAC); |
2385 baosp.write(WONT); | 2344 baosp.write(WONT); |
2386 baosp.write(TIMING_MARK); | 2345 baosp.write(TIMING_MARK); |
2387 writeByte(baosp.toByteArray()); | 2346 writeByte(baosp.toByteArray()); |
2388 baosp.reset(); | 2347 baosp.reset(); |
2568 if (devSeq++ == -1) { | 2527 if (devSeq++ == -1) { |
2569 devNameUsed = devName; | 2528 devNameUsed = devName; |
2570 return devName; | 2529 return devName; |
2571 } | 2530 } |
2572 else { | 2531 else { |
2573 StringBuffer sb = new StringBuffer(devName + devSeq); | 2532 StringBuilder sb = new StringBuilder(devName + devSeq); |
2574 int ei = 1; | 2533 int ei = 1; |
2575 | 2534 |
2576 while (sb.length() > 10) { | 2535 while (sb.length() > 10) { |
2577 sb.setLength(0); | 2536 sb.setLength(0); |
2578 sb.append(devName.substring(0, devName.length() - ei++)); | 2537 sb.append(devName.substring(0, devName.length() - ei++)); |