Skip to content

Commit

Permalink
Version 1.14.1
Browse files Browse the repository at this point in the history
Bugs fixed in DFU scanner and in connection state error reporting.
  • Loading branch information
philips77 committed Jun 23, 2015
1 parent 93e2bb2 commit 115ea3a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "no.nordicsemi.android.nrftoolbox"
minSdkVersion 18
targetSdkVersion 22
versionCode 33
versionName "1.14.0"
versionCode 34
versionName "1.14.1"
}
buildTypes {
release {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="no.nordicsemi.android.nrftoolbox"
android:installLocation="auto"
android:versionCode="33"
android:versionCode="34"
android:versionName="1.14.1" >

<uses-sdk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,11 @@ public void onReceive(final Context context, final Intent intent) {
final int progress = intent.getIntExtra(DfuService.EXTRA_DATA, 0);
final int currentPart = intent.getIntExtra(DfuService.EXTRA_PART_CURRENT, 1);
final int totalParts = intent.getIntExtra(DfuService.EXTRA_PARTS_TOTAL, 1);
updateProgressBar(progress, currentPart, totalParts, false);
updateProgressBar(progress, currentPart, totalParts, false, false);
} else if (DfuService.BROADCAST_ERROR.equals(action)) {
final int error = intent.getIntExtra(DfuService.EXTRA_DATA, 0);
updateProgressBar(error, 0, 0, true);
final boolean connectionStateError = intent.getIntExtra(DfuService.EXTRA_ERROR_TYPE, DfuService.ERROR_TYPE_OTHER) == DfuService.ERROR_TYPE_COMMUNICATION_STATE;
updateProgressBar(error, 0, 0, true, connectionStateError);

// We have to wait a bit before canceling notification. This is called before DfuService creates the last notification.
new Handler().postDelayed(new Runnable() {
Expand Down Expand Up @@ -788,7 +789,7 @@ public void onDialogCanceled() {
// do nothing
}

private void updateProgressBar(final int progress, final int part, final int total, final boolean error) {
private void updateProgressBar(final int progress, final int part, final int total, final boolean error, final boolean connectionError) {
switch (progress) {
case DfuService.PROGRESS_CONNECTING:
mProgressBar.setIndeterminate(true);
Expand Down Expand Up @@ -841,7 +842,7 @@ public void run() {
default:
mProgressBar.setIndeterminate(false);
if (error) {
showErrorMessage(progress);
showErrorMessage(progress, connectionError);
} else {
mProgressBar.setProgress(progress);
mTextPercentage.setText(getString(R.string.progress, progress));
Expand Down Expand Up @@ -883,9 +884,12 @@ public void onCancelUpload() {
mTextPercentage.setText(null);
}

private void showErrorMessage(final int code) {
private void showErrorMessage(final int code, final boolean connectionError) {
clearUI(false);
showToast("Upload failed: " + GattError.parse(code) + " (" + (code & ~(DfuService.ERROR_MASK | DfuService.ERROR_REMOTE_MASK)) + ")");
if (connectionError)
showToast("Upload failed: " + GattError.parseConnectionError(code));
else
showToast("Upload failed: " + GattError.parse(code));
}

private void clearUI(final boolean clearDevice) {
Expand Down

0 comments on commit 115ea3a

Please sign in to comment.