react-native-polar-bridge 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package com.polarbridge
|
|
2
2
|
|
|
3
3
|
import android.util.Log
|
|
4
|
+
import androidx.annotation.Nullable
|
|
4
5
|
import com.facebook.react.bridge.*
|
|
5
6
|
import com.facebook.react.module.annotations.ReactModule
|
|
6
7
|
import com.polar.sdk.api.PolarBleApi
|
|
@@ -624,9 +625,14 @@ class PolarBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
624
625
|
val timestampMs: Long
|
|
625
626
|
)
|
|
626
627
|
|
|
627
|
-
|
|
628
|
+
@ReactMethod
|
|
629
|
+
override fun fetchHrData(deviceId: String, @Nullable ms: Double?) {
|
|
628
630
|
Log.e(TAG, "Fetch Heart Data called on: $deviceId ")
|
|
629
|
-
val bufferMs = ms
|
|
631
|
+
val bufferMs: Long = if (ms != null && ms >= 0) {
|
|
632
|
+
ms.toLong()
|
|
633
|
+
} else {
|
|
634
|
+
SENSOR_BUFFER_MS
|
|
635
|
+
}
|
|
630
636
|
val isDisposed = hrDisposable?.isDisposed ?: true
|
|
631
637
|
try{
|
|
632
638
|
if (isDisposed) {
|
|
@@ -731,9 +737,14 @@ class PolarBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
731
737
|
}
|
|
732
738
|
}
|
|
733
739
|
|
|
734
|
-
|
|
740
|
+
@ReactMethod
|
|
741
|
+
override fun fetchAccData(deviceId: String, @Nullable ms: Double?) {
|
|
735
742
|
Log.e(TAG, "Fetch Accelerometer Data called on: $deviceId ")
|
|
736
|
-
val bufferMs = ms
|
|
743
|
+
val bufferMs: Long = if (ms != null && ms >= 0) {
|
|
744
|
+
ms.toLong()
|
|
745
|
+
} else {
|
|
746
|
+
SENSOR_BUFFER_MS
|
|
747
|
+
}
|
|
737
748
|
val isDisposed = accDisposable?.isDisposed ?: true
|
|
738
749
|
try{
|
|
739
750
|
if (isDisposed) {
|
|
@@ -788,9 +799,14 @@ class PolarBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
788
799
|
}
|
|
789
800
|
}
|
|
790
801
|
|
|
791
|
-
|
|
802
|
+
@ReactMethod
|
|
803
|
+
override fun fetchGyrData(deviceId: String, @Nullable ms: Double?) {
|
|
792
804
|
Log.e(TAG, "Fetch Gyroscope Data called on: $deviceId ")
|
|
793
|
-
val bufferMs = ms
|
|
805
|
+
val bufferMs: Long = if (ms != null && ms >= 0) {
|
|
806
|
+
ms.toLong()
|
|
807
|
+
} else {
|
|
808
|
+
SENSOR_BUFFER_MS
|
|
809
|
+
}
|
|
794
810
|
val isDisposed = gyrDisposable?.isDisposed ?: true
|
|
795
811
|
try {
|
|
796
812
|
if (isDisposed) {
|
|
@@ -847,9 +863,14 @@ class PolarBridgeModule(reactContext: ReactApplicationContext) :
|
|
|
847
863
|
}
|
|
848
864
|
}
|
|
849
865
|
|
|
850
|
-
|
|
866
|
+
@ReactMethod
|
|
867
|
+
override fun fetchPpgData(deviceId: String, @Nullable ms: Double?) {
|
|
851
868
|
Log.e(TAG, "Fetch Photoplethysmograph Data called on: $deviceId ")
|
|
852
|
-
val bufferMs = ms
|
|
869
|
+
val bufferMs: Long = if (ms != null && ms >= 0) {
|
|
870
|
+
ms.toLong()
|
|
871
|
+
} else {
|
|
872
|
+
SENSOR_BUFFER_MS
|
|
873
|
+
}
|
|
853
874
|
val isDisposed = ppgDisposable?.isDisposed ?: true
|
|
854
875
|
try {
|
|
855
876
|
if (isDisposed) {
|