summaryrefslogtreecommitdiff
path: root/libs/ihealth-sdk/module/BTMModule.js
blob: d7601d54bdeb55c42c04f3435049f544c6eb7212 (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
/**
 * Created by lixuesong on 11/11/2016.
 */
'use strict';

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

var RCTModule = NativeModules.BTMModule

 /**
  * @module BTMModule
  */
module.exports = {

  Event_Notify: RCTModule.Event_Notify,

  /**
   * Get the BTM battery status.
   * @param {string} mac Device's mac address
   */
  getBattery: function (mac) {
    RCTModule.getBattery(mac)
  },

  /**
   * Get the value of historical data in the BTM.
   * @param {string} mac Device's mac address
   */
  getMemoryData: function (mac) {
    RCTModule.getMemoryData(mac)
  },

  /**
   * Set the standby time
   * @param {string} mac Device's mac address
   * @param {number} hour Standby time hours [0, 23]
   * @param {number} minute Standby time minute [0, 59]
   * @param {number} second Standby time second [0, 59]
   */
  setStandbyTime: function (mac, hour, minute, second) {
    RCTModule.setStandbyTime(mac, hour, minute, second)
  },

  /**
   * Set the temperature unit
   * @param {string} mac Device's mac address
   * @param {number} unit temperature unit<br/>
   *                 <b>The unit of:</b> BtmControl.TEMPERATURE_UNIT_C or BtmControl.TEMPERATURE_UNIT_F
   */
  setTemperatureUnit: function (mac, unit) {
    RCTModule.setTemperatureUnit(mac, unit)
  },

  /**
   * Set the measuring target
   * @param {string} mac Device's mac address
   * @param {number} measuring target
   */
  setMeasuringTarget: function (mac, target) {
    RCTModule.setMeasuringTarget(mac, target)
  },

  /**
   * Set the offline target
   * @param {string} mac Device's mac address
   * @param {number} measuring target
   */
  setOfflineTarget: function (mac, target) {
    RCTModule.setOfflineTarget(mac, target)
  },

  /**
   * Disconnect the BTM
   * @param mac The mac address for BTM
   */
  disconnect: function (mac) {
    RCTModule.disconnect(mac)
  },

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