Merge remote-tracking branch 'origin' into release

This commit is contained in:
Aleksander Nowakowski 2015-06-23 13:47:53 +02:00
commit 5fba67f7d1
6 changed files with 28 additions and 22 deletions

View File

@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
classpath 'com.android.tools.build:gradle:1.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@ -1,10 +1,10 @@
apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'no.nordicsemi.android'
PUBLISH_ARTIFACT_ID = 'dfu-library'
PUBLISH_VERSION = '0.6.0'
}
//ext {
// PUBLISH_GROUP_ID = 'no.nordicsemi.android'
// PUBLISH_ARTIFACT_ID = 'dfu-library'
// PUBLISH_VERSION = '0.6.0'
//}
android {
compileSdkVersion 22
@ -26,9 +26,9 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:22.1.1'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.google.code.gson:gson:2.3.1'
}
// Generate maven package: gradlew clean build generateRelease
apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'
//apply from: 'https://raw.githubusercontent.com/blundell/release-android-library/master/android-release-aar.gradle'

View File

@ -70,6 +70,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.2.0/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
@ -88,7 +89,7 @@
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="gson-2.3.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.1.1" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.1.1" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.2.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.2.0" level="project" />
</component>
</module>

View File

@ -1740,9 +1740,13 @@ public abstract class DfuBaseService extends IntentService {
* We could have save the fact of jumping as a parameter of the service but it ma be that some Android devices must first scan a device before connecting to it.
* It a device with the address+1 has never been detected before the service could have failed on connection.
*/
sendLogBroadcast(LOG_LEVEL_VERBOSE, "Scanning for the DFU bootloader...");
sendLogBroadcast(LOG_LEVEL_VERBOSE, "Scanning for the DFU Bootloader...");
final String newAddress = BootloaderScannerFactory.getScanner().searchFor(mDeviceAddress);
sendLogBroadcast(LOG_LEVEL_INFO, "The Bootloader found (" + newAddress + ")");
if (newAddress != null)
sendLogBroadcast(LOG_LEVEL_INFO, "DFU Bootloader found with address " + newAddress);
else {
sendLogBroadcast(LOG_LEVEL_INFO, "DFU Bootloader not found. Trying the same address...");
}
/*
* The current service instance has uploaded the Soft Device and/or Bootloader.
@ -1753,7 +1757,8 @@ public abstract class DfuBaseService extends IntentService {
newIntent.fillIn(intent, Intent.FILL_IN_COMPONENT | Intent.FILL_IN_PACKAGE);
newIntent.putExtra(EXTRA_FILE_MIME_TYPE, MIME_TYPE_ZIP); // ensure this is set (e.g. for scripts)
newIntent.putExtra(EXTRA_FILE_TYPE, TYPE_APPLICATION); // set the type to application only
newIntent.putExtra(EXTRA_DEVICE_ADDRESS, newAddress);
if (newAddress != null)
newIntent.putExtra(EXTRA_DEVICE_ADDRESS, newAddress);
newIntent.putExtra(EXTRA_PART_CURRENT, mPartCurrent + 1);
newIntent.putExtra(EXTRA_PARTS_TOTAL, mPartsTotal);
startService(newIntent);

View File

@ -37,7 +37,7 @@ public interface BootloaderScanner {
/**
* After the buttonless jump from the application mode to the bootloader mode the service will wait this long for the advertising bootloader (in milliseconds).
*/
public final static long TIMEOUT = 2000l; // ms
public final static long TIMEOUT = 5000l; // ms
/** The bootloader may advertise with the same address or one with the last byte incremented by this value. F.e. 00:11:22:33:44:55 -> 00:11:22:33:44:56. FF changes to 00. */
public final static int ADDRESS_DIFF = 1;

View File

@ -22,14 +22,10 @@
package no.nordicsemi.android.dfu.scanner;
import java.util.ArrayList;
import java.util.List;
import android.annotation.TargetApi;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.le.BluetoothLeScanner;
import android.bluetooth.le.ScanCallback;
import android.bluetooth.le.ScanFilter;
import android.bluetooth.le.ScanResult;
import android.bluetooth.le.ScanSettings;
import android.os.Build;
@ -81,11 +77,15 @@ public class BootloaderScannerLollipop extends ScanCallback implements Bootloade
final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
final BluetoothLeScanner scanner = adapter.getBluetoothLeScanner();
final List<ScanFilter> filters = new ArrayList<>();
filters.add(new ScanFilter.Builder().setDeviceAddress(mDeviceAddress).build());
filters.add(new ScanFilter.Builder().setDeviceAddress(mDeviceAddressIncremented).build());
/*
* Scanning with filters does not work on Nexus 9 (Android 5.1). No devices are found and scanner terminates on timeout.
* We will match the device address in the callback method instead. It's not like it should be, but at least it works.
*/
//final List<ScanFilter> filters = new ArrayList<>();
//filters.add(new ScanFilter.Builder().setDeviceAddress(mDeviceAddress).build());
//filters.add(new ScanFilter.Builder().setDeviceAddress(mDeviceAddressIncremented).build());
final ScanSettings settings = new ScanSettings.Builder().setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY).build();
scanner.startScan(filters, settings, this);
scanner.startScan(/*filters*/ null, settings, this);
try {
synchronized (mLock) {