Android-Bluetooth Low Energy - Mit ScanFilters
Ich arbeite aktuell an einer Android-app für die Bluetooth-Low-Energy-Scans. In Android 5.0 ist die option für die ScanFilters eingeführt wurde. Es funktioniert in der Regel, aber die Anzahl der Filter, scheint begrenzt zu sein (?)
Wenn ich mehr als 13 verschiedene Filter, ich finde keine BLE-Geräte mehr und ich bekomme Meldungen, dass die app beendet wurde, obwohl es im hintergrund läuft, ohne etwas zu finden. Bekomme ich keine Warnungen oder Fehlermeldungen. Wenn ich weniger Filter als die 13, alles funktioniert Prima. Auch die Adressen für die Filterung nicht das problem verursachen. Es kommt auf die maximale Anzahl, wie es scheint...
Den code:
Der scan läuft in einem eigenen Thread:
[...]
BluetoothLeScanner myScanner = myBluetoothAdapter.getBluetoothLeScanner();
ScanSettings settings = new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build();
//The list for the filters
filters = new ArrayList<>();
//mac adresses of ble devices
String[] filterlist = {
"D4:B4:C8:7E:D1:35",
"C8:86:3A:91:0C:0C",
"FD:49:FD:36:04:B4",
"E9:91:4A:42:AC:3B",
//... some 20 more addresses
};
//adding the mac adresses to the filters list
for (int i=0; i< filterlist.length ; i++) {
ScanFilter filter = new ScanFilter.Builder().setDeviceAddress(filterlist[i]).build();
filters.add(filter);
Log.v("Filter: "," "+ filters.get(i).getDeviceAddress());
}
[...]
while (scanning) {
final ScanCallback callback = new ScanCallback() {
@Override
public void onScanResult(int callbackType, ScanResult result) {
Log.v("Callback","in the callback");
}
@Override
public void onScanFailed(int errorCode) {
super.onScanFailed(errorCode);
Log.v("ScanTask", "Some error occurred");
});
[...]
//starting the scan with the filters
myScanner.startScan(filters, settings, callback);
//creating some delay and then end the scan
Thread.sleep(myScanTime);
myScanner.stopScan(callback);
[...]
}
Scheint es kein problem im code. Aber warum gibt es ein limit für die maximale Anzahl der Filter? Kann jemand schieben mich in die richtige Richtung, oder kennt einen workaround?
UPDATE:
das entfernen der app-filter in Logcat, es gibt mir eine Fehlermeldung, das könnte helfen. Dies ist die Logcat:
03-25 09:35:32.889 18166-19305/com.example.install.bluetooth_app V/Filter:﹕ EC:2F:08:1E:99:DC
03-25 09:35:32.889 18166-19305/com.example.install.bluetooth_app V/Filter:﹕ F0:5E:4A:36:D5:4F
03-25 09:35:32.889 18166-19305/com.example.install.bluetooth_app V/Filter:﹕ E1:24:88:12:B7:20
03-25 09:35:32.889 18166-19305/com.example.install.bluetooth_app V/Filter:﹕ D1:F7:F3:73:00:43
03-25 09:35:32.889 18166-19305/com.example.install.bluetooth_app V/Filter:﹕ D4:B6:92:2B:7C:EB
03-25 09:35:32.889 18166-19305/com.example.install.bluetooth_app V/Filter:﹕ DE:6D:4A:07:DB:36
03-25 09:35:32.889 18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:CD:19
03-25 09:35:32.889 18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C3:3B
03-25 09:35:32.889 18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C6:F2
03-25 09:35:32.889 18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C2:DF
03-25 09:35:32.889 18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C6:EA
03-25 09:35:32.889 18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C7:7C
03-25 09:35:32.889 18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C2:D1
03-25 09:35:32.889 18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C7:78
03-25 09:35:32.889 18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C7:74
03-25 09:35:32.889 18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C2:B8
03-25 09:35:32.889 18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:C3:3A
03-25 09:35:32.889 18166-19305/com.example.install.bluetooth_app V/Filter:﹕ 00:07:80:1F:CD:2F
03-25 09:35:33.899 18922-19072/? D/BtGatt.GattService﹕ registerClient() - UUID=9f64337e-6700-4c26-a1f1-64ddc5b874c1
03-25 09:35:33.909 18922-18940/? D/BtGatt.GattService﹕ onClientRegistered() - UUID=9f64337e-6700-4c26-a1f1-64ddc5b874c1, clientIf=6
03-25 09:35:33.919 18166-18180/com.example.install.bluetooth_app D/BluetoothLeScanner﹕ onClientRegistered() - status=0 clientIf=6
03-25 09:35:33.919 18922-18931/? D/BtGatt.GattService﹕ start scan with filters
03-25 09:35:33.929 18922-18944/? D/BtGatt.ScanManager﹕ handling starting scan
03-25 09:35:33.929 18922-18944/? D/BluetoothAdapterService﹕ getAdapterService() - returning com.android.bluetooth.btservice.AdapterService@90e686a
03-25 09:35:33.929 18166-19305/com.example.install.bluetooth_app V/ScanTask﹕ Scan is started
03-25 09:35:33.929 18166-19305/com.example.install.bluetooth_app V/ScanTask﹕ Filters: 18
03-25 09:35:33.929 18166-19305/com.example.install.bluetooth_app V/ScanTask﹕ ScanTime: 5000
03-25 09:35:33.929 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.939 18922-19015/? D/bt_upio﹕ proc btwrite assertion
03-25 09:35:33.949 18922-18940/? D/BtGatt.GattService﹕ onScanFilterEnableDisabled() - clientIf=6, status=0, action=1
03-25 09:35:33.949 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.949 18922-18944/? D/BtGatt.ScanManager﹕ allow scan with filters
03-25 09:35:33.949 18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 3 for clientIf= 6
03-25 09:35:33.949 18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:33.949 18922-18944/? D/BtGatt.ScanManager﹕ add address EC:2F:08:1E:99:DC
03-25 09:35:33.949 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.949 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.949 18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=47
03-25 09:35:33.949 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.949 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.949 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.949 18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=15
03-25 09:35:33.949 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.949 18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 4 for clientIf= 6
03-25 09:35:33.949 18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:33.949 18922-18944/? D/BtGatt.ScanManager﹕ add address F0:5E:4A:36:D5:4F
03-25 09:35:33.959 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.959 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.959 18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=46
03-25 09:35:33.959 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.959 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.959 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.959 18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=14
03-25 09:35:33.959 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.959 18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 5 for clientIf= 6
03-25 09:35:33.959 18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:33.959 18922-18944/? D/BtGatt.ScanManager﹕ add address E1:24:88:12:B7:20
03-25 09:35:33.959 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.959 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.959 18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=45
03-25 09:35:33.959 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.969 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.969 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.969 18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=13
03-25 09:35:33.969 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.969 18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 6 for clientIf= 6
03-25 09:35:33.969 18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:33.969 18922-18944/? D/BtGatt.ScanManager﹕ add address D1:F7:F3:73:00:43
03-25 09:35:33.969 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.969 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.969 18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=44
03-25 09:35:33.969 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.969 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.969 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.969 18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=12
03-25 09:35:33.969 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.979 18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 7 for clientIf= 6
03-25 09:35:33.979 18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:33.979 18922-18944/? D/BtGatt.ScanManager﹕ add address D4:B6:92:2B:7C:EB
03-25 09:35:33.979 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.979 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.979 18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=43
03-25 09:35:33.979 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.979 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.979 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.979 18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=11
03-25 09:35:33.979 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.979 18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 8 for clientIf= 6
03-25 09:35:33.979 18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:33.979 18922-18944/? D/BtGatt.ScanManager﹕ add address DE:6D:4A:07:DB:36
03-25 09:35:33.979 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.979 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.979 18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=42
03-25 09:35:33.979 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.989 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.989 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.989 18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=10
03-25 09:35:33.989 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.989 18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 9 for clientIf= 6
03-25 09:35:33.989 18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:33.989 18922-18944/? D/BtGatt.ScanManager﹕ add address 00:07:80:1F:CD:19
03-25 09:35:33.989 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.989 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.989 18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=41
03-25 09:35:33.989 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.989 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.989 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.989 18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=9
03-25 09:35:33.989 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.989 18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 10 for clientIf= 6
03-25 09:35:33.989 18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:33.989 18922-18944/? D/BtGatt.ScanManager﹕ add address 00:07:80:1F:C3:3B
03-25 09:35:33.989 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.989 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.999 18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=40
03-25 09:35:33.999 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.999 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.999 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:33.999 18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=8
03-25 09:35:33.999 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:33.999 18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 11 for clientIf= 6
03-25 09:35:33.999 18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:33.999 18922-18944/? D/BtGatt.ScanManager﹕ add address 00:07:80:1F:C6:F2
03-25 09:35:33.999 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:33.999 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.009 18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=39
03-25 09:35:34.009 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.009 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:34.009 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.009 18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=7
03-25 09:35:34.009 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.009 18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 12 for clientIf= 6
03-25 09:35:34.009 18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:34.009 18922-18944/? D/BtGatt.ScanManager﹕ add address 00:07:80:1F:C2:DF
03-25 09:35:34.009 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:34.009 1158-1158/? D/StatusBar.NetworkController﹕ onSignalStrengthsChanged signalStrength=SignalStrength: 12 99 -120 -160 -120 -1 -1 99 2147483647 2147483647 2147483647 -1 2147483647 0x4 gsm|lte level=4
03-25 09:35:34.009 1158-1158/? D/StatusBar.NetworkController﹕ updateTelephonySignalStrength: hasService=true ss=SignalStrength: 12 99 -120 -160 -120 -1 -1 99 2147483647 2147483647 2147483647 -1 2147483647 0x4 gsm|lte
03-25 09:35:34.009 1158-1158/? D/StatusBar.NetworkController﹕ updateTelephonySignalStrength: iconLevel=4
03-25 09:35:34.009 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.009 1158-1158/? D/StatusBar.NetworkController﹕ updateTelephonySignalStrength, No signal level. mPhoneSignalIconId = com.android.systemui:drawable/stat_sys_signal_4_auto_rotate mDataSignalIconId = com.android.systemui:drawable/stat_sys_signal_4_auto_rotate mQSPhoneSignalIconId = com.android.systemui:drawable/ic_qs_signal_4 mContentDescriptionPhoneSignal = Volle Signalstärke
03-25 09:35:34.009 1158-1158/? D/StatusBar.NetworkController﹕ refreshViews connected={ wifi } level=4 combinedSignalIconId=0x7f020495/com.android.systemui:drawable/stat_sys_wifi_signal_4 mobileLabel=3 AT wifiLabel="W_ISPACE01"xxxxXXXXxxxxXXXX emergencyOnly=false combinedLabel="W_ISPACE01"xxxxXXXXxxxxXXXX mAirplaneMode=false mDataActivity=0 mPhoneSignalIconId=0x7f020440/com.android.systemui:drawable/stat_sys_signal_4_auto_rotate mQSPhoneSignalIconId=0x7f020115/com.android.systemui:drawable/ic_qs_signal_4 mDataDirectionIconId=0x0/(null) mDataSignalIconId=0x7f020440/com.android.systemui:drawable/stat_sys_signal_4_auto_rotate mDataTypeIconId=0x7f0202c9/com.android.systemui:drawable/stat_sys_data_connected_h mQSDataTypeIconId=0x7f02011f/com.android.systemui:drawable/ic_qs_signal_h mNoSimIconId=0x0/(null) mWifiIconId=0x7f020495/com.android.systemui:drawable/stat_sys_wifi_signal_4 mQSWifiIconId=0x7f02012b/com.android.systemui:drawable/ic_qs_wifi_4 mWifiActivityIconId=0x7f020464/com.android.systemui:drawable/stat_sys_signal_in mBluetoothTetherIconId=0x1080907/android:drawable/stat_sys_tether_bluetooth
03-25 09:35:34.009 1158-1158/? D/StatusBar.NetworkController﹕ refreshSignalCluster - setNWBoosterIndicators(false)
03-25 09:35:34.009 1158-1158/? D/StatusBar.NetworkController﹕ applyOpen
03-25 09:35:34.009 18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=38
03-25 09:35:34.009 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.009 1158-1158/? D/StatusBar.NetworkController﹕ refreshSignalCluster - setNWBoosterIndicators(false)
03-25 09:35:34.009 1158-1158/? D/StatusBar.NetworkController﹕ applyOpen
03-25 09:35:34.009 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:34.009 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.009 1158-1158/? D/StatusBar.NetworkController﹕ refreshSignalCluster - setNWBoosterIndicators(false)
03-25 09:35:34.009 18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=6
03-25 09:35:34.009 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.009 18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 13 for clientIf= 6
03-25 09:35:34.009 18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:34.009 18922-18944/? D/BtGatt.ScanManager﹕ add address 00:07:80:1F:C6:EA
03-25 09:35:34.009 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:34.009 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.009 1158-1158/? D/StatusBar.NetworkController﹕ applyOpen
03-25 09:35:34.019 18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=37
03-25 09:35:34.019 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.019 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:34.019 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.019 1158-1158/? D/StatusBar.NetworkController﹕ refreshSignalCluster - setNWBoosterIndicators(false)
03-25 09:35:34.019 1158-1158/? D/StatusBar.NetworkController﹕ applyOpen
03-25 09:35:34.019 18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=5
03-25 09:35:34.019 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.019 18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 14 for clientIf= 6
03-25 09:35:34.019 18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:34.019 18922-18944/? D/BtGatt.ScanManager﹕ add address 00:07:80:1F:C7:7C
03-25 09:35:34.019 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:34.019 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.019 18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=36
03-25 09:35:34.019 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.019 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:34.019 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.019 18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=4
03-25 09:35:34.019 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.019 18922-18944/? D/BtGatt.ScanManager﹕ set filter index= 15 for clientIf= 6
03-25 09:35:34.019 18922-18944/? D/BtGatt.ScanManager﹕ addFilterToController: 0
03-25 09:35:34.019 18922-18944/? D/BtGatt.ScanManager﹕ add address 00:07:80:1F:C2:D1
03-25 09:35:34.019 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:34.019 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.029 18922-18940/? D/BtGatt.GattService﹕ onScanFilterConfig() - clientIf=6, action = 0 status = 0, filterType=0, availableSpace=35
03-25 09:35:34.029 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.029 18922-19015/? D/bt_vendor﹕ op for 7
03-25 09:35:34.029 18922-19015/? D/bt_upio﹕ BT_WAKE is asserted already
03-25 09:35:34.029 18922-18940/? D/BtGatt.GattService﹕ onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=3
03-25 09:35:34.029 18922-18940/? D/BtGatt.ScanManager﹕ callback done for clientIf - 6 status - 0
03-25 09:35:34.029 18922-18944/? E/AndroidRuntime﹕ FATAL EXCEPTION: BluetoothScanManager
Process: com.android.bluetooth, PID: 18922
java.util.NoSuchElementException
at java.util.ArrayDeque.removeFirst(ArrayDeque.java:248)
at java.util.ArrayDeque.pop(ArrayDeque.java:483)
at com.android.bluetooth.gatt.ScanManager$ScanNative.configureScanFilters(ScanManager.java:738)
at com.android.bluetooth.gatt.ScanManager$ScanNative.startRegularScan(ScanManager.java:529)
at com.android.bluetooth.gatt.ScanManager$ClientHandler.handleStartScan(ScanManager.java:212)
at com.android.bluetooth.gatt.ScanManager$ClientHandler.handleMessage(ScanManager.java:179)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.os.HandlerThread.run(HandlerThread.java:61)
Sieht es aus wie es ist eine variable für den verfügbaren Raum für die Filter, die immer auf 15 festgelegt, unabhängig, wie viele Filter Hinzugefügt werden(?)
onScanFilterParamsConfigured() - clientIf=6, status=0, action=0, availableSpace=15
Reduziert wird, indem man für jeden filter Hinzugefügt und, wenn es fällt unter 3, der NoSuchElementException ausgelöst.
Du musst angemeldet sein, um einen Kommentar abzugeben.
Das Problem ist offensichtlich ein bug in Android 5.0.
Mit einer neueren version von Android (getestet mit 5.0.2) der Fehler behoben wurde und das problem nicht mehr auftreten.
Dank nicht weniger.
if (filterMap.contains(result.getAddress)){ ... do something }
Dies ist ein Kommentar/Vorschlag, nicht eine Antwort, wegen zu langer post hinzufügen es hier.
Chris, ich sehe nicht ein überprüfen Sie in der Bluetooth-Implementierung, die eine Einschränkung von 13-Filter,
Folgen Sie den nachstehenden Vorschlag >
1) Warum code unten
2) Fügen Sie Ihre scanResult Rückruf außerhalb als anonyme Klasse.
3) drucken scan-Ergebnis in der on-ScanResult Rückruf.
4) drucken Ausfall Grund in onScanFailed Rückruf.
5) fügen Sie logcat(komplett) nicht, den Sie gefiltert haben für Ihre app.
6) warum diese
verwenden Sie new-Handler.postDelayed(new Runnable{void run(){}},scanTime); statt.
7) Machen scanTime größeren Wert wie 1 minute,mehr Filter Sie verwenden, wird mehr Zeit, um einen Rückruf für scan-Ergebnis.
Kommentar zu erwähnen, die mich auf diese Antwort, ich werde comeback und follow-up.