我遇到的问题是蓝牙连接在接收消息时会超时。 我自己并没有建立蓝牙连接,这是通过我正在使用的API中的方法来完成的
logcat说:09-20 10:44:31.270: W/bt-btif(883): dm_pm_timer expires
09-20 10:44:31.270: W/bt-btif(883): dm_pm_timer expires 0
09-20 10:44:31.290: W/bt-btif(883): proc dm_pm_timer expires
09-20 10:44:31.310: E/bt-btif(883): bta_dm_pm_btm_status hci_status=36
我读了一些其他主题,但找不到我的问题的解决方案
此外还有我接收线程的一些代码:
class RxThread extends Thread {
Handler myHandler = new Handler();
final Runnable r = new Runnable() {
public void run() {
demoRxMsg = new MessageStructure();
int progress = 0;
generateLogFileOnSD(logData, logText);
while (rxChannel.receiveMessage(demoRxMsg) == ReturnCode.SUCCESS) {
String data = "";
String format = "";
rxChannel.receiveMessage(demoRxMsg);
if (demoRxMsg.frameFormat == API_ADK.STANDARD_FRAME) {
format = "SFF";
} else {
format = "EFF";
}
for (byte i = 0; i < demoRxMsg.dataLength; i++) {
data = data + Integer.toHexString(demoRxMsg.data[i])
+ " ";
}
@SuppressWarnings("rawtypes")
Map keyMap = ResourceUtils.getHashMapResource(DiagnosisActivity.this, R.xml.hashmap1);
@SuppressWarnings("rawtypes")
Iterator iter = keyMap.entrySet().iterator();
while(iter.hasNext()) {
@SuppressWarnings("rawtypes")
Map.Entry mEntry = (Map.Entry) iter.next();
if (data.contains(mEntry.getKey().toString())) {
progress = Integer.parseInt(mEntry.getValue().toString());
}
}
newLogText = format + "; ID=0x"
+ Integer.toHexString(demoRxMsg.messageID)
+ " Data=" + data + "\n";
logText = logText + newLogText;
writeLogFileOnSD(logData, logText);
}
}
if (progress != -1) {
final int newProgress = progress;
myHandler.post(new Runnable() {
public void run() {
mProgressBar.setProgress(newProgress);
}
});
}
}
};
public void run() {
while (true) {
try {
Thread.sleep(60);
myHandler.post(r);
} catch (InterruptedException e) {
break;
}
}
}
答案 0 :(得分:1)
刚遇到同样的问题,关闭然后重新启动蓝牙调试为我做了诀窍