Merge pull request #88 from NordicSemiconductor/develop

Version 2.8.3
This commit is contained in:
Aleksander Nowakowski
2020-02-12 12:48:33 +01:00
committed by GitHub
3 changed files with 64 additions and 38 deletions

View File

@@ -8,8 +8,8 @@ android {
applicationId "no.nordicsemi.android.nrftoolbox" applicationId "no.nordicsemi.android.nrftoolbox"
minSdkVersion 18 minSdkVersion 18
targetSdkVersion 29 targetSdkVersion 29
versionCode 74 versionCode 75
versionName "2.8.2" versionName "2.8.3"
resConfigs "en" resConfigs "en"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
@@ -50,7 +50,7 @@ dependencies {
implementation 'no.nordicsemi.android.support.v18:scanner:1.4.3' implementation 'no.nordicsemi.android.support.v18:scanner:1.4.3'
// The DFU Library is imported automatically from jcenter: // The DFU Library is imported automatically from jcenter:
implementation 'no.nordicsemi.android:dfu:1.9.1' implementation 'no.nordicsemi.android:dfu:1.10.0'
// if you desire to build the DFU Library, clone the // if you desire to build the DFU Library, clone the
// https://github.com/NordicSemiconductor/Android-DFU-Library project into DFULibrary folder, // https://github.com/NordicSemiconductor/Android-DFU-Library project into DFULibrary folder,
// add it as a module into the project structure and uncomment the following line // add it as a module into the project structure and uncomment the following line
@@ -60,7 +60,6 @@ dependencies {
// Gson is needed for DFU to work. The DFU library dependency to Gson is internal and would // Gson is needed for DFU to work. The DFU library dependency to Gson is internal and would
// not be attached to APK. // not be attached to APK.
// See: https://github.com/NordicSemiconductor/Android-nRF-Toolbox/issues/86 // See: https://github.com/NordicSemiconductor/Android-nRF-Toolbox/issues/86
implementation 'com.google.code.gson:gson:2.8.6'
// Import the BLE Common Library. // Import the BLE Common Library.
// The BLE Common Library depends on BLE Library. It is enough to include the first one. // The BLE Common Library depends on BLE Library. It is enough to include the first one.

View File

@@ -539,16 +539,20 @@ public class DfuActivity extends AppCompatActivity implements LoaderCallbacks<Cu
if (fileType != DfuService.TYPE_AUTO) { if (fileType != DfuService.TYPE_AUTO) {
scope = null; scope = null;
fileScopeView.setText(getString(R.string.not_available)); fileScopeView.setText(getString(R.string.not_available));
new AlertDialog.Builder(this).setTitle(R.string.dfu_file_init_title).setMessage(R.string.dfu_file_init_message) new AlertDialog.Builder(this)
.setTitle(R.string.dfu_file_init_title)
.setMessage(R.string.dfu_file_init_message)
.setNegativeButton(R.string.no, (dialog, which) -> { .setNegativeButton(R.string.no, (dialog, which) -> {
initFilePath = null; initFilePath = null;
initFileStreamUri = null; initFileStreamUri = null;
}).setPositiveButton(R.string.yes, (dialog, which) -> { })
.setPositiveButton(R.string.yes, (dialog, which) -> {
final Intent intent = new Intent(Intent.ACTION_GET_CONTENT); final Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType(DfuService.MIME_TYPE_OCTET_STREAM); intent.setType(DfuService.MIME_TYPE_OCTET_STREAM);
intent.addCategory(Intent.CATEGORY_OPENABLE); intent.addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(intent, SELECT_INIT_FILE_REQ); startActivityForResult(intent, SELECT_INIT_FILE_REQ);
}).show(); })
.show();
} else { } else {
new AlertDialog.Builder(this).setTitle(R.string.dfu_file_scope_title).setCancelable(false) new AlertDialog.Builder(this).setTitle(R.string.dfu_file_scope_title).setCancelable(false)
.setSingleChoiceItems(R.array.dfu_file_scope, 0, (dialog, which) -> { .setSingleChoiceItems(R.array.dfu_file_scope, 0, (dialog, which) -> {
@@ -584,7 +588,10 @@ public class DfuActivity extends AppCompatActivity implements LoaderCallbacks<Cu
* @param view a button that was pressed * @param view a button that was pressed
*/ */
public void onSelectFileHelpClicked(final View view) { public void onSelectFileHelpClicked(final View view) {
new AlertDialog.Builder(this).setTitle(R.string.dfu_help_title).setMessage(R.string.dfu_help_message).setPositiveButton(R.string.ok, null) new AlertDialog.Builder(this)
.setTitle(R.string.dfu_help_title)
.setMessage(R.string.dfu_help_message)
.setPositiveButton(R.string.ok, null)
.show(); .show();
} }
@@ -611,7 +618,8 @@ public class DfuActivity extends AppCompatActivity implements LoaderCallbacks<Cu
break; break;
} }
// Show a dialog with file types // Show a dialog with file types
new AlertDialog.Builder(this).setTitle(R.string.dfu_file_type_title) new AlertDialog.Builder(this)
.setTitle(R.string.dfu_file_type_title)
.setSingleChoiceItems(R.array.dfu_file_type, index, (dialog, which) -> { .setSingleChoiceItems(R.array.dfu_file_type, index, (dialog, which) -> {
switch (which) { switch (which) {
case 0: case 0:
@@ -627,10 +635,14 @@ public class DfuActivity extends AppCompatActivity implements LoaderCallbacks<Cu
fileTypeTmp = DfuService.TYPE_APPLICATION; fileTypeTmp = DfuService.TYPE_APPLICATION;
break; break;
} }
}).setPositiveButton(R.string.ok, (dialog, which) -> openFileChooser()).setNeutralButton(R.string.dfu_file_info, (dialog, which) -> { })
final ZipInfoFragment fragment = new ZipInfoFragment(); .setPositiveButton(R.string.ok, (dialog, which) -> openFileChooser())
fragment.show(getSupportFragmentManager(), "help_fragment"); .setNeutralButton(R.string.dfu_file_info, (dialog, which) -> {
}).setNegativeButton(R.string.cancel, null).show(); final ZipInfoFragment fragment = new ZipInfoFragment();
fragment.show(getSupportFragmentManager(), "help_fragment");
})
.setNegativeButton(R.string.cancel, null)
.show();
} }
private void openFileChooser() { private void openFileChooser() {
@@ -647,15 +659,19 @@ public class DfuActivity extends AppCompatActivity implements LoaderCallbacks<Cu
appsList.setAdapter(new FileBrowserAppsAdapter(this)); appsList.setAdapter(new FileBrowserAppsAdapter(this));
appsList.setChoiceMode(ListView.CHOICE_MODE_SINGLE); appsList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
appsList.setItemChecked(0, true); appsList.setItemChecked(0, true);
new AlertDialog.Builder(this).setTitle(R.string.dfu_alert_no_filebrowser_title).setView(customView) new AlertDialog.Builder(this)
.setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss()).setPositiveButton(R.string.ok, (dialog, which) -> { .setTitle(R.string.dfu_alert_no_filebrowser_title)
.setView(customView)
.setNegativeButton(R.string.no, (dialog, which) -> dialog.dismiss())
.setPositiveButton(R.string.ok, (dialog, which) -> {
final int pos = appsList.getCheckedItemPosition(); final int pos = appsList.getCheckedItemPosition();
if (pos >= 0) { if (pos >= 0) {
final String query = getResources().getStringArray(R.array.dfu_app_file_browser_action)[pos]; final String query = getResources().getStringArray(R.array.dfu_app_file_browser_action)[pos];
final Intent storeIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(query)); final Intent storeIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(query));
startActivity(storeIntent); startActivity(storeIntent);
} }
}).show(); })
.show();
} }
} }
@@ -703,6 +719,7 @@ public class DfuActivity extends AppCompatActivity implements LoaderCallbacks<Cu
.setForceDfu(forceDfu) .setForceDfu(forceDfu)
.setPacketsReceiptNotificationsEnabled(enablePRNs) .setPacketsReceiptNotificationsEnabled(enablePRNs)
.setPacketsReceiptNotificationsValue(numberOfPackets) .setPacketsReceiptNotificationsValue(numberOfPackets)
.setPrepareDataObjectDelay(400)
.setUnsafeExperimentalButtonlessServiceInSecureDfuEnabled(true); .setUnsafeExperimentalButtonlessServiceInSecureDfuEnabled(true);
if (fileType == DfuService.TYPE_AUTO) { if (fileType == DfuService.TYPE_AUTO) {
starter.setZip(fileStreamUri, filePath); starter.setZip(fileStreamUri, filePath);

View File

@@ -24,7 +24,7 @@
<string name="dfu_feature_title">DFU</string> <string name="dfu_feature_title">DFU</string>
<string name="dfu_service_title">nRF Toolbox DFU Proxy</string> <string name="dfu_service_title">nRF Toolbox DFU Proxy</string>
<string name="dfu_settings_title">DFU Settings</string> <string name="dfu_settings_title">DFU Settings</string>
<string name="dfu_lib_version">DFU Library version 1.9.1</string> <string name="dfu_lib_version">DFU Library version 1.10.0</string>
<string name="dfu_feature_title_long">DEVICE FIRMWARE UPDATE</string> <string name="dfu_feature_title_long">DEVICE FIRMWARE UPDATE</string>
<dimen name="dfu_feature_title_long_margin">-186dp</dimen> <dimen name="dfu_feature_title_long_margin">-186dp</dimen>
@@ -47,7 +47,8 @@
<string name="dfu_action_select_file">SELECT FILE</string> <string name="dfu_action_select_file">SELECT FILE</string>
<string name="dfu_alert_no_filebrowser_title">File Browser not found</string> <string name="dfu_alert_no_filebrowser_title">File Browser not found</string>
<string name="dfu_alert_no_filebrowser_message">File browser application has not been found on your device. Would you like to download one?</string> <string name="dfu_alert_no_filebrowser_message">File browser application has not been found on
your device. Would you like to download one?</string>
<string-array name="dfu_app_file_browser"> <string-array name="dfu_app_file_browser">
<item>Drive</item> <item>Drive</item>
<item>File Manager</item> <item>File Manager</item>
@@ -72,15 +73,19 @@
<string name="dfu_settings_dfu_mbr_size_title">MBR size (by default 4096 bytes)</string> <string name="dfu_settings_dfu_mbr_size_title">MBR size (by default 4096 bytes)</string>
<string name="dfu_settings_dfu_keep_bond">Keep bond information</string> <string name="dfu_settings_dfu_keep_bond">Keep bond information</string>
<string name="dfu_settings_dfu_assume_dfu_mode">External MCU DFU</string> <string name="dfu_settings_dfu_assume_dfu_mode">External MCU DFU</string>
<string name="dfu_settings_dfu_assume_dfu_mode_info">Check this switch to ON if you want to perform a DFU operation without jumping to the bootloader mode on a device <string name="dfu_settings_dfu_assume_dfu_mode_info">Check this switch to ON if you want to
with a DFU implementation from SDK 6.1 or older. To achieve the same result on any newer implementation the DFU Version characteristic should return value other than 0x0100.</string> perform a DFU operation without jumping to the bootloader mode on a device with a DFU
implementation from SDK 6.1 or older. To achieve the same result on any newer implementation
the DFU Version characteristic should return value other than 0x0100.</string>
<string name="dfu_settings_dfu_about">About DFU</string> <string name="dfu_settings_dfu_about">About DFU</string>
<string name="dfu_settings_dfu_about_summary">DFU documentation on Nordic\'s Developer Zone</string> <string name="dfu_settings_dfu_about_summary">DFU documentation on Nordic\'s Developer Zone</string>
<string name="dfu_settings_dfu_information">Information</string> <string name="dfu_settings_dfu_information">Information</string>
<string name="dfu_settings_dfu_number_of_packets_info">During a DFU operation a lot of data packets are being sent to the target. The <i>onCharacteristicWrite(...)</i> <string name="dfu_settings_dfu_number_of_packets_info">During a DFU operation a lot of data packets
callback in Android API is invoked when the data has been written to the outgoing queue, not when physically sent. Packet receipt notifications were introduced to are being sent to the target. The <i>onCharacteristicWrite(...)</i> callback in Android API
prevent from overflowing the queue. Depending on the device model, disabling the notifications or setting the value to “high” (> ~300) may make the DFU process freeze is invoked when the data has been written to the outgoing queue, not when physically sent.
at some point on Android versions before Marshmallow.</string> Packet receipt notifications were introduced to prevent from overflowing the queue. Depending
on the device model, disabling the notifications or setting the value to “high” (> ~300)
may make the DFU process freeze at some point on Android versions before Marshmallow.</string>
<string name="dfu_file_type_title">Select file type</string> <string name="dfu_file_type_title">Select file type</string>
<string-array name="dfu_file_type"> <string-array name="dfu_file_type">
@@ -91,8 +96,9 @@
</string-array> </string-array>
<string name="dfu_file_init_title">Init packet</string> <string name="dfu_file_init_title">Init packet</string>
<string name="dfu_file_init_message">Do you want to select the Init packet file?\n <string name="dfu_file_init_message">Do you want to select the Init packet file?\n
The Init packet file (*.dat) should contain the device type and revision, application version, list of supported Soft Devices and the firmware CRC The Init packet file (*.dat) should contain the device type and revision, application version,
in binary format or, with old versions of the DFU bootloader, only the CRC (CRC-CCITT-16). list of supported Soft Devices and the firmware CRC in binary format or, with old versions
of the DFU bootloader, only the CRC (CRC-CCITT-16).
With the new version of the bootloader the extended Init packet is <b>required</b>.</string> With the new version of the bootloader the extended Init packet is <b>required</b>.</string>
<string name="dfu_file_scope_title">Select scope</string> <string name="dfu_file_scope_title">Select scope</string>
<string-array name="dfu_file_scope"> <string-array name="dfu_file_scope">
@@ -110,19 +116,23 @@
<string name="dfu_aborted">Uploading of the application has been canceled.</string> <string name="dfu_aborted">Uploading of the application has been canceled.</string>
<string name="dfu_help_title">Select file</string> <string name="dfu_help_title">Select file</string>
<string name="dfu_help_message">A file browser application must be installed on the device before selecting the file. <string name="dfu_help_message">A file browser application must be installed on the device before
\n\nThere are number of applications available on Google Play store, e.g. Total Commander or File Manager, that allow you to pick a file from internal memory of the device. To upload selecting the file.\n\nThere are number of applications available on Google Play store,
a file from the Internet you may use e.g. Drive or Dropbox application. e.g. Total Commander or File Manager, that allow you to pick a file from internal memory
\n\nYou will be asked to select an application if more than one is installed. A single application will be launched automatically. of the device. To upload a file from the Internet you may use e.g. Drive or Dropbox application.
\n\nSince <b>Android KitKat</b> you may use the preinstalled document picker application. Ensure <i>Display advanced devices</i> option is enabled in settings to use the <i>Internal storage</i>. \n\nYou will be asked to select an application if more than one is installed. A single
\n\nSample applications were copied to <i>Nordic Semiconductor</i> folder in the internal storage.</string> application will be launched automatically.\n\nSince <b>Android KitKat</b> you may use the
preinstalled document picker application. Ensure <i>Show internal storage</i> option is
enabled in the menu to use the <i>Internal storage</i>.</string>
<string name="dfu_zip_info_text">Starting from nRF Toolbox v1.12 the new Distribution packet (ZIP) is the recommended method for distributing firmware upgrades. <string name="dfu_zip_info_text">Starting from nRF Toolbox v1.12 the new Distribution packet (ZIP)
You can create the ZIP file using the <b>nrf utility</b> tool, which is part of Master Control Panel 3.8.0+. For more detailed information, see the DFU documentation. is the recommended method for distributing firmware upgrades. You can create the ZIP file
using the <b>nrf util</b> tool (see GitHub). For more detailed information, see the DFU documentation.
\n\n<b>Backward compatibility</b> \n\n<b>Backward compatibility</b>
\nThe nRF Toolbox also supports all old file formats: HEX and BIN files, separate DAT files and ZIP files without a manifest file but with a fixed naming convention: \nThe nRF Toolbox also supports all old file formats: HEX and BIN files, separate DAT files
</string> and ZIP files without a manifest file but with a fixed naming convention:</string>
<string name="dfu_about_text">The Device Firmware Update (DFU) app allows you to update the firmware of your Bluetooth LE device over-the-air (OTA). <string name="dfu_about_text">The Device Firmware Update (DFU) app allows you to update the
It is compatible with Nordic Semiconductor nRF5 devices with DFU bootloader enabled. firmware of your Bluetooth LE device over-the-air (OTA). It is compatible with Nordic
Semiconductor nRF5 devices with DFU bootloader enabled.
\n\nFor more information about the DFU, see the About DFU section in Settings.</string> \n\nFor more information about the DFU, see the About DFU section in Settings.</string>
</resources> </resources>