forked from creotiv/MiBand2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.py
78 lines (52 loc) · 2.29 KB
/
constants.py
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
___all__ = ['UUIDS']
class Immutable(type):
def __call__(*args):
raise Exception("You can't create instance of immutable object")
def __setattr__(*args):
raise Exception("You can't modify immutable object")
class UUIDS(object):
__metaclass__ = Immutable
BASE = "0000%s-0000-1000-8000-00805f9b34fb"
SERVICE_MIBAND1 = BASE % 'fee0'
SERVICE_MIBAND2 = BASE % 'fee1'
SERVICE_ALERT = BASE % '1802'
SERVICE_ALERT_NOTIFICATION = BASE % '1811'
SERVICE_HEART_RATE = BASE % '180d'
SERVICE_DEVICE_INFO = BASE % '180a'
CHARACTERISTIC_HZ = "00000002-0000-3512-2118-0009af100700"
CHARACTERISTIC_SENSOR = "00000001-0000-3512-2118-0009af100700"
CHARACTERISTIC_AUTH = "00000009-0000-3512-2118-0009af100700"
CHARACTERISTIC_HEART_RATE_MEASURE = "00002a37-0000-1000-8000-00805f9b34fb"
CHARACTERISTIC_HEART_RATE_CONTROL = "00002a39-0000-1000-8000-00805f9b34fb"
CHARACTERISTIC_ALERT = "00002a06-0000-1000-8000-00805f9b34fb"
CHARACTERISTIC_BATTERY = "00000006-0000-3512-2118-0009af100700"
CHARACTERISTIC_STEPS = "00000007-0000-3512-2118-0009af100700"
CHARACTERISTIC_LE_PARAMS = BASE % "FF09"
CHARACTERISTIC_REVISION = 0x2a28
CHARACTERISTIC_SERIAL = 0x2a25
CHARACTERISTIC_HRDW_REVISION = 0x2a27
CHARACTERISTIC_CONFIGURATION = "00000003-0000-3512-2118-0009af100700"
CHARACTERISTIC_DEVICEEVENT = "00000010-0000-3512-2118-0009af100700"
CHARACTERISTIC_CURRENT_TIME = BASE % '2A2B'
CHARACTERISTIC_AGE = BASE % '2A80'
CHARACTERISTIC_USER_SETTINGS = "00000008-0000-3512-2118-0009af100700"
CHARACTERISTIC_ACTIVITY_DATA = "00000005-0000-3512-2118-0009af100700"
CHARACTERISTIC_FETCH = "00000004-0000-3512-2118-0009af100700"
NOTIFICATION_DESCRIPTOR = 0x2902
class AUTH_STATES(object):
__metaclass__ = Immutable
AUTH_OK = "Auth ok"
AUTH_FAILED = "Auth failed"
ENCRIPTION_KEY_FAILED = "Encryption key auth fail, sending new key"
KEY_SENDING_FAILED = "Key sending failed"
REQUEST_RN_ERROR = "Something went wrong when requesting the random number"
class ALERT_TYPES(object):
__metaclass__ = Immutable
NONE = b'\x00'
MESSAGE = b'\x01'
PHONE = b'\x02'
class QUEUE_TYPES(object):
__metaclass__ = Immutable
HEART = 'heart'
RAW_ACCEL = 'raw_accel'
RAW_HEART = 'raw_heart'