summaryrefslogtreecommitdiff
path: root/libs/ihealth-sdk/module/ECGUSBModule.js
blob: 29e3a178eebb6448cee92e53975968fb983ec13f (plain)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/**
 *
 */
'use strict';

var { NativeModules, Platform } = require('react-native');

var RCTModule = NativeModules.ECGUSBModule

/**
 * @module ECGUSBModule
 */
module.exports = {
  /**
   * Notify event type for ECG
   */
  Event_Notify: RCTModule.Event_Notify,

  /**
   * SyncTime.
   */
  syncData: function () {
    RCTModule.syncData()
  },

  /**
   * deleteData.
   */
  deleteData: function () {
    RCTModule.deleteData()
  },

  /**
   * Get all connected ECG device
   *
   * e.g. {"devices":"A4D5783FB00C"}
   */
  getAllConnectedDevices: function () {
    RCTModule.getAllConnectedDevices()
  },

  /**
  * Get device idps info (only for android)
  *
  * e.g. {"firmwareversion":"1.2.6","serialnumber":"F26265594E00","modenumber":"ECG3 11070","hardwareversion":"3.1.0","manufacture":"iHealth","accessoryname":"ECG recorder","protocolstring":"com.jiuan.ECGV10"}
  */
  getIdps: function () {
    RCTModule.getIdps()
  },

  /**
   * Splicing original files
  *
  * You can add a listener for ECGProfileModule.ACTION_SPLICE;
  *
  * success example:
  *
  * {"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"}
  *
  * fail example:
  *
  * {"action":ECGProfileModule.ACTION_SPLICE,ECGProfileModule.SPLICE_ERROR_DESCRIPTION:"fileNames's length is less than 1.","type":"ECG3USB","mac":""}
  *
  *
  */
  spliceData: function (filesNames){
    RCTModule.spliceData(filesNames)
  },


  /**
   * Get cache
   *
   * You can add a listener for ECGProfileModule.ACTION_GET_CACHE;
   *
   * result example:
   *
   * {"action":ECGProfileModule.ACTION_GET_CACHE,ECGProfileModule.GET_CACHE_DATA:[see ECGProfileModule.DATAINFO],"type":"ECG3USB","mac":"F26265594E00"}
   *
   */
  getCache: function () {
      RCTModule.getCache()
  },

  /**
   * Delete cache files
   * only android
   * if you get the cache files of ECG, you should clear the cache files
   */
  deleteCacheData: function (){
    if (Platform.OS === 'ios'){
      console.log('deleteCacheData is not available in iOS.')
    } else {
      RCTModule.deleteCacheData()
    }
  },

  /**
   * get ECG filter files by filename
   *
   * you can edit "ECG_Data_20180930123000" and "ECG_Mark_20180930123000"
   * or  can edit "ECG_Total_Data_20180930123000" and "ECG_Mark_Data_20180930123000"
   *
   * You can add a listener for ECGProfileModule.ACTION_FILTER;
   *
   * success example:
   *
   * {"action":ECGProfileModule.ACTION_FILTER,ECGProfileModule.FILTER_DATA:[{"SampleRate":249.999999,"FileName":"ECG_SDK_yyyyMMddHHmmss","StartTime":"yyyyMMddHHmmss","EndTime":"yyyyMMddHHmmss","FilePath":"xxx"}],"type":"ECG3USB","mac":"F26265594E00"}
   *
   * fail example:
   *
   * {"action":ECGProfileModule.ACTION_FILTER,ECGProfileModule.FILTER_ERROR_DESCRIPTION:"input parameter is invalid.","type":"ECG3USB","mac":"F26265594E00"}
   *
   *
   */
  getFilterDataByFileName: function (dataFileName ,markFileName){
      RCTModule.getFilterDataByFileName(dataFileName,markFileName)
  }
}