如何手动将波特率57600设置为我的USB连接?我试着这样做:
if ($result->num_rows > 0) {
$return = array();
while($row = $result->fetch_assoc()) {
$return[] = array('customer' => $row["name"]);
}
echo json_encode($return);
} else {
echo "0 results";
}
但它没有用 - 收到的是UsbConnector connector = new UsbConnector(getApplicationContext(), device, listener);
if (device != null) {
connector.run();
UsbDeviceConnection usbDeviceConnection = usbManager.openDevice(device);
usbDeviceConnection.controlTransfer(0x40, 0, 0, 0, null, 0, 0);// reset
usbDeviceConnection.controlTransfer(0x40, 0, 1, 0, null, 0, 0);// clear Rx
usbDeviceConnection.controlTransfer(0x40, 0, 2, 0, null, 0, 0);// clear Tx
usbDeviceConnection.controlTransfer(0x40, 0x03, 0x0034, 0, null, 0, 0);//Baud rate 57600)
connector.send(pal);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
byte[] received = connector.receive(36);
if (received == null) {
Toast.makeText(getApplicationContext(), "Błąd inicjalizacji skanera", Toast.LENGTH_SHORT).show();
}
}
。有什么帮助吗?