[問題] 藍芽接值 掉值問題
使用手機藍芽接值,而接的值是由硬體端不斷丟值,
通常一秒丟一串字串 例如 123$456# or 455$123$
但是藍芽這邊接一次有時候會漏掉值 123456# 或 123$56,
但有時候又會正常接,是無法判斷硬體這邊丟一次的字串是甚麼,
請問該如何解決呢
case MESSAGE_READ:
byte[] readBuf = (byte[]) msg.obj;
// construct a string from the valid bytes in the buffer
String readMessage = null;
try {
readMessage = new String(readBuf, 0,msg.arg1,"GBK");
}
catch (UnsupportedEncodingException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
break;
// 以上就是藍芽抓值的code,麻煩各位了
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.58.82.128
→
01/31 11:06, , 1F
01/31 11:06, 1F
→
01/31 17:53, , 2F
01/31 17:53, 2F
→
01/31 17:54, , 3F
01/31 17:54, 3F
→
01/31 21:15, , 4F
01/31 21:15, 4F
→
01/31 21:15, , 5F
01/31 21:15, 5F
→
01/31 21:15, , 6F
01/31 21:15, 6F
→
01/31 21:16, , 7F
01/31 21:16, 7F
推
01/31 22:36, , 8F
01/31 22:36, 8F
→
01/31 22:36, , 9F
01/31 22:36, 9F
→
01/31 23:21, , 10F
01/31 23:21, 10F
討論串 (同標題文章)