mirror of
https://github.com/aljazceru/Android-nRF-Toolbox.git
synced 2025-12-24 01:44:23 +01:00
@@ -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,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 {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -81,8 +81,8 @@ public class GlucoseActivity extends BleProfileExpandableListActivity implements
|
||||
|
||||
@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;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public class GlucoseManager extends BatteryManager<GlucoseManagerCallbacks> {
|
||||
}
|
||||
device.setCharacteristicNotification(recordAccessControlPointCharacteristic, true);
|
||||
*/
|
||||
setNotificationCallback(glucoseMeasurementContextCharacteristic)
|
||||
setNotificationCallback(glucoseMeasurementCharacteristic)
|
||||
.with(new GlucoseMeasurementDataCallback() {
|
||||
@Override
|
||||
public void onDataReceived(@NonNull final BluetoothDevice device, @NonNull final Data data) {
|
||||
@@ -255,7 +255,7 @@ public class GlucoseManager extends BatteryManager<GlucoseManagerCallbacks> {
|
||||
}
|
||||
});
|
||||
|
||||
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 + ")"))
|
||||
@@ -301,7 +301,10 @@ public class GlucoseManager extends BatteryManager<GlucoseManagerCallbacks> {
|
||||
*/
|
||||
public void clear() {
|
||||
records.clear();
|
||||
callbacks.onOperationCompleted(getBluetoothDevice());
|
||||
final BluetoothDevice target = getBluetoothDevice();
|
||||
if (target != null) {
|
||||
callbacks.onOperationCompleted(target);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -312,9 +315,12 @@ public class GlucoseManager extends BatteryManager<GlucoseManagerCallbacks> {
|
||||
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();
|
||||
@@ -328,9 +334,12 @@ public class GlucoseManager extends BatteryManager<GlucoseManagerCallbacks> {
|
||||
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();
|
||||
@@ -345,9 +354,12 @@ public class GlucoseManager extends BatteryManager<GlucoseManagerCallbacks> {
|
||||
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();
|
||||
@@ -366,11 +378,14 @@ public class GlucoseManager extends BatteryManager<GlucoseManagerCallbacks> {
|
||||
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;
|
||||
@@ -390,6 +405,9 @@ public class GlucoseManager extends BatteryManager<GlucoseManagerCallbacks> {
|
||||
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"))
|
||||
@@ -403,9 +421,12 @@ public class GlucoseManager extends BatteryManager<GlucoseManagerCallbacks> {
|
||||
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();
|
||||
|
||||
@@ -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
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user