summaryrefslogtreecommitdiff
path: root/libs/ihealth-sdk/android/src/main/java/com/ihealth/ihealthlibrary/BGProfileModule.java
blob: 256bb132a8db0ba283dc06d26e28726f6c3c05bb (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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
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.Bg5Profile;

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

import javax.annotation.Nullable;

/**
 * Created by gaoyuanlong on 16/11/17.
 */
@ReactModule(name = "BGProfileModule")
public class BGProfileModule extends ReactContextBaseJavaModule {

    private static final String modelName = "BGProfileModule";
    private static final String TAG = modelName;

    private static final String ACTION_KEEP_LINK = "ACTION_KEEP_LINK";
    private static final String ACTION_SET_TIME = "ACTION_SET_TIME";
    private static final String ACTION_SET_UNIT = "ACTION_SET_UNIT";
    private static final String ACTION_GET_BATTERY = "ACTION_GET_BATTERY";
    private static final String ACTION_START_MEASURE = "ACTION_START_MEASURE";
    private static final String ACTION_GET_OFFLINEDATA_COUNT = "ACTION_GET_OFFLINEDATA_COUNT";
    private static final String ACTION_GET_OFFLINEDATA = "ACTION_GET_OFFLINEDATA";
    private static final String ACTION_DELETE_OFFLINEDATA = "ACTION_DELETE_OFFLINEDATA";
    private static final String ACTION_SET_BOTTLEMESSAGE = "ACTION_SET_BOTTLEMESSAGE";
    private static final String ACTION_GET_BOTTLEMESSAGE = "ACTION_GET_BOTTLEMESSAGE";
    private static final String ACTION_SET_BOTTLEID = "ACTION_SET_BOTTLEID";
    private static final String ACTION_GET_BOTTLEID = "ACTION_GET_BOTTLEID";
    private static final String ACTION_ERROR_BG = "ACTION_ERROR_BG";
    private static final String ACTION_STRIP_IN = "ACTION_STRIP_IN";
    private static final String ACTION_STRIP_OUT = "ACTION_STRIP_OUT";
    private static final String ACTION_GET_BLOOD = "ACTION_GET_BLOOD";
    private static final String ACTION_ONLINE_RESULT_BG = "ACTION_ONLINE_RESULT_BG";


//    private static final String KEEP_LINK = "KEEP_LINK";
//    private static final String SET_TIME = "SET_TIME";
//    private static final String SET_UNIT = "SET_UNIT";
    private static final String GET_BATTERY = "GET_BATTERY";
//    private static final String START_MEASURE = "START_MEASURE";
    private static final String GET_OFFLINEDATA_COUNT = "GET_OFFLINEDATA_COUNT";
    private static final String GET_OFFLINEDATA = "GET_OFFLINEDATA";
//    private static final String DELETE_OFFLINEDATA = "DELETE_OFFLINEDATA";
    private static final String SET_BOTTLEMESSAGE = "SET_BOTTLEMESSAGE";
    private static final String START_MODE = "START_MODE";
    private static final String GET_EXPIRECTIME = "GET_EXPIRECTIME";
    private static final String GET_USENUM = "GET_USENUM";
//    private static final String SET_BOTTLEID = "SET_BOTTLEID";
    private static final String GET_BOTTLEID = "GET_BOTTLEID";
    private static final String ERROR_NUM_BG = "ERROR_NUM_BG";
    private static final String ERROR_DESCRIPTION_BG = "ERROR_DESCRIPTION_BG";
    private static final String ONLINE_RESULT_BG = "ONLINE_RESULT_BG";
    private static final String DATA_ID = "DATA_ID";

    /**
     * Callback indicating the code analysis result.
     */
    private static final String ACTION_CODE_ANALYSIS = "ACTION_CODE_ANALYSIS";


    /**
     * the strip number
     */
    private static final String STRIP_NUM_BG = "STRIP_NUM_BG";


    /**
     * the expire time
     */
    private static final String STRIP_EXPIRETIME_BG = "STRIP_EXPIRETIME_BG";


    /**
     * the bottle id
     */
    private static final String BOTTLEID_BG = "BOTTLEID_BG";

    private static final String ACTION_GET_ALL_CONNECTED_DEVICES = "ACTION_GET_ALL_CONNECTED_DEVICES";


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

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

    @Nullable
    @Override
    public Map<String, Object> getConstants() {

        final Map<String, Object> constants = new HashMap<>();

        constants.put(ACTION_KEEP_LINK, Bg5Profile.ACTION_KEEP_LINK);
        constants.put(ACTION_SET_TIME, Bg5Profile.ACTION_SET_TIME);
        constants.put(ACTION_SET_UNIT, Bg5Profile.ACTION_SET_UNIT);
        constants.put(ACTION_GET_BATTERY, Bg5Profile.ACTION_BATTERY_BG);
        constants.put(ACTION_START_MEASURE, Bg5Profile.ACTION_START_MEASURE);
        constants.put(ACTION_GET_OFFLINEDATA_COUNT, Bg5Profile.ACTION_HISTORICAL_NUM_BG);
        constants.put(ACTION_GET_OFFLINEDATA, Bg5Profile.ACTION_HISTORICAL_DATA_BG);
        constants.put(ACTION_DELETE_OFFLINEDATA, Bg5Profile.ACTION_DELETE_HISTORICAL_DATA);
        constants.put(ACTION_SET_BOTTLEMESSAGE, Bg5Profile.ACTION_SET_BOTTLE_MESSAGE_SUCCESS);
        constants.put(ACTION_GET_BOTTLEMESSAGE, Bg5Profile.ACTION_GET_CODEINFO);
        constants.put(ACTION_SET_BOTTLEID, Bg5Profile.ACTION_SET_BOTTLE_ID_SUCCESS);
        constants.put(ACTION_GET_BOTTLEID, Bg5Profile.ACTION_GET_BOTTLEID);
        constants.put(ACTION_ERROR_BG, Bg5Profile.ACTION_ERROR_BG);
        constants.put(ACTION_STRIP_IN, Bg5Profile.ACTION_STRIP_IN);
        constants.put(ACTION_STRIP_OUT, Bg5Profile.ACTION_STRIP_OUT);
        constants.put(ACTION_GET_BLOOD, Bg5Profile.ACTION_GET_BLOOD);
        constants.put(ACTION_ONLINE_RESULT_BG, Bg5Profile.ACTION_ONLINE_RESULT_BG);


//        constants.put(KEEP_LINK, Bg5Profile.KEEP_LINK);
//        constants.put(SET_TIME, Bg5Profile.SET_TIME);
//        constants.put(SET_UNIT, Bg5Profile.SET_UNIT);
        constants.put(GET_BATTERY, Bg5Profile.BATTERY_BG);
//        constants.put(START_MEASURE, Bg5Profile.START_MEASURE);
        constants.put(GET_OFFLINEDATA_COUNT, Bg5Profile.HISTORICAL_NUM_BG);
        constants.put(GET_OFFLINEDATA, Bg5Profile.HISTORICAL_DATA_BG);
//        constants.put(DELETE_OFFLINEDATA, Bg5Profile.DELETE_HISTORICAL_DATA);
        constants.put(SET_BOTTLEMESSAGE, Bg5Profile.SET_BOTTLE_MESSAGE);
        constants.put(START_MODE,Bg5Profile.START_MODE_EXTRA);
        constants.put(GET_EXPIRECTIME, Bg5Profile.GET_EXPIRECTIME);
        constants.put(GET_USENUM, Bg5Profile.GET_USENUM);
        constants.put(GET_BOTTLEID, Bg5Profile.GET_BOTTLEID);
//        constants.put(SET_BOTTLEID, Bg5Profile.SET_BOTTLE_MESSAGE);
        constants.put(ERROR_NUM_BG, Bg5Profile.ERROR_NUM_BG);
        constants.put(ERROR_DESCRIPTION_BG, Bg5Profile.ERROR_DESCRIPTION_BG);
        constants.put(ONLINE_RESULT_BG, Bg5Profile.ONLINE_RESULT_BG);
        constants.put(DATA_ID, Bg5Profile.DATA_ID);

        constants.put(ACTION_CODE_ANALYSIS, "action_code_analysis");
        constants.put(STRIP_NUM_BG, "strip_num");
        constants.put(STRIP_EXPIRETIME_BG, "expire_time");
        constants.put(BOTTLEID_BG, "bottle_id");
        constants.put(ACTION_GET_ALL_CONNECTED_DEVICES, iHealthBaseModule.ACTION_GET_ALL_CONNECTED_DEVICES);
        return constants;
    }
}