fixed some minor bugs using ble on android
added BLE to the evaluation of the particle filter made first evaluation inside fhws
This commit is contained in:
@@ -29,6 +29,8 @@ public class BLE {
|
||||
/** called when a scan is completed successfully */
|
||||
public static native void onScanComplete(final byte[] result);
|
||||
|
||||
public static int dataCounter = 0;
|
||||
|
||||
/**
|
||||
* start bluetooth scanning in the background.
|
||||
* will call onScanComplete() once a scan is available
|
||||
@@ -52,7 +54,7 @@ public class BLE {
|
||||
final BluetoothManager mgr = (BluetoothManager) act.getSystemService(Context.BLUETOOTH_SERVICE);
|
||||
bt = mgr.getAdapter();
|
||||
|
||||
Log.d("ble", "BLE Mangaer Start");
|
||||
Log.d("ble", "BLE Manager Start");
|
||||
|
||||
// create the scanner
|
||||
scanner = bt.getBluetoothLeScanner();
|
||||
@@ -69,7 +71,12 @@ public class BLE {
|
||||
// and attach the callback
|
||||
mLeScanCallback = new ScanCallback() {
|
||||
@Override public void onScanResult(int callbackType, android.bluetooth.le.ScanResult result) {
|
||||
//Log.d("ble", result.getDevice() + " " + result.getRssi());
|
||||
|
||||
if(++dataCounter > 50){
|
||||
Log.d("ble", result.getDevice() + " " + result.getRssi());
|
||||
dataCounter = 0;
|
||||
}
|
||||
|
||||
|
||||
final byte[] rst = serialize(result);
|
||||
BLE.onScanComplete(rst);
|
||||
|
||||
@@ -122,7 +122,7 @@ public class WiFi {
|
||||
/** try to trigger one scan process */
|
||||
private static void triggerOneScan() {
|
||||
|
||||
//Log.d("wifi", "triggerOneScan()");
|
||||
Log.d("wifi", "triggerOneScan()");
|
||||
|
||||
try {
|
||||
if(!manager.startScan()) {throw new RuntimeException("Cant start WiFi!");}
|
||||
|
||||
Reference in New Issue
Block a user