From 6d683483307a5d466501e11baf0a8be24234a888 Mon Sep 17 00:00:00 2001 From: Graham Jones Date: Tue, 2 Apr 2024 19:44:13 +0100 Subject: [PATCH] Added Current Time Service to BLE Data Source so we set the time on InfiniTime when it connects (using the library by BeeLine https://github.com/RideBeeline/android-bluetooth-current-time-service)). --- CHANGELOG.md | 1 + README.md | 1 + app/build.gradle | 2 ++ app/src/main/AndroidManifest.xml | 4 ++-- .../java/uk/org/openseizuredetector/SdDataSourceBLE.java | 5 +++++ 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8905669..5635f80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ OpenSeizureDetector Android App - Change Log ============================================ + V4.2.5 - Set BLE device time if the characteristic is available. V4.2.4 - Added checks and a FAULT condition for Bluetooth errors in Bluetooth Data Source V4.2.3 - Uses 3d accelerometer data to calculate magnitude if vector magnitude is not sent from data source. - fixed latched alarms (Issue #146) diff --git a/README.md b/README.md index dacec08..3d85ce7 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,7 @@ The following libraries are used: * (jBeep)[http://www.ultraduz.com.br] * (Chartjs)[http://www.chartjs.org] * (MPAndroidChart)[https://github.com/PhilJay/MPAndroidChart] +* (CurrentTimeService)[https://github.com/RideBeeline/android-bluetooth-current-time-service] Logo based on ["Star of life2" by Verdy p - Own work. Licensed under Public Domain via Wikimedia Commons](http://commons.wikimedia.org/wiki/File:Star_of_life2.svg#mediaviewer/File:Star_of_life2.svg). diff --git a/app/build.gradle b/app/build.gradle index 043da82..44522d9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -80,6 +80,8 @@ dependencies { //androidTestImplementation 'androidx.test.espresso:espresso-intents:3.1.1' implementation 'com.techyourchance:threadposter:1.0.1' implementation 'com.google.android.material:material' + implementation "com.github.RideBeeline:android-bluetooth-current-time-service:0.1.2" + } repositories { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f38b9e6..af13d8d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="139" + android:versionName="4.2.5"> diff --git a/app/src/main/java/uk/org/openseizuredetector/SdDataSourceBLE.java b/app/src/main/java/uk/org/openseizuredetector/SdDataSourceBLE.java index 4c07aa7..ef76856 100644 --- a/app/src/main/java/uk/org/openseizuredetector/SdDataSourceBLE.java +++ b/app/src/main/java/uk/org/openseizuredetector/SdDataSourceBLE.java @@ -56,6 +56,8 @@ import java.util.HashMap; import java.util.List; import java.util.UUID; +import co.beeline.android.bluetooth.currenttimeservice.CurrentTimeService; + /** * A data source that registers for BLE GATT notifications from a device and @@ -153,6 +155,8 @@ public class SdDataSourceBLE extends SdDataSource { mSdData.watchSdName = mBleDeviceName; mSdData.watchPartNo = mBleDeviceAddr; + boolean success = CurrentTimeService.startServer(mContext); + bleConnect(); } @@ -231,6 +235,7 @@ public class SdDataSourceBLE extends SdDataSource { mUtil.writeToSysLogFile("SDDataSourceBLE.stop()"); bleDisconnect(); + CurrentTimeService.stopServer(); super.stop(); }