From c69fc52f319d3b5e755f11fac865ae57e1db0d80 Mon Sep 17 00:00:00 2001 From: Aleksander Nowakowski Date: Thu, 1 Sep 2016 16:25:01 +0200 Subject: [PATCH] Readme and documentation updated --- README.md | 7 +- documentation/README.md | 97 ++-- documentation/javadoc/allclasses-frame.html | 7 +- documentation/javadoc/allclasses-noframe.html | 7 +- documentation/javadoc/constant-values.html | 290 ++++++++--- documentation/javadoc/deprecated-list.html | 40 +- documentation/javadoc/help-doc.html | 4 +- .../javadoc/index-files/index-1.html | 18 +- .../javadoc/index-files/index-10.html | 12 +- .../javadoc/index-files/index-11.html | 18 +- .../javadoc/index-files/index-12.html | 10 +- .../javadoc/index-files/index-13.html | 16 +- .../javadoc/index-files/index-14.html | 12 +- .../javadoc/index-files/index-15.html | 14 +- .../javadoc/index-files/index-16.html | 24 +- .../javadoc/index-files/index-17.html | 12 +- .../javadoc/index-files/index-18.html | 16 +- .../javadoc/index-files/index-19.html | 12 +- .../javadoc/index-files/index-2.html | 8 +- .../javadoc/index-files/index-20.html | 133 +++++ .../javadoc/index-files/index-3.html | 18 +- .../javadoc/index-files/index-4.html | 42 +- .../javadoc/index-files/index-5.html | 16 +- .../javadoc/index-files/index-6.html | 8 +- .../javadoc/index-files/index-7.html | 16 +- .../javadoc/index-files/index-8.html | 8 +- .../javadoc/index-files/index-9.html | 16 +- documentation/javadoc/index.html | 2 +- .../android/dfu/ApplicationTest.html | 241 --------- .../nordicsemi/android/dfu/BuildConfig.html | 8 +- .../android/dfu/DfuBaseService.html | 464 +++++++++++++++--- .../android/dfu/DfuLogListener.html | 4 +- .../android/dfu/DfuProgressListener.html | 4 +- .../dfu/DfuProgressListenerAdapter.html | 4 +- .../android/dfu/DfuServiceInitiator.html | 4 +- .../android/dfu/DfuServiceListenerHelper.html | 4 +- .../android/dfu/DfuSettingsConstants.html | 4 +- .../no/nordicsemi/android/dfu/R.attr.html | 4 +- .../no/nordicsemi/android/dfu/R.drawable.html | 4 +- .../javadoc/no/nordicsemi/android/dfu/R.html | 4 +- .../no/nordicsemi/android/dfu/R.string.html | 25 +- .../dfu/internal/ArchiveInputStream.html | 103 +++- .../android/dfu/internal/HexInputStream.html | 4 +- .../DeviceDisconnectedException.html | 73 +-- .../dfu/internal/exception/DfuException.html | 4 +- .../exception/HexFileValidationException.html | 4 +- .../exception/RemoteDfuException.html | 4 +- .../exception/SizeValidationException.html | 4 +- .../exception/UnknownResponseException.html | 10 +- .../exception/UploadAbortedException.html | 4 +- .../dfu/internal/exception/package-frame.html | 4 +- .../internal/exception/package-summary.html | 4 +- .../dfu/internal/exception/package-tree.html | 4 +- .../dfu/internal/manifest/FileInfo.html | 4 +- .../dfu/internal/manifest/InitPacketData.html | 4 +- .../dfu/internal/manifest/Manifest.html | 4 +- .../dfu/internal/manifest/ManifestFile.html | 4 +- .../SoftDeviceBootloaderFileInfo.html | 4 +- .../dfu/internal/manifest/package-frame.html | 4 +- .../internal/manifest/package-summary.html | 4 +- .../dfu/internal/manifest/package-tree.html | 4 +- .../android/dfu/internal/package-frame.html | 4 +- .../android/dfu/internal/package-summary.html | 4 +- .../android/dfu/internal/package-tree.html | 4 +- .../internal/scanner/BootloaderScanner.html | 4 +- .../scanner/BootloaderScannerFactory.html | 4 +- .../internal/scanner/BootloaderScannerJB.html | 4 +- .../scanner/BootloaderScannerLollipop.html | 4 +- .../dfu/internal/scanner/package-frame.html | 4 +- .../dfu/internal/scanner/package-summary.html | 4 +- .../dfu/internal/scanner/package-tree.html | 4 +- .../nordicsemi/android/dfu/package-frame.html | 5 +- .../android/dfu/package-summary.html | 26 +- .../nordicsemi/android/dfu/package-tree.html | 9 +- .../nordicsemi/android/error/GattError.html | 8 +- .../android/error/LegacyDfuError.html | 377 ++++++++++++++ .../android/error/SecureDfuError.html | 428 ++++++++++++++++ .../android/error/package-frame.html | 6 +- .../android/error/package-summary.html | 12 +- .../android/error/package-tree.html | 6 +- documentation/javadoc/overview-frame.html | 4 +- documentation/javadoc/overview-summary.html | 4 +- documentation/javadoc/overview-tree.html | 11 +- documentation/javadoc/serialized-form.html | 19 +- 84 files changed, 2097 insertions(+), 769 deletions(-) create mode 100644 documentation/javadoc/index-files/index-20.html delete mode 100644 documentation/javadoc/no/nordicsemi/android/dfu/ApplicationTest.html create mode 100644 documentation/javadoc/no/nordicsemi/android/error/LegacyDfuError.html create mode 100644 documentation/javadoc/no/nordicsemi/android/error/SecureDfuError.html diff --git a/README.md b/README.md index 30e1a38..c7154ca 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ The compat library may be found on jcenter and Maven Central repository. Add it to your project by adding the following dependency: ```Groovy -compile 'no.nordicsemi.android:dfu:0.6.3' +compile 'no.nordicsemi.android:dfu:1.0.0' ``` 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 * **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. * **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. - Buttonless update support for bonded devices - sharing the LTK between an app and the bootloader. +* **SDK 12.0.0** - New Secure DFU has been released. This library is fully backwards compatible so supports both the new and legacy DFU. Check platform folders for mode details about compatibility for each library. ### Resources -- [DFU Introduction](http://developer.nordicsemi.com/nRF51_SDK/doc/7.2.0/s110/html/a00062.html "BLE Bootloader/DFU") -- [How to create init packet](https://github.com/NordicSemiconductor/nRF-Master-Control-Panel/tree/master/init%20packet%20handling "Init packet handling") +- [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") +- [How to create init packet](https://github.com/NordicSemiconductor/Android-nRF-Connect/tree/master/init%20packet%20handling "Init packet handling") - [nRF51 Development Kit (DK)](http://www.nordicsemi.com/eng/Products/nRF51-DK "nRF51 DK") (compatible with Arduino Uno Revision 3) - [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) diff --git a/documentation/README.md b/documentation/README.md index 2505e55..54dfa5e 100644 --- a/documentation/README.md +++ b/documentation/README.md @@ -4,7 +4,8 @@ The DFU Library for Android 4.3+ adds the DFU feature to the Android project. ### Features: -* Allows to program Application, Soft Device and Bootloader Over-the-Air on the nRF51 Series SoC over Bluetooth Smart. +* 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. +* Allows to program Application, Soft Device and Bootloader Over-the-Air on the nRF5 Series SoC over Bluetooth Smart. * Supports HEX or BIN files. * Supports zip files with Soft Device, Bootloader and Application together. * 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. * **Android Studio IDE** or **Eclipse ADT** 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. -* **nRF51 device for testing.** +* **nRF5 device for testing.** - 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"). + 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"). ### Integration -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. +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. #### Android Studio @@ -103,19 +104,19 @@ import android.os.Bundle; public class NotificationActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); + super.onCreate(savedInstanceState); - // If this activity is the root activity of the task, the app is not running - if (isTaskRoot()) { - // Start the app before finishing - final Intent intent = new Intent(this, MyActivity.class); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - intent.putExtras(getIntent().getExtras()); // copy all extras - startActivity(intent); - } + // If this activity is the root activity of the task, the app is not running + if (isTaskRoot()) { + // Start the app before finishing + final Intent intent = new Intent(this, MyActivity.class); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.putExtras(getIntent().getExtras()); // copy all extras + startActivity(intent); + } - // Now finish, which will drop you to the activity at which you were at the top of the task stack - finish(); + // Now finish, which will drop you to the activity at which you were at the top of the task stack + finish(); } } ``` @@ -125,55 +126,53 @@ Remember to add your service to the *AndroidManifest.xml*. Start the DFU service with the following code: ```java -final Intent service = new Intent(this, MyDfuService.class); - -service.putExtra(DfuService.EXTRA_DEVICE_ADDRESS, mSelectedDevice.getAddress()); -service.putExtra(DfuService.EXTRA_DEVICE_NAME, mSelectedDevice.getName()); -service.putExtra(DfuService.EXTRA_FILE_MIME_TYPE, - mFileType == DfuService.TYPE_AUTO ? DfuService.MIME_TYPE_ZIP : DfuService.MIME_TYPE_OCTET_STREAM); -service.putExtra(DfuService.EXTRA_FILE_TYPE, mFileType); -service.putExtra(DfuService.EXTRA_FILE_PATH, mFilePath); // a path or URI must be provided. -service.putExtra(DfuService.EXTRA_FILE_URI, mFileStreamUri); +final DfuServiceInitiator starter = new DfuServiceInitiator(mSelectedDevice.getAddress()) + .setDeviceName(mSelectedDevice.getName()) + .setKeepBond(keepBond); // Init packet is required by Bootloader/DFU from SDK 7.0+ if HEX or BIN file is given above. // In case of a ZIP file, the init packet (a DAT file) must be included inside the ZIP file. -service.putExtra(DfuService.EXTRA_INIT_FILE_PATH, mInitFilePath); -service.putExtra(DfuService.EXTRA_INIT_FILE_URI, mInitFileStreamUri); -service.putExtra(DfuService.EXTRA_KEEP_BOND, mKeepBond); - -startService(service); +if (mFileType == DfuService.TYPE_AUTO) + starter.setZip(mFileStreamUri, mFilePath); +else { + starter.setBinOrHex(mFileType, mFileStreamUri, mFilePath).setInitFile(mInitFileStreamUri, mInitFilePath); +} +starter.start(this, DfuService.class); ``` -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. +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. The service will send local broadcast events using **LocalBroadcastManager**. ```java +private final DfuProgressListener mDfuProgressListener = new DfuProgressListenerAdapter() { @Override - protected void onResume() { - super.onResume(); - - // We are using LocalBroadcastReceiver instead of a normal BroadcastReceiver for - // optimization purposes - final LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(this); - broadcastManager.registerReceiver(mDfuUpdateReceiver, makeDfuUpdateIntentFilter()); + public void onDeviceConnecting(final String deviceAddress) { + mProgressBar.setIndeterminate(true); + mTextPercentage.setText(R.string.dfu_status_connecting); } @Override - protected void onPause() { - super.onPause(); - - final LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(this); - broadcastManager.unregisterReceiver(mDfuUpdateReceiver); + public void onDfuProcessStarting(final String deviceAddress) { + mProgressBar.setIndeterminate(true); + mTextPercentage.setText(R.string.dfu_status_starting); } + ///... +} - private static IntentFilter makeDfuUpdateIntentFilter() { - final IntentFilter intentFilter = new IntentFilter(); - intentFilter.addAction(DfuService.BROADCAST_PROGRESS); - intentFilter.addAction(DfuService.BROADCAST_ERROR); - intentFilter.addAction(DfuService.BROADCAST_LOG); - return intentFilter; - } +@Override +protected void onResume() { + super.onResume(); + + DfuServiceListenerHelper.registerProgressListener(this, mDfuProgressListener); +} + +@Override +protected void onPause() { + super.onPause(); + + DfuServiceListenerHelper.unregisterProgressListener(this, mDfuProgressListener); +} ``` ### Example diff --git a/documentation/javadoc/allclasses-frame.html b/documentation/javadoc/allclasses-frame.html index 23f6b2c..3343bbc 100644 --- a/documentation/javadoc/allclasses-frame.html +++ b/documentation/javadoc/allclasses-frame.html @@ -2,9 +2,9 @@ - + All Classes - + @@ -12,7 +12,6 @@

All Classes

Classes

    -
  • ApplicationTest
  • BuildConfig
  • DfuBaseService
  • DfuProgressListenerAdapter
  • diff --git a/documentation/javadoc/no/nordicsemi/android/dfu/package-summary.html b/documentation/javadoc/no/nordicsemi/android/dfu/package-summary.html index 40d4ab4..a80d295 100644 --- a/documentation/javadoc/no/nordicsemi/android/dfu/package-summary.html +++ b/documentation/javadoc/no/nordicsemi/android/dfu/package-summary.html @@ -2,9 +2,9 @@ - + no.nordicsemi.android.dfu - + @@ -109,50 +109,44 @@ -ApplicationTest - - - - - BuildConfig   - + DfuBaseService
    The DFU Service provides full support for Over-the-Air (OTA) Device Firmware Update (DFU) by Nordic Semiconductor.
    - + DfuProgressListenerAdapter   - + DfuServiceInitiator
    Starting the DfuService service requires a knowledge of some EXTRA_* constants used to pass parameters to the service.
    - + DfuServiceListenerHelper
    A helper class that should be used to register listeners for DFU Service broadcast events.
    - + R   - + R.attr   - + R.drawable   - + R.string   diff --git a/documentation/javadoc/no/nordicsemi/android/dfu/package-tree.html b/documentation/javadoc/no/nordicsemi/android/dfu/package-tree.html index c92e13d..2fbf55b 100644 --- a/documentation/javadoc/no/nordicsemi/android/dfu/package-tree.html +++ b/documentation/javadoc/no/nordicsemi/android/dfu/package-tree.html @@ -2,9 +2,9 @@ - + no.nordicsemi.android.dfu Class Hierarchy - + @@ -80,11 +80,6 @@
    • java.lang.Object
        -
      • <any> - -
      • no.nordicsemi.android.dfu.BuildConfig
      • no.nordicsemi.android.dfu.DfuProgressListenerAdapter (implements no.nordicsemi.android.dfu.DfuProgressListener)
      • no.nordicsemi.android.dfu.DfuServiceInitiator
      • diff --git a/documentation/javadoc/no/nordicsemi/android/error/GattError.html b/documentation/javadoc/no/nordicsemi/android/error/GattError.html index 77cfaf2..a392063 100644 --- a/documentation/javadoc/no/nordicsemi/android/error/GattError.html +++ b/documentation/javadoc/no/nordicsemi/android/error/GattError.html @@ -2,9 +2,9 @@ - + GattError - + @@ -49,7 +49,7 @@ var activeTableTab = "activeTableTab";