請問下各位 有沒有碰到過USB hid通信問題 具體情形如下:在控制板上接入串口,串口工具可以看到發送資料正常 如:aa 0 0 1 0 0 0 0 0 0 0 0 fe6f8e55 一組完整16byte陣列資料,但是為什么在Android端接受的時候 aa 0 0 1 0 0 0 0 0 0 0 0 00 00 00 00 變成了這樣 最后四位的crc32校驗碼變成了無效的00000000 ,有碰到過類似情形的嗎?請指點下,多謝。
接受的代碼如下:
if (con != null && con.getmDeviceConnection() != null && con.getEpIn() != null) {
byte[] buffer = new byte[16];
int ret = con.getmDeviceConnection().bulkTransfer(con.getEpIn(), buffer,
buffer.length, 3000);
String data = CHexCover.byte2HexStr(buffer, buffer.length);//轉化成string列印 這里我單獨列印了 buff[12-16]的byte值 也是00 00 00 00 不是這里轉化出的問題 實際比較計算還是直接拿buff[] 的下標進行運算取值
if (ret != -1) {
LoggerUtil.getInstance().writeMsg("ReceiveThread data:" + data )
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/86146.html
標籤:Java相關
上一篇:HR一般會問哪些淺的技術點
