summaryrefslogtreecommitdiff
path: root/libs/ihealth-sdk/module/ECGUSBModule.js
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ihealth-sdk/module/ECGUSBModule.js')
-rwxr-xr-xlibs/ihealth-sdk/module/ECGUSBModule.js119
1 files changed, 119 insertions, 0 deletions
diff --git a/libs/ihealth-sdk/module/ECGUSBModule.js b/libs/ihealth-sdk/module/ECGUSBModule.js
new file mode 100755
index 0000000..29e3a17
--- /dev/null
+++ b/libs/ihealth-sdk/module/ECGUSBModule.js
@@ -0,0 +1,119 @@
1/**
2 *
3 */
4'use strict';
5
6var { NativeModules, Platform } = require('react-native');
7
8var RCTModule = NativeModules.ECGUSBModule
9
10/**
11 * @module ECGUSBModule
12 */
13module.exports = {
14 /**
15 * Notify event type for ECG
16 */
17 Event_Notify: RCTModule.Event_Notify,
18
19 /**
20 * SyncTime.
21 */
22 syncData: function () {
23 RCTModule.syncData()
24 },
25
26 /**
27 * deleteData.
28 */
29 deleteData: function () {
30 RCTModule.deleteData()
31 },
32
33 /**
34 * Get all connected ECG device
35 *
36 * e.g. {"devices":"A4D5783FB00C"}
37 */
38 getAllConnectedDevices: function () {
39 RCTModule.getAllConnectedDevices()
40 },
41
42 /**
43 * Get device idps info (only for android)
44 *
45 * e.g. {"firmwareversion":"1.2.6","serialnumber":"F26265594E00","modenumber":"ECG3 11070","hardwareversion":"3.1.0","manufacture":"iHealth","accessoryname":"ECG recorder","protocolstring":"com.jiuan.ECGV10"}
46 */
47 getIdps: function () {
48 RCTModule.getIdps()
49 },
50
51 /**
52 * Splicing original files
53 *
54 * You can add a listener for ECGProfileModule.ACTION_SPLICE;
55 *
56 * success example:
57 *
58 * {"action":ECGProfileModule.ACTION_SPLICE,ECGProfileModule.SPLICE_DATA:{"DataFileName":"ECG_Total_Data_yyyyMMddHHmmss.dat","MarkFileName":"ECG_Total_Mark_yyyyMMddHHmmss.txt","StartTime":"yyyyMMddHHmmss","EndTime":"yyyyMMddHHmmss","FilePath":"xxx"},"type":"ECG3USB","mac":"F26265594E00"}
59 *
60 * fail example:
61 *
62 * {"action":ECGProfileModule.ACTION_SPLICE,ECGProfileModule.SPLICE_ERROR_DESCRIPTION:"fileNames's length is less than 1.","type":"ECG3USB","mac":""}
63 *
64 *
65 */
66 spliceData: function (filesNames){
67 RCTModule.spliceData(filesNames)
68 },
69
70
71 /**
72 * Get cache
73 *
74 * You can add a listener for ECGProfileModule.ACTION_GET_CACHE;
75 *
76 * result example:
77 *
78 * {"action":ECGProfileModule.ACTION_GET_CACHE,ECGProfileModule.GET_CACHE_DATA:[see ECGProfileModule.DATAINFO],"type":"ECG3USB","mac":"F26265594E00"}
79 *
80 */
81 getCache: function () {
82 RCTModule.getCache()
83 },
84
85 /**
86 * Delete cache files
87 * only android
88 * if you get the cache files of ECG, you should clear the cache files
89 */
90 deleteCacheData: function (){
91 if (Platform.OS === 'ios'){
92 console.log('deleteCacheData is not available in iOS.')
93 } else {
94 RCTModule.deleteCacheData()
95 }
96 },
97
98 /**
99 * get ECG filter files by filename
100 *
101 * you can edit "ECG_Data_20180930123000" and "ECG_Mark_20180930123000"
102 * or can edit "ECG_Total_Data_20180930123000" and "ECG_Mark_Data_20180930123000"
103 *
104 * You can add a listener for ECGProfileModule.ACTION_FILTER;
105 *
106 * success example:
107 *
108 * {"action":ECGProfileModule.ACTION_FILTER,ECGProfileModule.FILTER_DATA:[{"SampleRate":249.999999,"FileName":"ECG_SDK_yyyyMMddHHmmss","StartTime":"yyyyMMddHHmmss","EndTime":"yyyyMMddHHmmss","FilePath":"xxx"}],"type":"ECG3USB","mac":"F26265594E00"}
109 *
110 * fail example:
111 *
112 * {"action":ECGProfileModule.ACTION_FILTER,ECGProfileModule.FILTER_ERROR_DESCRIPTION:"input parameter is invalid.","type":"ECG3USB","mac":"F26265594E00"}
113 *
114 *
115 */
116 getFilterDataByFileName: function (dataFileName ,markFileName){
117 RCTModule.getFilterDataByFileName(dataFileName,markFileName)
118 }
119}