wangzhibo
4 天以前 ae6f40460dcd56af6c5f60ba52c883854c3bac55
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
/*  Copyright (C) 2022-2024 José Rebelo
 
    This file is part of Gadgetbridge.
 
    Gadgetbridge is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published
    by the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
 
    Gadgetbridge is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.
 
    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.devices.huami;
 
public class Huami2021Service {
    /**
     * Endpoints for 2021 chunked protocol
     */
    public static final short CHUNKED2021_ENDPOINT_WEATHER = 0x000e;
    public static final short CHUNKED2021_ENDPOINT_CONNECTION = 0x0015;
    public static final short CHUNKED2021_ENDPOINT_USER_INFO = 0x0017;
    public static final short CHUNKED2021_ENDPOINT_STEPS = 0x0016;
    public static final short CHUNKED2021_ENDPOINT_VIBRATION_PATTERNS = 0x0018;
    public static final short CHUNKED2021_ENDPOINT_WORKOUT = 0x0019;
    public static final short CHUNKED2021_ENDPOINT_FIND_DEVICE = 0x001a;
    public static final short CHUNKED2021_ENDPOINT_HEARTRATE = 0x001d;
    public static final short CHUNKED2021_ENDPOINT_BATTERY = 0x0029;
    public static final short CHUNKED2021_ENDPOINT_SILENT_MODE = 0x003b;
    public static final short CHUNKED2021_ENDPOINT_AUTH = 0x0082;
    public static final short CHUNKED2021_ENDPOINT_COMPAT = 0x0090;
 
    /**
     * Find Device, for {@link Huami2021Service#CHUNKED2021_ENDPOINT_FIND_DEVICE}.
     */
    public static final byte FIND_BAND_START = 0x03;
    public static final byte FIND_BAND_ACK = 0x04;
    public static final byte FIND_BAND_STOP_FROM_PHONE = 0x06;
    public static final byte FIND_BAND_STOP_FROM_BAND = 0x07;
    public static final byte FIND_PHONE_START = 0x11;
    public static final byte FIND_PHONE_ACK = 0x12;
    public static final byte FIND_PHONE_STOP_FROM_BAND = 0x13;
    public static final byte FIND_PHONE_STOP_FROM_PHONE = 0x14;
    public static final byte FIND_PHONE_MODE = 0x15;
 
    /**
     * Steps, for {@link Huami2021Service#CHUNKED2021_ENDPOINT_STEPS}.
     */
    public static final byte STEPS_CMD_GET = 0x03;
    public static final byte STEPS_CMD_REPLY = 0x04;
    public static final byte STEPS_CMD_ENABLE_REALTIME = 0x05;
    public static final byte STEPS_CMD_ENABLE_REALTIME_ACK = 0x06;
    public static final byte STEPS_CMD_REALTIME_NOTIFICATION = 0x07;
 
    /**
     * Vibration Patterns, for {@link Huami2021Service#CHUNKED2021_ENDPOINT_VIBRATION_PATTERNS}.
     */
    public static final byte VIBRATION_PATTERN_SET = 0x03;
    public static final byte VIBRATION_PATTERN_ACK = 0x04;
 
    /**
     * Battery, for {@link Huami2021Service#CHUNKED2021_ENDPOINT_BATTERY}.
     */
    public static final byte BATTERY_REQUEST = 0x03;
    public static final byte BATTERY_REPLY = 0x04;
 
    /**
     * Silent Mode, for {@link Huami2021Service#CHUNKED2021_ENDPOINT_SILENT_MODE}.
     */
    public static final byte SILENT_MODE_CMD_CAPABILITIES_REQUEST = 0x01;
    public static final byte SILENT_MODE_CMD_CAPABILITIES_RESPONSE = 0x02;
    // Notify silent mode, from phone
    public static final byte SILENT_MODE_CMD_NOTIFY_BAND = 0x03;
    public static final byte SILENT_MODE_CMD_NOTIFY_BAND_ACK = 0x04;
    // Query silent mode on phone, from band
    public static final byte SILENT_MODE_CMD_QUERY = 0x05;
    public static final byte SILENT_MODE_CMD_REPLY = 0x06;
    // Set silent mode on phone, from band
    // After this, phone sends ACK + NOTIFY
    public static final byte SILENT_MODE_CMD_SET = 0x07;
    public static final byte SILENT_MODE_CMD_ACK = 0x08;
 
    /**
     * Connection, for {@link Huami2021Service#CHUNKED2021_ENDPOINT_CONNECTION}.
     */
    public static final byte CONNECTION_CMD_MTU_REQUEST = 0x01;
    public static final byte CONNECTION_CMD_MTU_RESPONSE = 0x02;
    public static final byte CONNECTION_CMD_UNKNOWN_3 = 0x03;
    public static final byte CONNECTION_CMD_UNKNOWN_4 = 0x04;
 
    /**
     * Notifications, for {@link Huami2021Service#CHUNKED2021_ENDPOINT_HEARTRATE}.
     */
    public static final byte HEART_RATE_CMD_REALTIME_SET = 0x04;
    public static final byte HEART_RATE_CMD_REALTIME_ACK = 0x05;
    public static final byte HEART_RATE_CMD_SLEEP = 0x06;
    public static final byte HEART_RATE_FALL_ASLEEP = 0x01;
    public static final byte HEART_RATE_WAKE_UP = 0x00;
    public static final byte HEART_RATE_REALTIME_MODE_STOP = 0x00;
    public static final byte HEART_RATE_REALTIME_MODE_START = 0x01;
    public static final byte HEART_RATE_REALTIME_MODE_CONTINUE = 0x02;
 
    /**
     * Workout, for {@link Huami2021Service#CHUNKED2021_ENDPOINT_WORKOUT}.
     */
    public static final byte WORKOUT_CMD_GPS_LOCATION = 0x04;
    public static final byte WORKOUT_CMD_APP_OPEN = 0x20;
    public static final byte WORKOUT_CMD_STATUS = 0x11;
    public static final int WORKOUT_GPS_FLAG_STATUS = 0x1;
    public static final int WORKOUT_GPS_FLAG_POSITION = 0x40000;
    public static final byte WORKOUT_STATUS_START = 0x01;
    public static final byte WORKOUT_STATUS_END = 0x04;
 
    /**
     * Weather, for {@link Huami2021Service#CHUNKED2021_ENDPOINT_WEATHER}.
     */
    public static final byte WEATHER_CMD_SET_DEFAULT_LOCATION = 0x09;
    public static final byte WEATHER_CMD_DEFAULT_LOCATION_ACK = 0x0a;
 
    /**
     * User Info, for {@link Huami2021Service#CHUNKED2021_ENDPOINT_USER_INFO}.
     */
    public static final byte USER_INFO_CMD_SET = 0x01;
    public static final byte USER_INFO_CMD_SET_ACK = 0x02;
 
    /**
     * Raw sensor control.
     */
    public static final byte[] CMD_RAW_SENSOR_START_1 = new byte[]{0x01, 0x03, 0x19}; // band replies 10:01:03:05
    public static final byte[] CMD_RAW_SENSOR_START_2 = new byte[]{0x01, 0x03, 0x00, 0x00, 0x00, 0x19}; // band replies 10:01:01:05
    public static final byte[] CMD_RAW_SENSOR_START_3 = new byte[]{0x02}; // band replies 10:02:01
    public static final byte[] CMD_RAW_SENSOR_STOP = new byte[]{0x03}; // band replies 10:03:01
}