我使用的官方驱动从 http://www.ftdichip.com/Android.htm
03-20 13:37:52.359:WARN / FTDI(4453):读取启动
03-20 13:37:52.359: WARN/FTDI(4453): read starting
03-20 13:37:52.359:WARN / FTDI(4453):6个字节可用
03-20 13:37:52.359: WARN/FTDI(4453): 6 bytes available
03-20 13:37:57.960:WARN / FTDI(4453):0字节读
03-20 13:37:57.960:WARN/FTDI(4453): 0 bytes read
03-20 13:37:57.960:WARN / FTDI(4453):阅读完
03-20 13:37:57.960: WARN/FTDI(4453): read finished
该人士$ C $ C这是微不足道的:
The source code for this is trivial:
public int read(byte[] buffer, int timeout) throws IOException {
Log.w(TAG, "read starting");
try {
Log.w(TAG, device.getQueueStatus() + " bytes available");
int read = device.read(buffer);
Log.w(TAG, read + " bytes read");
return read;
} finally {
Log.w(TAG, "read finished");
}
}
他们的支持部门甚至一个星期后没有回复我。我在Android 4.0.4,用的Arduino Duemilanove FTDI基板。
Their support department did not reply to me, even after a week. I'm on Android 4.0.4, with a Arduino Duemilanove ftdi-based board.
是的,我做到了。
您的有无按照此顺序读取输入的数据:
You have to follow this in order to read incoming data:
在打开后调用restartInTask() 获得可用的输入字节读取之前 在只读如果可用的字节计数> 0工作code片断:
public int read(byte[] buffer, int timeout) throws IOException {
params.setReadTimeout(timeout);
Log.w(TAG, "read starting");
try {
int available = device.getQueueStatus();
Log.w(TAG, available + " bytes available");
if (available <= 0)
return 0;
int read = device.read(buffer, available, timeout);
Log.w(TAG, read + " bytes read");
return read;
} finally {
Log.w(TAG, "read finished");
}
}