Audiovox P965 Scheda Tecnica Pagina 105

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 280
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 104
API in Java
102
WriteCommand setCommand(String command) {
this.command = command.trim();
return this;
}
String getCommand() {
return command;
}
private byte[] writeLen(String command) {
Integer i = null;
String s = "";
String ret = "";
if (command.length() < 0x80) {
i = command.length();
} else if (command.length() < 0x4000) {
i = Integer.reverseBytes(command.length() | 0x8000);
} else if (command.length() < 0x20000) {
i = Integer.reverseBytes(command.length() | 0xC00000);
} else if (command.length() < 10000000) {
i = Integer.reverseBytes(command.length() | 0xE0000000);
} else {
i = Integer.reverseBytes(command.length());
}
s = Integer.toHexString(i);
if (s.length() < 2) {
return new byte[]{i.byteValue()};
} else {
for (int j = 0; j < s.length(); j += 2) {
ret += (char) Integer.parseInt(s.substring(j, j + 2), 16) != 0 ? (char) Integer.parseInt(s.substring(j, j + 2), 16) : "";
}
}
char[] ch = ret.toCharArray();
return ret.getBytes();
}
String runCommand() {
try {
byte[] ret = new byte[0];
if (!command.contains("\n")) {
int i = 0;
byte[] b = writeLen(command);
int retLen = b.length + command.length() + 1;
ret = new byte[retLen];
for (i = 0; i < b.length; i++) {
ret[i] = b[i];
}
Vedere la pagina 104
1 2 ... 100 101 102 103 104 105 106 107 108 109 110 ... 279 280

Commenti su questo manuale

Nessun commento