Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ buildscript {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'de.mobilej.unmock:UnMockPlugin:0.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'digital.wup:android-maven-publish:3.6.2'
classpath 'digital.wup:android-maven-publish:3.6.3'
classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.18"
classpath 'org.owasp:dependency-check-gradle:5.2.2'
}
Expand Down Expand Up @@ -58,9 +58,10 @@ subprojects {
repositories {
google()
jcenter()
mavenCentral()
mavenLocal()
}


dependencies {
api "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}
Expand Down
2 changes: 2 additions & 0 deletions plugins/radar-android-faros/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ repositories {
dependencies {
api project(':radar-commons-android')
implementation 'org.radarcns:radar-faros-sdk:0.1.0'
implementation files('libs/radar-schemas-common.jar')

}

apply from: "$rootDir/gradle/publishing.gradle"
Expand Down
1 change: 1 addition & 0 deletions plugins/radar-android-garmin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
143 changes: 143 additions & 0 deletions plugins/radar-android-garmin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Garmin plugin for RADAR-pRMT

Application to be run on an Android 5.0 (or later) device with Bluetooth Low Energy (Bluetooth 4.0 or later), to interact with the Garmin.

## Installation

Garmin plugin for Radar platform is developed using Companion SDK (CSDK) from Garmin. Overview of the SDK is available on Garmin site here - https://developer.garmin.com/health-sdk/overview/

To create Garmin plugin below steps should be followed:

1. Pull RADAR commons repo.
2. Now download the Companion SDK (CSDK) folder provided by Garmin. You will have to contact Garmin and request for Companion SDK (CSDK). CSDK can be requested from Garmin using - https://www.garmin.com/en-US/forms/wellnesspartner/
4. The CSDK folder will have sample app in it.
5. Copy the below mentioned folders from sample app and paste it under path Radar-base-commons/plugins/radar-android-garmin/src/main/java/org/radarbase/garmin:
a. adapters
b. devices
c. pairing
d. ui
e. util
f. utils
6. Copy MainActivity and move it in ui folder.
7. Now, uncomment the commented line from Garmin plugins manifest file.

```
<activity android:name=".ui.MainActivity" />
<activity android:name=".ui.DataDisplayActivity" />
```

8. uncomment the overridden action method from GarminProvider class.

```
override val actions: List<Action>
get() = listOf(Action(radarService.getString(R.string.pair)) {
startActivity(Intent(this, MainActivity::class.java))
})
```
9. Uncomment the below statement from start method of GarminManager class.

```
RealTimeDataHandler.getInstance().registerListenerForHealthData(this)
```
10. Modify RealTimeDataHandler class

```
public class RealTimeDataHandler implements RealTimeDataListener {

private static final String TAG = RealTimeDataHandler.class.getSimpleName();

private static RealTimeDataHandler sInstance;

private static Device device;


private final HashMap<String, HashMap<RealTimeDataType, RealTimeResult>> mLatestData;


public synchronized static RealTimeDataHandler getInstance() {
if (sInstance == null) {
sInstance = new RealTimeDataHandler();
}
return sInstance;
}

private static OnHealthDataReceieved healthDataRecieved;

private RealTimeDataHandler() {
mLatestData = new HashMap<>();
}

public HashMap<RealTimeDataType, RealTimeResult> getLatestData(String deviceAddress) {
return mLatestData.get(deviceAddress);
}

public void registerListenerForHealthData(OnHealthDataReceieved healthDataRecieved) {
RealTimeDataHandler.healthDataRecieved = healthDataRecieved;
}

@SuppressLint("DefaultLocale")
public static void logRealTimeData(String tag, String macAddress, RealTimeDataType dataType, RealTimeResult result) {
//Log out the main value for each data type
if(healthDataRecieved!=null)
{
switch (dataType) {
case STEPS:
healthDataRecieved.stepsReceived(result.getSteps());
break;
case HEART_RATE_VARIABILITY:
healthDataRecieved.heartRateVariabilityReceived(result.getHeartRateVariability());
break;
case CALORIES:
healthDataRecieved.calorieRecieved(result.getCalories());
break;
case ASCENT:
healthDataRecieved.ascentDataReceived(result.getAscent());
break;
case INTENSITY_MINUTES:
healthDataRecieved.intensityMinutesReceived(result.getIntensityMinutes());
break;
case HEART_RATE:
healthDataRecieved.heartRateReceived(result.getHeartRate());
break;
case STRESS:
healthDataRecieved.stressReceived(result.getStress());
break;
case ACCELEROMETER:
healthDataRecieved.accelerometerReceived(result.getAccelerometer());
break;
case SPO2:
healthDataRecieved.spo2Received(result.getSpo2());
break;
case RESPIRATION:
healthDataRecieved.respirationReceived(result.getRespiration());
break;
}
}

}

public void setDevice(Device device) {
RealTimeDataHandler.device = device;
if(healthDataRecieved!=null)
healthDataRecieved.deviceInfoDetailsReceived(device);
}

@Override
public void onDataUpdate(@NonNull String macAddress, @NonNull RealTimeDataType dataType, @NonNull RealTimeResult result) {
logRealTimeData(TAG, macAddress, dataType, result);

//Cache last received data of each type
//Used to display values if device loses connection
HashMap<RealTimeDataType, RealTimeResult> latestData = mLatestData.get(macAddress);
if (latestData == null) {
latestData = new HashMap<>();
mLatestData.put(macAddress, latestData);
}
latestData.put(dataType, result);
}
}

```



46 changes: 46 additions & 0 deletions plugins/radar-android-garmin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apply from: "$rootDir/gradle/android.gradle"

//---------------------------------------------------------------------------//
// Configuration //
//---------------------------------------------------------------------------//

description = 'Plugin for RADAR passive remote monitoring app for Garmin device'

//---------------------------------------------------------------------------//
// Sources and classpath configurations //
//---------------------------------------------------------------------------//
repositories {
maven {url "https://jitpack.io"}
mavenLocal()
flatDir {
dirs 'libs'
}
}
dependencies {
implementation(name: 'garmin-health-sdk', ext: 'aar') {
exclude group: 'com.google.protobuf'
}
api project(':radar-commons-android')
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "com.github.PhilJay:MPAndroidChart:v2.1.6"
implementation 'com.google.guava:guava:28.0-android'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.google.protobuf:protobuf-lite:3.0.1'
implementation 'com.google.guava:guava:28.0-android'
implementation 'net.danlew:android.joda:2.9.9.2'
implementation "androidx.room:room-runtime:2.2.3"
implementation "androidx.room:room-guava:2.2.3"
implementation 'org.slf4j:slf4j-api:1.7.25'
implementation 'com.github.tony19:logback-android:1.1.1-12'
implementation 'net.zetetic:android-database-sqlcipher:4.3.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.2'
}

apply from: "$rootDir/gradle/publishing.gradle"
apply from: "$rootDir/gradle/bintray.gradle"
Empty file.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Thu Jun 04 16:30:29 IST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
Loading