Skip to content

Commit

Permalink
Merge pull request #90 from NordicSemiconductor/develop
Browse files Browse the repository at this point in the history
Version 2.8.4
  • Loading branch information
philips77 authored Feb 20, 2020
2 parents 47e22e1 + 886cf87 commit e820edd
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 22 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,5 +227,5 @@ contributed based on the [Apache 2.0 license](http://www.apache.org/licenses/LIC
- Android 4.3 or newer is required.
- Compatible with nRF5 devices running samples from the Nordic SDK and other devices implementing
standard profiles.
- Development kits can be ordered from http://www.nordicsemi.com/eng/Buy-Online.
- The nRF51 or nRF52 SDKs and SoftDevices are available online at http://developer.nordicsemi.com.
- Development kits: https://www.nordicsemi.com/Software-and-tools/Development-Kits.
- The nRF5 SDK and SoftDevices are available online at http://developer.nordicsemi.com.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ android {
applicationId "no.nordicsemi.android.nrftoolbox"
minSdkVersion 18
targetSdkVersion 29
versionCode 75
versionName "2.8.3"
versionCode 76
versionName "2.8.4"
resConfigs "en"

vectorDrawables.useSupportLibrary = true
}
buildTypes {
debug {
minifyEnabled true
shrinkResources true
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public class ExpandableRecordAdapter extends BaseExpandableListAdapter {;
private final Context context;
private SparseArray<GlucoseRecord> records;

public ExpandableRecordAdapter(final Context context, final GlucoseManager manager) {
glucoseManager = manager;
ExpandableRecordAdapter(final Context context, final GlucoseManager manager) {
this.glucoseManager = manager;
this.context = context;
inflater = LayoutInflater.from(context);
records = manager.getRecords().clone();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ private void setGUI() {

@Override
protected LoggableBleManager<GlucoseManagerCallbacks> initializeManager() {
GlucoseManager manager = glucoseManager = GlucoseManager.getGlucoseManager(getApplicationContext());
manager.setGattCallbacks(this);
final GlucoseManager manager = glucoseManager = GlucoseManager.getGlucoseManager(getApplicationContext());
manager.setManagerCallbacks(this);
return manager;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected void initialize() {
}
device.setCharacteristicNotification(recordAccessControlPointCharacteristic, true);
*/
setNotificationCallback(glucoseMeasurementContextCharacteristic)
setNotificationCallback(glucoseMeasurementCharacteristic)
.with(new GlucoseMeasurementDataCallback() {
@Override
public void onDataReceived(@NonNull final BluetoothDevice device, @NonNull final Data data) {
Expand Down Expand Up @@ -255,7 +255,7 @@ public void onRecordAccessOperationError(@NonNull final BluetoothDevice device,
}
});

enableNotifications(glucoseMeasurementContextCharacteristic).enqueue();
enableNotifications(glucoseMeasurementCharacteristic).enqueue();
enableNotifications(glucoseMeasurementContextCharacteristic).enqueue();
enableIndications(recordAccessControlPointCharacteristic)
.fail((device, status) -> log(Log.WARN, "Failed to enabled Record Access Control Point indications (error " + status + ")"))
Expand Down Expand Up @@ -301,7 +301,10 @@ SparseArray<GlucoseRecord> getRecords() {
*/
public void clear() {
records.clear();
callbacks.onOperationCompleted(getBluetoothDevice());
final BluetoothDevice target = getBluetoothDevice();
if (target != null) {
callbacks.onOperationCompleted(target);
}
}

/**
Expand All @@ -312,9 +315,12 @@ public void clear() {
void getLastRecord() {
if (recordAccessControlPointCharacteristic == null)
return;
final BluetoothDevice target = getBluetoothDevice();
if (target == null)
return;

clear();
callbacks.onOperationStarted(getBluetoothDevice());
callbacks.onOperationStarted(target);
writeCharacteristic(recordAccessControlPointCharacteristic, RecordAccessControlPointData.reportLastStoredRecord())
.with((device, data) -> log(LogContract.Log.Level.APPLICATION, "\"" + RecordAccessControlPointParser.parse(data) + "\" sent"))
.enqueue();
Expand All @@ -328,9 +334,12 @@ void getLastRecord() {
void getFirstRecord() {
if (recordAccessControlPointCharacteristic == null)
return;
final BluetoothDevice target = getBluetoothDevice();
if (target == null)
return;

clear();
callbacks.onOperationStarted(getBluetoothDevice());
callbacks.onOperationStarted(target);
writeCharacteristic(recordAccessControlPointCharacteristic, RecordAccessControlPointData.reportFirstStoredRecord())
.with((device, data) -> log(LogContract.Log.Level.APPLICATION, "\"" + RecordAccessControlPointParser.parse(data) + "\" sent"))
.enqueue();
Expand All @@ -345,9 +354,12 @@ void getFirstRecord() {
void getAllRecords() {
if (recordAccessControlPointCharacteristic == null)
return;
final BluetoothDevice target = getBluetoothDevice();
if (target == null)
return;

clear();
callbacks.onOperationStarted(getBluetoothDevice());
callbacks.onOperationStarted(target);
writeCharacteristic(recordAccessControlPointCharacteristic, RecordAccessControlPointData.reportNumberOfAllStoredRecords())
.with((device, data) -> log(LogContract.Log.Level.APPLICATION, "\"" + RecordAccessControlPointParser.parse(data) + "\" sent"))
.enqueue();
Expand All @@ -366,11 +378,14 @@ void getAllRecords() {
void refreshRecords() {
if (recordAccessControlPointCharacteristic == null)
return;
final BluetoothDevice target = getBluetoothDevice();
if (target == null)
return;

if (records.size() == 0) {
getAllRecords();
} else {
callbacks.onOperationStarted(getBluetoothDevice());
callbacks.onOperationStarted(target);

// obtain the last sequence number
final int sequenceNumber = records.keyAt(records.size() - 1) + 1;
Expand All @@ -390,6 +405,9 @@ void refreshRecords() {
void abort() {
if (recordAccessControlPointCharacteristic == null)
return;
final BluetoothDevice target = getBluetoothDevice();
if (target == null)
return;

writeCharacteristic(recordAccessControlPointCharacteristic, RecordAccessControlPointData.abortOperation())
.with((device, data) -> log(LogContract.Log.Level.APPLICATION, "\"" + RecordAccessControlPointParser.parse(data) + "\" sent"))
Expand All @@ -403,9 +421,12 @@ void abort() {
void deleteAllRecords() {
if (recordAccessControlPointCharacteristic == null)
return;
final BluetoothDevice target = getBluetoothDevice();
if (target == null)
return;

clear();
callbacks.onOperationStarted(getBluetoothDevice());
callbacks.onOperationStarted(target);
writeCharacteristic(recordAccessControlPointCharacteristic, RecordAccessControlPointData.deleteAllStoredRecords())
.with((device, data) -> log(LogContract.Log.Level.APPLICATION, "\"" + RecordAccessControlPointParser.parse(data) + "\" sent"))
.enqueue();
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/layout-land/activity_feature_gls.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
tools:visibility="gone"
android:orientation="vertical">

<com.google.android.material.button.MaterialButton
Expand Down Expand Up @@ -191,11 +192,12 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:visibility="visible"
android:visibility="gone">

<Button
style="@style/Widget.MaterialComponents.Button.TextButton"
android:id="@+id/action_abort"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/layout/activity_feature_gls.xml
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,12 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:visibility="visible"
android:visibility="gone">

<Button
style="@style/Widget.MaterialComponents.Button.TextButton"
android:id="@+id/action_abort"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
Expand Down
4 changes: 2 additions & 2 deletions wear/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "no.nordicsemi.android.nrftoolbox"
minSdkVersion 23
targetSdkVersion 29
versionCode 292827401 // target: 29, version: 2.8.2, build: 74, multi-APK: 01
versionName "2.8.2"
versionCode 292847601 // target: 29, version: 2.8.4, build: 74, multi-APK: 01
versionName "2.8.4"
resConfigs "en"
}
lintOptions {
Expand Down

0 comments on commit e820edd

Please sign in to comment.