Skip to content

Commit c69fc52

Browse files
committed
Readme and documentation updated
1 parent 33393ee commit c69fc52

File tree

84 files changed

+2099
-771
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+2099
-771
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
The compat library may be found on jcenter and Maven Central repository. Add it to your project by adding the following dependency:
88

99
```Groovy
10-
compile 'no.nordicsemi.android:dfu:0.6.3'
10+
compile 'no.nordicsemi.android:dfu:1.0.0'
1111
```
1212

1313
If you use proguard, add the following line to your proguard rules:
@@ -44,12 +44,13 @@ The library is compatible with nRF51 and nRF52 devices with S-Series Soft Device
4444
* **SDK 7.0.0** - The extended init packet is required. The init packet contains additional validation information: device type and revision, application version, compatible Soft Devices and the firmware CRC.
4545
* **SDK 8.0.0** - The bond information may be preserved after an application update. The new application, when first started, will send the Service Change indication to the phone to refresh the services.
4646
- Buttonless update support for bonded devices - sharing the LTK between an app and the bootloader.
47+
* **SDK 12.0.0** - New Secure DFU has been released. This library is fully backwards compatible so supports both the new and legacy DFU.
4748

4849
Check platform folders for mode details about compatibility for each library.
4950

5051
### Resources
5152

52-
- [DFU Introduction](http://developer.nordicsemi.com/nRF51_SDK/doc/7.2.0/s110/html/a00062.html "BLE Bootloader/DFU")
53-
- [How to create init packet](https://github.com/NordicSemiconductor/nRF-Master-Control-Panel/tree/master/init%20packet%20handling "Init packet handling")
53+
- [DFU Introduction](http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v11.0.0/examples_ble_dfu.html?cp=6_0_0_4_3_1 "BLE Bootloader/DFU")
54+
- [How to create init packet](https://github.com/NordicSemiconductor/Android-nRF-Connect/tree/master/init%20packet%20handling "Init packet handling")
5455
- [nRF51 Development Kit (DK)](http://www.nordicsemi.com/eng/Products/nRF51-DK "nRF51 DK") (compatible with Arduino Uno Revision 3)
5556
- [nRF52 Development Kit (DK)](http://www.nordicsemi.com/eng/Products/Bluetooth-Smart-Bluetooth-low-energy/nRF52-DK "nRF52 DK") (compatible with Arduino Uno Revision 3)

documentation/README.md

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ The DFU Library for Android 4.3+ adds the DFU feature to the Android project.
44

55
### Features:
66

7-
* Allows to program Application, Soft Device and Bootloader Over-the-Air on the nRF51 Series SoC over Bluetooth Smart.
7+
* DFU Library version 1.0.0+ supports **Secure DFU** introduced in SDK 12.0.0 and is fully backwards compatible with all versions of Legacy DFU.
8+
* Allows to program Application, Soft Device and Bootloader Over-the-Air on the nRF5 Series SoC over Bluetooth Smart.
89
* Supports HEX or BIN files.
910
* Supports zip files with Soft Device, Bootloader and Application together.
1011
* Supports the Init packet (which has been required since Bootloader/DFU from SDK 7.0+).
@@ -27,13 +28,13 @@ In case of any communication error the peripheral device will never be bricked.
2728
* **Android Studio IDE** or **Eclipse ADT**
2829

2930
Projects are compatible with Android Studio and the Gradle build engine. It is possible to convert them to Eclipse ADT projects. See Integration for more details.
30-
* **nRF51 device for testing.**
31+
* **nRF5 device for testing.**
3132

32-
A nRF51 Series device is required to test the working solution. If your final product is not available, use the nRF51 DK, which you can find [here](http://www.nordicsemi.com/eng/Products/nRF51-DK "nRF51 DK").
33+
A nRF5 Series device is required to test the working solution. If your final product is not available, use the nRF51 DK, which you can find [here](http://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF52-DK "nRF52 DK").
3334

3435
### Integration
3536

36-
The DFULibrary is compatible as such with Android Studio 1.0.2 IDE. If you are using Eclipse ADT, you will have to convert the project to match the Eclipse project structure.
37+
The DFULibrary is compatible as such with Android Studio IDE. If you are using Eclipse ADT, you will have to convert the project to match the Eclipse project structure.
3738

3839
#### Android Studio
3940

@@ -103,19 +104,19 @@ import android.os.Bundle;
103104
public class NotificationActivity extends Activity {
104105
@Override
105106
protected void onCreate(Bundle savedInstanceState) {
106-
super.onCreate(savedInstanceState);
107-
108-
// If this activity is the root activity of the task, the app is not running
109-
if (isTaskRoot()) {
110-
// Start the app before finishing
111-
final Intent intent = new Intent(this, MyActivity.class);
112-
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
113-
intent.putExtras(getIntent().getExtras()); // copy all extras
114-
startActivity(intent);
115-
}
116-
117-
// Now finish, which will drop you to the activity at which you were at the top of the task stack
118-
finish();
107+
super.onCreate(savedInstanceState);
108+
109+
// If this activity is the root activity of the task, the app is not running
110+
if (isTaskRoot()) {
111+
// Start the app before finishing
112+
final Intent intent = new Intent(this, MyActivity.class);
113+
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
114+
intent.putExtras(getIntent().getExtras()); // copy all extras
115+
startActivity(intent);
116+
}
117+
118+
// Now finish, which will drop you to the activity at which you were at the top of the task stack
119+
finish();
119120
}
120121
}
121122
```
@@ -125,55 +126,53 @@ Remember to add your service to the *AndroidManifest.xml*.
125126
Start the DFU service with the following code:
126127

127128
```java
128-
final Intent service = new Intent(this, MyDfuService.class);
129-
130-
service.putExtra(DfuService.EXTRA_DEVICE_ADDRESS, mSelectedDevice.getAddress());
131-
service.putExtra(DfuService.EXTRA_DEVICE_NAME, mSelectedDevice.getName());
132-
service.putExtra(DfuService.EXTRA_FILE_MIME_TYPE,
133-
mFileType == DfuService.TYPE_AUTO ? DfuService.MIME_TYPE_ZIP : DfuService.MIME_TYPE_OCTET_STREAM);
134-
service.putExtra(DfuService.EXTRA_FILE_TYPE, mFileType);
135-
service.putExtra(DfuService.EXTRA_FILE_PATH, mFilePath); // a path or URI must be provided.
136-
service.putExtra(DfuService.EXTRA_FILE_URI, mFileStreamUri);
129+
final DfuServiceInitiator starter = new DfuServiceInitiator(mSelectedDevice.getAddress())
130+
.setDeviceName(mSelectedDevice.getName())
131+
.setKeepBond(keepBond);
137132
// Init packet is required by Bootloader/DFU from SDK 7.0+ if HEX or BIN file is given above.
138133
// In case of a ZIP file, the init packet (a DAT file) must be included inside the ZIP file.
139-
service.putExtra(DfuService.EXTRA_INIT_FILE_PATH, mInitFilePath);
140-
service.putExtra(DfuService.EXTRA_INIT_FILE_URI, mInitFileStreamUri);
141-
service.putExtra(DfuService.EXTRA_KEEP_BOND, mKeepBond);
142-
143-
startService(service);
134+
if (mFileType == DfuService.TYPE_AUTO)
135+
starter.setZip(mFileStreamUri, mFilePath);
136+
else {
137+
starter.setBinOrHex(mFileType, mFileStreamUri, mFilePath).setInitFile(mInitFileStreamUri, mInitFilePath);
138+
}
139+
starter.start(this, DfuService.class);
144140
```
145141

146-
Please, see [How to create init packet](https://github.com/NordicSemiconductor/nRF-Master-Control-Panel/tree/master/init%20packet%20handling "Init packet handling") document for more information about the init packet.
142+
Please, see [How to create init packet](https://github.com/NordicSemiconductor/Android-nRF-Connect/tree/master/init%20packet%20handling "Init packet handling") document for more information about the init packet.
147143

148144
The service will send local broadcast events using **LocalBroadcastManager**.
149145

150146

151147
```java
148+
private final DfuProgressListener mDfuProgressListener = new DfuProgressListenerAdapter() {
152149
@Override
153-
protected void onResume() {
154-
super.onResume();
155-
156-
// We are using LocalBroadcastReceiver instead of a normal BroadcastReceiver for
157-
// optimization purposes
158-
final LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(this);
159-
broadcastManager.registerReceiver(mDfuUpdateReceiver, makeDfuUpdateIntentFilter());
150+
public void onDeviceConnecting(final String deviceAddress) {
151+
mProgressBar.setIndeterminate(true);
152+
mTextPercentage.setText(R.string.dfu_status_connecting);
160153
}
161154

162155
@Override
163-
protected void onPause() {
164-
super.onPause();
165-
166-
final LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(this);
167-
broadcastManager.unregisterReceiver(mDfuUpdateReceiver);
156+
public void onDfuProcessStarting(final String deviceAddress) {
157+
mProgressBar.setIndeterminate(true);
158+
mTextPercentage.setText(R.string.dfu_status_starting);
168159
}
160+
///...
161+
}
169162

170-
private static IntentFilter makeDfuUpdateIntentFilter() {
171-
final IntentFilter intentFilter = new IntentFilter();
172-
intentFilter.addAction(DfuService.BROADCAST_PROGRESS);
173-
intentFilter.addAction(DfuService.BROADCAST_ERROR);
174-
intentFilter.addAction(DfuService.BROADCAST_LOG);
175-
return intentFilter;
176-
}
163+
@Override
164+
protected void onResume() {
165+
super.onResume();
166+
167+
DfuServiceListenerHelper.registerProgressListener(this, mDfuProgressListener);
168+
}
169+
170+
@Override
171+
protected void onPause() {
172+
super.onPause();
173+
174+
DfuServiceListenerHelper.unregisterProgressListener(this, mDfuProgressListener);
175+
}
177176
```
178177

179178
### Example

documentation/javadoc/allclasses-frame.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22
<!-- NewPage -->
33
<html lang="en">
44
<head>
5-
<!-- Generated by javadoc (1.8.0_91) on Thu Jun 30 16:24:38 CEST 2016 -->
5+
<!-- Generated by javadoc (1.8.0_91) on Thu Sep 01 16:24:35 CEST 2016 -->
66
<title>All Classes</title>
7-
<meta name="date" content="2016-06-30">
7+
<meta name="date" content="2016-09-01">
88
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
99
<script type="text/javascript" src="script.js"></script>
1010
</head>
1111
<body>
1212
<h1 class="bar">All&nbsp;Classes</h1>
1313
<div class="indexContainer">
1414
<ul>
15-
<li><a href="no/nordicsemi/android/dfu/ApplicationTest.html" title="class in no.nordicsemi.android.dfu" target="classFrame">ApplicationTest</a></li>
1615
<li><a href="no/nordicsemi/android/dfu/internal/ArchiveInputStream.html" title="class in no.nordicsemi.android.dfu.internal" target="classFrame">ArchiveInputStream</a></li>
1716
<li><a href="no/nordicsemi/android/dfu/internal/scanner/BootloaderScanner.html" title="interface in no.nordicsemi.android.dfu.internal.scanner" target="classFrame"><span class="interfaceName">BootloaderScanner</span></a></li>
1817
<li><a href="no/nordicsemi/android/dfu/internal/scanner/BootloaderScannerFactory.html" title="class in no.nordicsemi.android.dfu.internal.scanner" target="classFrame">BootloaderScannerFactory</a></li>
@@ -33,13 +32,15 @@ <h1 class="bar">All&nbsp;Classes</h1>
3332
<li><a href="no/nordicsemi/android/dfu/internal/exception/HexFileValidationException.html" title="class in no.nordicsemi.android.dfu.internal.exception" target="classFrame">HexFileValidationException</a></li>
3433
<li><a href="no/nordicsemi/android/dfu/internal/HexInputStream.html" title="class in no.nordicsemi.android.dfu.internal" target="classFrame">HexInputStream</a></li>
3534
<li><a href="no/nordicsemi/android/dfu/internal/manifest/InitPacketData.html" title="class in no.nordicsemi.android.dfu.internal.manifest" target="classFrame">InitPacketData</a></li>
35+
<li><a href="no/nordicsemi/android/error/LegacyDfuError.html" title="class in no.nordicsemi.android.error" target="classFrame">LegacyDfuError</a></li>
3636
<li><a href="no/nordicsemi/android/dfu/internal/manifest/Manifest.html" title="class in no.nordicsemi.android.dfu.internal.manifest" target="classFrame">Manifest</a></li>
3737
<li><a href="no/nordicsemi/android/dfu/internal/manifest/ManifestFile.html" title="class in no.nordicsemi.android.dfu.internal.manifest" target="classFrame">ManifestFile</a></li>
3838
<li><a href="no/nordicsemi/android/dfu/R.html" title="class in no.nordicsemi.android.dfu" target="classFrame">R</a></li>
3939
<li><a href="no/nordicsemi/android/dfu/R.attr.html" title="class in no.nordicsemi.android.dfu" target="classFrame">R.attr</a></li>
4040
<li><a href="no/nordicsemi/android/dfu/R.drawable.html" title="class in no.nordicsemi.android.dfu" target="classFrame">R.drawable</a></li>
4141
<li><a href="no/nordicsemi/android/dfu/R.string.html" title="class in no.nordicsemi.android.dfu" target="classFrame">R.string</a></li>
4242
<li><a href="no/nordicsemi/android/dfu/internal/exception/RemoteDfuException.html" title="class in no.nordicsemi.android.dfu.internal.exception" target="classFrame">RemoteDfuException</a></li>
43+
<li><a href="no/nordicsemi/android/error/SecureDfuError.html" title="class in no.nordicsemi.android.error" target="classFrame">SecureDfuError</a></li>
4344
<li><a href="no/nordicsemi/android/dfu/internal/exception/SizeValidationException.html" title="class in no.nordicsemi.android.dfu.internal.exception" target="classFrame">SizeValidationException</a></li>
4445
<li><a href="no/nordicsemi/android/dfu/internal/manifest/SoftDeviceBootloaderFileInfo.html" title="class in no.nordicsemi.android.dfu.internal.manifest" target="classFrame">SoftDeviceBootloaderFileInfo</a></li>
4546
<li><a href="no/nordicsemi/android/dfu/internal/exception/UnknownResponseException.html" title="class in no.nordicsemi.android.dfu.internal.exception" target="classFrame">UnknownResponseException</a></li>

documentation/javadoc/allclasses-noframe.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22
<!-- NewPage -->
33
<html lang="en">
44
<head>
5-
<!-- Generated by javadoc (1.8.0_91) on Thu Jun 30 16:24:38 CEST 2016 -->
5+
<!-- Generated by javadoc (1.8.0_91) on Thu Sep 01 16:24:35 CEST 2016 -->
66
<title>All Classes</title>
7-
<meta name="date" content="2016-06-30">
7+
<meta name="date" content="2016-09-01">
88
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
99
<script type="text/javascript" src="script.js"></script>
1010
</head>
1111
<body>
1212
<h1 class="bar">All&nbsp;Classes</h1>
1313
<div class="indexContainer">
1414
<ul>
15-
<li><a href="no/nordicsemi/android/dfu/ApplicationTest.html" title="class in no.nordicsemi.android.dfu">ApplicationTest</a></li>
1615
<li><a href="no/nordicsemi/android/dfu/internal/ArchiveInputStream.html" title="class in no.nordicsemi.android.dfu.internal">ArchiveInputStream</a></li>
1716
<li><a href="no/nordicsemi/android/dfu/internal/scanner/BootloaderScanner.html" title="interface in no.nordicsemi.android.dfu.internal.scanner"><span class="interfaceName">BootloaderScanner</span></a></li>
1817
<li><a href="no/nordicsemi/android/dfu/internal/scanner/BootloaderScannerFactory.html" title="class in no.nordicsemi.android.dfu.internal.scanner">BootloaderScannerFactory</a></li>
@@ -33,13 +32,15 @@ <h1 class="bar">All&nbsp;Classes</h1>
3332
<li><a href="no/nordicsemi/android/dfu/internal/exception/HexFileValidationException.html" title="class in no.nordicsemi.android.dfu.internal.exception">HexFileValidationException</a></li>
3433
<li><a href="no/nordicsemi/android/dfu/internal/HexInputStream.html" title="class in no.nordicsemi.android.dfu.internal">HexInputStream</a></li>
3534
<li><a href="no/nordicsemi/android/dfu/internal/manifest/InitPacketData.html" title="class in no.nordicsemi.android.dfu.internal.manifest">InitPacketData</a></li>
35+
<li><a href="no/nordicsemi/android/error/LegacyDfuError.html" title="class in no.nordicsemi.android.error">LegacyDfuError</a></li>
3636
<li><a href="no/nordicsemi/android/dfu/internal/manifest/Manifest.html" title="class in no.nordicsemi.android.dfu.internal.manifest">Manifest</a></li>
3737
<li><a href="no/nordicsemi/android/dfu/internal/manifest/ManifestFile.html" title="class in no.nordicsemi.android.dfu.internal.manifest">ManifestFile</a></li>
3838
<li><a href="no/nordicsemi/android/dfu/R.html" title="class in no.nordicsemi.android.dfu">R</a></li>
3939
<li><a href="no/nordicsemi/android/dfu/R.attr.html" title="class in no.nordicsemi.android.dfu">R.attr</a></li>
4040
<li><a href="no/nordicsemi/android/dfu/R.drawable.html" title="class in no.nordicsemi.android.dfu">R.drawable</a></li>
4141
<li><a href="no/nordicsemi/android/dfu/R.string.html" title="class in no.nordicsemi.android.dfu">R.string</a></li>
4242
<li><a href="no/nordicsemi/android/dfu/internal/exception/RemoteDfuException.html" title="class in no.nordicsemi.android.dfu.internal.exception">RemoteDfuException</a></li>
43+
<li><a href="no/nordicsemi/android/error/SecureDfuError.html" title="class in no.nordicsemi.android.error">SecureDfuError</a></li>
4344
<li><a href="no/nordicsemi/android/dfu/internal/exception/SizeValidationException.html" title="class in no.nordicsemi.android.dfu.internal.exception">SizeValidationException</a></li>
4445
<li><a href="no/nordicsemi/android/dfu/internal/manifest/SoftDeviceBootloaderFileInfo.html" title="class in no.nordicsemi.android.dfu.internal.manifest">SoftDeviceBootloaderFileInfo</a></li>
4546
<li><a href="no/nordicsemi/android/dfu/internal/exception/UnknownResponseException.html" title="class in no.nordicsemi.android.dfu.internal.exception">UnknownResponseException</a></li>

0 commit comments

Comments
 (0)