Skip to content

Commit

Permalink
Merge pull request #448 from RADAR-base/polar-dev
Browse files Browse the repository at this point in the history
Add Polar plugins
  • Loading branch information
Bdegraaf1234 authored Aug 1, 2024
2 parents df0ef9a + 63434e5 commit 1025a68
Show file tree
Hide file tree
Showing 15 changed files with 687 additions and 7 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,3 @@ fabric.properties
## Pebble 2
.lock*
.skip
gradle.skip
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ buildscript {
repositories {
google()
mavenCentral()
mavenLocal()
}

dependencies {
Expand All @@ -40,7 +41,7 @@ allprojects {
ext.issueUrl = 'https://github.com/' + githubRepoName + '/issues'
ext.website = 'http://radar-base.org'

version = "1.2.4"
version = "$project_version"
group = 'org.radarbase'

ext.versionCode = 52
Expand All @@ -61,7 +62,8 @@ subprojects {
repositories {
google()
mavenCentral()
// maven { url = "https://oss.sonatype.org/content/repositories/snapshots" }
mavenLocal()
maven { url = "https://oss.sonatype.org/content/repositories/snapshots" }
}

dependencies {
Expand Down
9 changes: 6 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,28 @@ org.gradle.parallel=true
org.gradle.vfs.watch=true
kotlin.code.style=official
android.jetifier.ignorelist=jackson-core-2.16.1.jar
android.defaults.buildfeatures.buildconfig=true

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

project_version=1.2.5

java_version=17
kotlin_version=1.9.23
gradle_version=8.7

gradle_android_version=8.3.2
gradle_android_version=8.2.0
unmock_plugin_version=0.7.9
dokka_android_gradle_plugin_version=0.9.18
dokka_version=1.9.20
publish_plugin_version=2.0.0
versions_plugin_version=0.51.0

radar_commons_version=0.15.0
radar_schemas_commons_version=0.8.9
radar_schemas_commons_version=0.8.10-SNAPSHOT

radar_faros_sdk_version=0.1.0

Expand All @@ -44,7 +47,7 @@ appcompat_version=1.6.1
okhttp_version=4.12.0
localbroadcastmanager_version=1.1.0
legacy_support_version=1.0.0
lifecycle_service_version=2.7.0
lifecycle_service_version=2.6.1
firebase_bom_version=32.8.1
slf4j_handroid_version=2.0.4
material_version=1.11.0
Expand Down
2 changes: 1 addition & 1 deletion gradle/android.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
android {
compileSdkVersion 33
buildToolsVersion '34.0.0'
buildToolsVersion '32.0.0'

defaultConfig {
minSdkVersion 26
Expand Down
52 changes: 52 additions & 0 deletions plugins/radar-android-polar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Polar plugin 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 a Polar device.

The plugin application uses Bluetooth Low Energy requirement, making it require coarse location permissions. This plugin does not collect location information.

This plugin connects to a Polar device, of which the deviceId is hardcoded in PolarManager.

This plugin has currently been tested with the Polar H10, Polar Vantage V3 and Polar Verity Sense, of which the following topics are implemented:

| Polar device | Topic | Description |
|--------------------------------|-----------------------------|------------------------------------------------------------|
| Polar H10 | android_polar_battery_level | Battery level |
| | android_polar_heart_rate | Heart rate (bpm) with sample rate 1Hz|
| | android_polar_ecg | Electrocardiography (ECG) data in µV with sample rate 130Hz|
| | android_polar_acceleration | Accelerometer data with a sample rate of 25Hz, a resoltion of 16 and range of 2G. Axis specific acceleration data in mG.|
| Polar Vantage V3 | android_polar_battery_level | Battery level|
| | android_polar_heart_rate | Heart rate (bpm) in 1Hz frequency|
| Polar Verity Sense | android_polar_battery_level | Battery level|
| | android_polar_heart_rate | Heart rate (bpm) with sample rate 1Hz|
| | android_polar_ppg | PPG data with a sample rate of 55Hz, a resolution of 22 using 4 channels. |
| | android_polar_ppi | PP interval representing cardiac pulse-to-pulse interval extracted from PPG signal.|

****
## Installation

To add the plugin code to your app, add the following snippet to your app's `build.gradle` file.

```gradle
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation "org.radarbase:radar-android-polar:$radarCommonsAndroidVersion"
implementation 'com.github.polarofficial:polar-ble-sdk:5.5.0'
implementation 'io.reactivex.rxjava3:rxjava:3.1.6'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.2'
}
```

Add `org.radarbase.passive.polar.PolarProvider` to the `plugins` variable of the `RadarService` instance in your app.

## Configuration

Add the provider `.polar.PolarProvider` to the Firebase Remote Config `plugins` variable.

## Contributing

This plugin was build using the [POLAR BLE SDK][1].

[1]: https://github.com/polarofficial/polar-ble-sdk
34 changes: 34 additions & 0 deletions plugins/radar-android-polar/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apply from: "$rootDir/gradle/android.gradle"

android {
namespace "org.radarbase.passive.polar"
}

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

description = "Polar plugin for RADAR passive remote monitoring app"

//---------------------------------------------------------------------------//
// Sources and classpath configurations //
//---------------------------------------------------------------------------//

repositories {
maven { url "https://jitpack.io" }
}

dependencies {
api project(":radar-commons-android")

implementation "com.github.polarofficial:polar-ble-sdk:5.5.0"
implementation "io.reactivex.rxjava3:rxjava:3.1.6"
implementation "io.reactivex.rxjava3:rxandroid:3.0.2"

implementation group: 'org.joda', name: 'joda-convert', version: '2.0.1', classifier: 'classic'
implementation 'joda-time:joda-time:2.9.4'

testImplementation 'junit:junit:4.13'
}

apply from: "$rootDir/gradle/publishing.gradle"
19 changes: 19 additions & 0 deletions plugins/radar-android-polar/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-feature android:name="android.hardware.bluetooth" android:required="false"/>
<uses-feature android:name="android.hardware.location" android:required="false"/>

<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>

<application android:allowBackup="true">
<service android:name=".PolarService"/>
</application>
</manifest>
Loading

0 comments on commit 1025a68

Please sign in to comment.