summaryrefslogtreecommitdiff
path: root/libs/ihealth-sdk/module/BP5SModule.js
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ihealth-sdk/module/BP5SModule.js')
-rwxr-xr-xlibs/ihealth-sdk/module/BP5SModule.js139
1 files changed, 139 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/module/BP5SModule.js b/libs/ihealth-sdk/module/BP5SModule.js
new file mode 100755
index 0000000..9c115ea
--- /dev/null
+++ b/libs/ihealth-sdk/module/BP5SModule.js
@@ -0,0 +1,139 @@
1/**
2 * Created by chenxuewei on 04/05/2019.
3 */
4
5'use strict';
6
7
8var { NativeModules, Platform } = require('react-native');
9
10var RCTModule = NativeModules.BP5SModule;
11
12/**
13 * @module BP5SModule
14 */
15
16module.exports = {
17
18 Event_Notify: RCTModule.Event_Notify,
19
20 startMeasure: (mac) => {
21 if (RCTModule != null) {
22 RCTModule.startMeasure(mac);
23 }else {
24 console.log('~~~~~ RCTModule is null')
25 }
26 },
27
28 stopMeasure: (mac) => {
29 if (RCTModule != null) {
30 RCTModule.stopMeasure(mac);
31 }else {
32 console.log('~~~~~ RCTModule is null')
33 }
34
35 },
36
37 deleteData: (mac) => {
38 if (RCTModule != null) {
39 RCTModule.deleteData(mac);
40 }else {
41 console.log('~~~~~ RCTModule is null')
42 }
43 },
44
45 enbleOffline: (mac, mode) => {
46 if (RCTModule != null) {
47 RCTModule.enbleOffline(mac, mode);
48 }else {
49 console.log('~~~~~ RCTModule is null')
50 }
51 },
52
53
54 /**
55 * Get the BP7S device's battery.
56 * @param {string} mac Device's mac address
57 */
58 getBattery: (mac) => {
59 if (RCTModule != null) {
60 RCTModule.getBattery(mac);
61 }else {
62 console.log('~~~~~ RCTModule is null')
63 }
64 },
65
66 /**
67 * get offline data number.
68 * @param {string} mac Device's mac address
69 */
70 getOffLineNum: (mac) => {
71 if (RCTModule != null) {
72 RCTModule.getOffLineNum(mac);
73 }else {
74 console.log('~~~~~ RCTModule is null')
75 }
76 },
77
78 /**
79 * get offline data number.
80 * @param {string} mac Device's mac address
81 */
82 getOffLineData: (mac) => {
83 if (RCTModule != null) {
84 RCTModule.getOffLineData(mac);
85 }else {
86 console.log('~~~~~ RCTModule is null')
87 }
88 },
89
90 /**
91 * Set BP7S device unit.
92 * @param {string} mac Device's mac address
93 * @param {int} unit 0:mmHg,1:kPa
94 */
95 setUnit: (mac, unit) => {
96 if (RCTModule != null) {
97 RCTModule.setUnit(mac, unit);
98 }else {
99 console.log('~~~~~ RCTModule is null')
100 }
101 },
102
103 /**
104 * Get the BP7S device's functionInfo.
105 * @param {string} mac Device's mac address
106 */
107
108 getFunctionInfo: (mac) => {
109 if (RCTModule != null) {
110 RCTModule.getFunctionInfo(mac);
111 }else {
112 console.log('~~~~~ RCTModule is null')
113 }
114 },
115
116
117 /**
118 * Disconnect the BP5S
119 *
120 * @param {string} mac Device's mac address
121 */
122
123 disconnect: (mac) => {
124 if (RCTModule != null) {
125 RCTModule.disconnect(mac);
126 }else {
127 console.log('~~~~~ RCTModule is null')
128 }
129 },
130
131 /**
132 * Get all connected BP5S device
133 *
134 * e.g. {"devices":["A4D5783FB00C","A4D5783FFE58"]}
135 */
136 getAllConnectedDevices: () => {
137 RCTModule.getAllConnectedDevices()
138 }
139};