summaryrefslogtreecommitdiff
path: root/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BTMProfileModule.java
blob: 49490933d180996944adead1885c256468891650 (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
package com.ihealth.ihealthlibrary;

import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.module.annotations.ReactModule;
import com.ihealth.communication.control.BtmProfile;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Nullable;

/**
 * Created by lixuesong on 15/11/2016.
 */
@ReactModule(name = "BTMProfileModule")
public class BTMProfileModule extends ReactContextBaseJavaModule {
    private static final String modelName = "BTMProfileModule";
    private static final String TAG = "BTMProfileModule";

    private static final String ACTION_BTM_BATTERY = "ACTION_BTM_BATTERY";
    private static final String BTM_BATTERY = "BTM_BATTERY";

    private static final String ACTION_BTM_MEMORY = "ACTION_BTM_MEMORY";
    private static final String MEMORY_COUNT = "MEMORY_COUNT";
    private static final String BTM_TEMPERATURE_ARRAY = "BTM_TEMPERATURE_ARRAY";
    private static final String BTM_TEMPERATURE = "BTM_TEMPERATURE";
    private static final String BTM_TEMPERATURE_TARGET = "BTM_TEMPERATURE_TARGET";
    private static final String BTM_MEASURE_TIME = "BTM_MEASURE_TIME";

    private static final String ACTION_BTM_MEASURE = "ACTION_BTM_MEASURE";

    private static final String ACTION_BTM_CALLBACK = "ACTION_BTM_CALLBACK";

    private static final String ACTION_ERROR_BTM = "ACTION_ERROR_BTM";
    private static final String ERROR_NUM_BTM = "ERROR_NUM_BTM";
    private static final String ERROR_DESCRIPTION_BTM = "ERROR_DESCRIPTION_BTM";
    private static final String ACTION_GET_ALL_CONNECTED_DEVICES = "ACTION_GET_ALL_CONNECTED_DEVICES";


    public BTMProfileModule(ReactApplicationContext reactContext) {
        super(reactContext);
    }

    @Override
    public String getName() {
        return modelName;
    }

    @Nullable
    @Override
    public Map<String, Object> getConstants() {
        Map<String, Object> constants = new HashMap<>();
        constants.put(ACTION_BTM_BATTERY, BtmProfile.ACTION_BTM_BATTERY);
        constants.put(BTM_BATTERY, BtmProfile.BTM_BATTERY);

        constants.put(ACTION_BTM_MEMORY, BtmProfile.ACTION_BTM_MEMORY);
        constants.put(MEMORY_COUNT, BtmProfile.MEMORY_COUNT);
        constants.put(BTM_TEMPERATURE_ARRAY, BtmProfile.BTM_TEMPERATURE_ARRAY);
        constants.put(BTM_TEMPERATURE, BtmProfile.BTM_TEMPERATURE);
        constants.put(BTM_TEMPERATURE_TARGET, BtmProfile.BTM_TEMPERATURE_TARGET);
        constants.put(BTM_MEASURE_TIME, BtmProfile.BTM_MEASURE_TIME);

        constants.put(ACTION_BTM_MEASURE, BtmProfile.ACTION_BTM_MEASURE);

        constants.put(ACTION_BTM_CALLBACK, BtmProfile.ACTION_BTM_CALLBACK);

        constants.put(ACTION_ERROR_BTM, BtmProfile.ACTION_ERROR_BTM);
        constants.put(ERROR_NUM_BTM, BtmProfile.ERROR_NUM_BTM);
        constants.put(ERROR_DESCRIPTION_BTM, BtmProfile.ERROR_DESCRIPTION_BTM);
        constants.put(ACTION_GET_ALL_CONNECTED_DEVICES, iHealthBaseModule.ACTION_GET_ALL_CONNECTED_DEVICES);
        return constants;
    }
}