FTDI D2XX的Andr​​oid的Java不读 [英] FTDI D2xx android java not reading

查看:661
本文介绍了FTDI D2XX的Andr​​oid的Java不读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前移植一些code我有个C#与Java在Android系统上运行

I am currently porting some code I have form C# to Java to run in on an Android system.

在我的code,我必须从董事会,有一个FTDI芯片中读取一些数据。我试图从FTDI网站上使用的Java驱动程序。

In my code, I have to read some data from a board that has a FTDI chip. I am trying to use the java drivers from the FTDI website.

我可以连接到该设备并发送正确命令,它(LED指示灯闪烁,因为他们应该)。董事会似乎是正确的送我的数据。

I can connect to the device and send commands to it correctly (LEDs blink as they should). The board appears to be sending me data correctly.

方bytesAvailable = ftDevice.getQueueStatus(); 返回预期的数量

INT读取动作= ftDevice.read(RXDATA,方bytesAvailable); 返回相同的数字

但是在调用阅读()如上面我看到我的logcat如下: 无法从源中读取数据! 从标签: readBulkInData ::

However on calling the read() as above I see the following in my logcat: Cannot read data from Source!! from tag: readBulkInData::

我看不到有什么,这可能是。我试着用该设备在我的code设置摆弄,但无济于事。

I cannot see what this might be. I tried fiddling with the settings of the device in my code, but to no avail.

推荐答案

我解决了这一点。

通过把指令的整个序列的读操作( getQueueStatus()阅读())的另一个。具体来说,我用了一个的AsyncTask ,并把它 doInBackground()方法读取指令。

By placing the whole sequence of instructions for reading (the getQueueStatus() and the read()) in another Thread. Specifically, I used an AsyncTask, and put the reading instructions in its doInBackground() method.

这篇关于FTDI D2XX的Andr​​oid的Java不读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆