Skip to content

Commit

Permalink
Merge pull request #644 from AltBeacon/bluetooth-medic
Browse files Browse the repository at this point in the history
Add Bluetooth Medic
  • Loading branch information
davidgyoung authored Feb 23, 2018
2 parents 733c351 + 2557af8 commit 995c936
Show file tree
Hide file tree
Showing 6 changed files with 609 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### Development

Enhancements:
- Add BluetoothMedic to fix crashing bluetooth stacks. (#644, David G. Young)
- Allow configuring job ids (#645, David G. Young)

Bug Fixes:
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-rc2'
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3'
}
Expand Down
7 changes: 6 additions & 1 deletion src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@
/>

<service android:name=".service.ScanJob"
android:permission="android.permission.BIND_JOB_SERVICE" >
android:permission="android.permission.BIND_JOB_SERVICE">
<meta-data android:name="immmediateScanJobId" android:value="208352939" />
<meta-data android:name="periodicScanJobId" android:value="208352940" />
</service>

<service android:name="org.altbeacon.bluetooth.BluetoothTestJob"
android:permission="android.permission.BIND_JOB_SERVICE" >
<meta-data android:name="jobId" android:value="1799803768"/>
</service>

</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
import android.bluetooth.le.ScanResult;
import android.bluetooth.le.ScanSettings;
import android.content.Context;
import android.content.Intent;
import android.os.ParcelUuid;
import android.os.SystemClock;
import android.support.annotation.MainThread;
import android.support.annotation.WorkerThread;
import android.support.v4.content.LocalBroadcastManager;

import org.altbeacon.beacon.BeaconManager;
import org.altbeacon.beacon.logging.LogManager;
Expand All @@ -29,7 +31,7 @@ public class CycledLeScannerForLollipop extends CycledLeScanner {
private BluetoothLeScanner mScanner;
private ScanCallback leScanCallback;
private long mBackgroundLScanStartTime = 0l;
private long mBackgroundLScanFirstDetectionTime = 0l;
private long mBackgroundLScanFirstDetectionTime = 0;
private boolean mMainScanCycleActive = false;
private final BeaconManager mBeaconManager;

Expand Down Expand Up @@ -326,6 +328,9 @@ public void onBatchScanResults(List<ScanResult> results) {
@MainThread
@Override
public void onScanFailed(int errorCode) {
Intent intent = new Intent("onScanFailed");
intent.putExtra("errorCode", errorCode);
LocalBroadcastManager.getInstance(CycledLeScannerForLollipop.this.mContext).sendBroadcast(intent);
switch (errorCode) {
case SCAN_FAILED_ALREADY_STARTED:
LogManager.e(
Expand Down
Loading

0 comments on commit 995c936

Please sign in to comment.