handle Hardware Error

This commit is contained in:
matthias.ringwald@gmail.com 2014-06-26 20:13:50 +00:00
parent 7586ee3597
commit 03cf90bbd5

View File

@ -23,6 +23,7 @@ import com.bluekitchen.btstack.event.GATTNotification;
import com.bluekitchen.btstack.event.GATTQueryComplete;
import com.bluekitchen.btstack.event.GATTServiceQueryResult;
import com.bluekitchen.btstack.event.HCIEventDisconnectionComplete;
import com.bluekitchen.btstack.event.HCIEventHardwareError;
import com.bluekitchen.btstack.event.HCIEventLEConnectionComplete;
public class MainActivity extends Activity implements PacketHandler {
@ -326,6 +327,12 @@ public class MainActivity extends Activity implements PacketHandler {
return;
}
if (packet instanceof HCIEventHardwareError){
addMessage("Bluetooth module crashed, restarting app and waiting for working");
state = STATE.w4_btstack_working;
return;
}
if (packet instanceof HCIEventDisconnectionComplete){
if (state != STATE.w4_disconnect) {
state = STATE.w4_scan_result;
@ -353,10 +360,11 @@ public class MainActivity extends Activity implements PacketHandler {
BD_ADDR sensor_tag_addr = new BD_ADDR("1C:BA:8C:20:C7:F6");
BD_ADDR pts_dongle = new BD_ADDR("00:1B:DC:07:32:EF");
BD_ADDR asus_dongle = new BD_ADDR("5c:f3:70:60:7b:87");
GAPLEAdvertisingReport report = (GAPLEAdvertisingReport) packet;
BD_ADDR reportAddr = report.getAddress();
if (reportAddr.toString().equalsIgnoreCase(pts_dongle.toString())){
if (reportAddr.toString().equalsIgnoreCase(asus_dongle.toString())){
testAddrType = report.getAddressType();
testAddr = report.getAddress();
addMessage(String.format("Adv: type %d, addr %s", testAddrType, testAddr));