-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
77 lines (55 loc) · 1.68 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import { NativeModules, Platform } from 'react-native';
// todo :
// add an abstraction layer on top of this very rough api using a map of
// device instances (see how it's done in OpenHealthBandReactNativeApp) and emit
// events from them ? or KISS like this ?
const { PolarBleSdkModule } = NativeModules;
class PolarBleSdk {
constructor() {
// todo ?
}
////////// CONNECTION
connectToDevice(deviceId) {
PolarBleSdkModule.connectToDevice(deviceId);
}
disconnectFromDevice(deviceId) {
PolarBleSdkModule.disconnectFromDevice(deviceId);
}
////////// ECG STREAMING
startEcgStreaming(deviceId) {
PolarBleSdkModule.startEcgStreaming(deviceId);
}
stopEcgStreaming(deviceId) {
PolarBleSdkModule.stopEcgStreaming(deviceId);
}
////////// ACCELEROMETER STREAMING
startAccStreaming(deviceId) {
PolarBleSdkModule.startAccStreaming(deviceId);
}
stopAccStreaming(deviceId) {
PolarBleSdkModule.stopAccStreaming(deviceId);
}
////////// PPG STREAMING
startPpgStreaming(deviceId) {
PolarBleSdkModule.startPpgStreaming(deviceId);
}
stopPpgStreaming(deviceId) {
PolarBleSdkModule.stopPpgStreaming(deviceId);
}
////////// PPI STREAMING
startPpiStreaming(deviceId) {
PolarBleSdkModule.startPpiStreaming(deviceId);
}
stopPpiStreaming(deviceId) {
PolarBleSdkModule.stopPpiStreaming(deviceId);
}
////////// OTHER
sampleMethod(number, string, callback) {
PolarBleSdkModule.sampleMethod(number, string, callback);
}
// addListener(event, callback) {
// // return polarEmitter.addListener(event, callback);
// }
}
export default new PolarBleSdk();
// export default PolarBleSdkModule;