muse-api 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- Muse_Data.py +225 -0
- Muse_HW.py +547 -0
- Muse_Utils.py +2882 -0
- muse_api-2.0.0.dist-info/METADATA +726 -0
- muse_api-2.0.0.dist-info/RECORD +8 -0
- muse_api-2.0.0.dist-info/WHEEL +5 -0
- muse_api-2.0.0.dist-info/licenses/LICENSE +674 -0
- muse_api-2.0.0.dist-info/top_level.txt +3 -0
Muse_HW.py
ADDED
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
""" Muse_HW.py: Muse communication protocol specifications.
|
|
2
|
+
|
|
3
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
4
|
+
the terms of the GNU General Public License as published by the Free Software
|
|
5
|
+
Foundation, either version 3 of the License, or (at your option) any later
|
|
6
|
+
version.
|
|
7
|
+
|
|
8
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
9
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
10
|
+
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
11
|
+
|
|
12
|
+
You should have received a copy of the GNU General Public License along with
|
|
13
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
__authors__ = ["Luigi Mattiello", "Francesca Palazzo", "Roberto Bortoletto"]
|
|
17
|
+
__contact__ = "info@221e.com"
|
|
18
|
+
__copyright__ = "Copyright (c) 2020 by 221e srl."
|
|
19
|
+
__credits__ = ["Luigi Mattiello", "Francesca Palazzo", "Roberto Bortoletto"]
|
|
20
|
+
__deprecated__ = False
|
|
21
|
+
__email__ = "roberto.bortoletto@221e.com"
|
|
22
|
+
__license__ = "GNU General Public License"
|
|
23
|
+
__maintainer__ = "Roberto Bortoletto"
|
|
24
|
+
__status__ = "Production"
|
|
25
|
+
__version__ = "2.0.0"
|
|
26
|
+
|
|
27
|
+
from enum import Enum, Flag, IntEnum
|
|
28
|
+
from frozendict import frozendict
|
|
29
|
+
from Muse_Data import *
|
|
30
|
+
|
|
31
|
+
class Muse_HW:
|
|
32
|
+
|
|
33
|
+
# CONSTANTS
|
|
34
|
+
|
|
35
|
+
COMM_MESSAGE_LEN_CMD = 20 # Command characteristic size [bytes]
|
|
36
|
+
|
|
37
|
+
DATA_MESSAGE_LEN_CMD = 128 # Data characteristic size [bytes]
|
|
38
|
+
|
|
39
|
+
REFERENCE_EPOCH = 1580000000 # Timestamp reference epoch (corisponds to Sunday 26 January 2020 00:53:20)
|
|
40
|
+
|
|
41
|
+
READ_BIT_MASK = 0x80 # Bit-mask used to manage read/wrte command modes
|
|
42
|
+
|
|
43
|
+
# end CONSTANTS
|
|
44
|
+
|
|
45
|
+
# DEVICE section
|
|
46
|
+
class Command(IntEnum):
|
|
47
|
+
""" Command codes """
|
|
48
|
+
#<summary> NOT A COMMAND - used only on software side </summary>
|
|
49
|
+
CMD_NONE = 0xff
|
|
50
|
+
#<summary>Acknowledge</summary>
|
|
51
|
+
CMD_ACK = 0x00
|
|
52
|
+
# <summary>State [get/set]</summary>
|
|
53
|
+
CMD_STATE = 0x02
|
|
54
|
+
# <summary>Restart</summary>
|
|
55
|
+
CMD_RESTART = 0x03
|
|
56
|
+
# <summary>Application firmware information [readonly]</summary>
|
|
57
|
+
CMD_APP_INFO = 0x04
|
|
58
|
+
# <summary>Application firmware upload </summary>
|
|
59
|
+
CMD_FW_UPLOAD = 0x05
|
|
60
|
+
# <summary>Battery Charge [readonly]</summary>
|
|
61
|
+
CMD_BATTERY_CHARGE = 0x07
|
|
62
|
+
# <summary>Battery Voltage [readonly]</summary>
|
|
63
|
+
CMD_BATTERY_VOLTAGE = 0x08
|
|
64
|
+
# <summary>Device check up flag [readonly]</summary>
|
|
65
|
+
CMD_CHECK_UP = 0x09
|
|
66
|
+
# <summary>Installed Firmware Version [readonly]</summary>
|
|
67
|
+
CMD_FW_VERSION = 0x0a
|
|
68
|
+
# <summary>Current Time [get/set]</summary>
|
|
69
|
+
CMD_TIME = 0x0b
|
|
70
|
+
# <summary>Bluetooth Module Name [get/set]</summary>
|
|
71
|
+
CMD_BLE_NAME = 0x0c
|
|
72
|
+
# <summary>Device Identification code [readonly]</summary>
|
|
73
|
+
CMD_DEVICE_ID = 0x0e
|
|
74
|
+
# <summary>Device features [readonly]</summary>
|
|
75
|
+
CMD_DEVICE_SKILLS = 0x0f
|
|
76
|
+
# <summary>Memory state [readonly]</summary>
|
|
77
|
+
CMD_MEM_CONTROL = 0x20
|
|
78
|
+
# <summary>Get file information [readonly]</summary>
|
|
79
|
+
CMD_MEM_FILE_INFO = 0x21
|
|
80
|
+
# <summary>File download</summary>
|
|
81
|
+
CMD_MEM_FILE_DOWNLOAD = 0x22
|
|
82
|
+
# <summary>Clock offset [get/set]</summary>
|
|
83
|
+
CMD_CLK_OFFSET = 0x31
|
|
84
|
+
# <summary>Enter time sync mode</summary>
|
|
85
|
+
CMD_TIME_SYNC = 0x32
|
|
86
|
+
# <summary>Exit time sync mode</summary>
|
|
87
|
+
CMD_EXIT_TIME_SYNC = 0x33
|
|
88
|
+
# <summary>Sensors full scales [get/set]</summary>
|
|
89
|
+
CMD_SENSORS_FS = 0x40
|
|
90
|
+
# <summary>Sensors calibration matricies [get/set]</summary>
|
|
91
|
+
CMD_CALIB_MATRIX = 0x48
|
|
92
|
+
# <summary>Log button confiugration [get/set]</summary>
|
|
93
|
+
CMD_BUTTON_LOG = 0x50
|
|
94
|
+
# <summary> User configuration settings [get/set]</summary>
|
|
95
|
+
CMD_USER_CONFIG = 0x51
|
|
96
|
+
|
|
97
|
+
## Muse WiFi-enabled commands
|
|
98
|
+
# <summary> Set the SSID of the network – head part [get/set]</summary>
|
|
99
|
+
CMD_WIFI_SSID_HEAD = 0x71
|
|
100
|
+
# <summary> Set the SSID of the network – continuation part [get/set]</summary>
|
|
101
|
+
CMD_WIFI_SSID_CONT = 0x72
|
|
102
|
+
# <summary> Set the password for network authentication – head part [set]</summary>
|
|
103
|
+
CMD_WIFI_PSW_HEAD = 0x73
|
|
104
|
+
# <summary> Set the password for network authentication – continuation part [set]</summary>
|
|
105
|
+
CMD_WIFI_PSW_CONT = 0x74
|
|
106
|
+
# <summary> Set the host name – head part [get/set]</summary>
|
|
107
|
+
CMD_WIFI_STREAM_HOST_HEAD = 0x75
|
|
108
|
+
# <summary> Set the host name – continuation part [get/set]</summary>
|
|
109
|
+
CMD_WIFI_STREAM_HOST_CONT = 0x76
|
|
110
|
+
# <summary> Set the host port [get/set]</summary>
|
|
111
|
+
CMD_WIFI_STREAM_HOST_PORT = 0x77
|
|
112
|
+
|
|
113
|
+
class CommandLength(IntEnum):
|
|
114
|
+
""" Command lengths """
|
|
115
|
+
#<summary> Get state command length </summary>
|
|
116
|
+
CMD_LENGTH_GET_STATE = 2
|
|
117
|
+
# <summary> Set state command length </summary>
|
|
118
|
+
CMD_LENGTH_SET_STATE = 3
|
|
119
|
+
# <summary> Acknowledge command length </summary>
|
|
120
|
+
CMD_LENGTH_ACKNOWLEDGE = 5
|
|
121
|
+
# <summary> Start stream acquisition command length </summary>
|
|
122
|
+
CMD_LENGTH_START_STREAM = 7
|
|
123
|
+
# <summary> Start log acquisition command length </summary>
|
|
124
|
+
CMD_LENGTH_START_LOG = 7
|
|
125
|
+
# <summary> Stop acquisition command length </summary>
|
|
126
|
+
CMD_LENGTH_STOP_ACQUISITION = 3
|
|
127
|
+
# <summary> Restart command length </summary>
|
|
128
|
+
CMD_LENGTH_RESTART = 3
|
|
129
|
+
# <summary> Get firmware application info command length </summary>
|
|
130
|
+
CMD_LENGTH_GET_APP_INFO = 2
|
|
131
|
+
# <summary> Get battery charge level command length </summary>
|
|
132
|
+
CMD_LENGTH_GET_BATTERY_CHARGE = 2
|
|
133
|
+
# <summary> Get battery voltage level command length </summary>
|
|
134
|
+
CMD_LENGTH_GET_BATTERY_VOLTAGE = 2
|
|
135
|
+
# <summary> Get check-up register value command length </summary>
|
|
136
|
+
CMD_LENGTH_GET_CHECK_UP = 2
|
|
137
|
+
# <summary> Get firmware versions command length </summary>
|
|
138
|
+
CMD_LENGTH_GET_FW_VERSION = 2
|
|
139
|
+
# <summary> Get time command length </summary>
|
|
140
|
+
CMD_LENGTH_GET_TIME = 2
|
|
141
|
+
# <summary> Set time command length </summary>
|
|
142
|
+
CMD_LENGTH_SET_TIME = 6
|
|
143
|
+
# <summary> Get device name command length </summary>
|
|
144
|
+
CMD_LENGTH_GET_BLE_NAME = 2
|
|
145
|
+
# <summary> Set device command length </summary>
|
|
146
|
+
CMD_LENGTH_SET_BLE_NAME = 20
|
|
147
|
+
# <summary> Get device unique identifier command length </summary>
|
|
148
|
+
CMD_LENGTH_GET_DEVICE_ID = 2
|
|
149
|
+
# <summary> Get device skills command length </summary>
|
|
150
|
+
CMD_LENGTH_GET_DEVICE_SKILLS = 2
|
|
151
|
+
# <summary> Get memory status command length </summary>
|
|
152
|
+
CMD_LENGTH_GET_MEM_CONTROL = 2
|
|
153
|
+
# <summary> Erase memory command length </summary>
|
|
154
|
+
CMD_LENGTH_SET_MEM_CONTROL = 3
|
|
155
|
+
# <summary> Get memory file info command length </summary>
|
|
156
|
+
CMD_LENGTH_GET_MEM_FILE_INFO = 4
|
|
157
|
+
# <summary> Start file offload command length </summary>
|
|
158
|
+
CMD_LENGTH_GET_MEM_FILE_DOWNLOAD = 5
|
|
159
|
+
# <summary> Get clock offset command length </summary>
|
|
160
|
+
CMD_LENGTH_GET_CLK_OFFSET = 2
|
|
161
|
+
# <summary> Set clock offset command length </summary>
|
|
162
|
+
CMD_LENGTH_SET_CLK_OFFSET = 10
|
|
163
|
+
# <summary> Enter timesync command length </summary>
|
|
164
|
+
CMD_LENGTH_ENTER_TIME_SYNC = 2
|
|
165
|
+
# <summary> Exit timesync command length </summary>
|
|
166
|
+
CMD_LENGTH_EXIT_TIME_SYNC = 2
|
|
167
|
+
# <summary> Get sensors full scale configuration command length </summary>
|
|
168
|
+
CMD_LENGTH_GET_SENSORS_FS = 2
|
|
169
|
+
# <summary> Set sensors full scale configuration command length </summary>
|
|
170
|
+
CMD_LENGTH_SET_SENSORS_FS = 3
|
|
171
|
+
# <summary> Get calibration matrix command length </summary>
|
|
172
|
+
CMD_LENGTH_GET_CALIB_MATRIX = 4
|
|
173
|
+
# <summary> Set calibration matrix command length </summary>
|
|
174
|
+
CMD_LENGTH_SET_CALIB_MATRIX = 16
|
|
175
|
+
# <summary> Get button log configuration command length </summary>
|
|
176
|
+
CMD_LENGTH_GET_BUTTON_LOG = 2
|
|
177
|
+
# <summary> Set button log configuration command length </summary>
|
|
178
|
+
CMD_LENGTH_SET_BUTTON_LOG = 6
|
|
179
|
+
# <summary> Get user configuration command length </summary>
|
|
180
|
+
CMD_LENGTH_GET_USER_CONFIG = 2
|
|
181
|
+
# <summary> Set user configuration command length </summary>
|
|
182
|
+
CMD_LENGTH_SET_USER_CONFIG = 6
|
|
183
|
+
|
|
184
|
+
## Muse WiFi-enabled command lengths
|
|
185
|
+
# <summary> Set the SSID of the network – head part [get/set]</summary>
|
|
186
|
+
CMD_LENGTH_GET_WIFI_SSID_HEAD = 2
|
|
187
|
+
# <summary> Set the SSID of the network – continuation part [get/set]</summary>
|
|
188
|
+
CMD_LENGTH_GET_WIFI_SSID_CONT = 2
|
|
189
|
+
# <summary> Set the host name – head part [get/set]</summary>
|
|
190
|
+
CMD_LENGTH_GET_WIFI_STREAM_HOST_HEAD = 2
|
|
191
|
+
# <summary> Set the host name – continuation part [get/set]</summary>
|
|
192
|
+
CMD_LENGTH_GET_WIFI_STREAM_HOST_CONT = 2
|
|
193
|
+
# <summary> Set the host port [get/set]</summary>
|
|
194
|
+
CMD_LENGTH_GET_WIFI_STREAM_HOST_PORT = 2
|
|
195
|
+
# <summary> Set the host port [get/set]</summary>
|
|
196
|
+
CMD_LENGTH_SET_WIFI_STREAM_HOST_PORT = 4
|
|
197
|
+
|
|
198
|
+
class AcknowledgeType(IntEnum):
|
|
199
|
+
"""Acknowledge types"""
|
|
200
|
+
#<summary>NOT AN ACKNOWLEDGE - used only on software side </summary>
|
|
201
|
+
ACK_NONE = 0xff,
|
|
202
|
+
#<summary>Success</summary>
|
|
203
|
+
ACK_SUCCESS = 0x00,
|
|
204
|
+
# <summary>Error</summary>
|
|
205
|
+
ACK_ERROR = 0x01
|
|
206
|
+
|
|
207
|
+
class SystemState(Enum):
|
|
208
|
+
"""System states"""
|
|
209
|
+
#<summary>System state NONE - used only on software side</summary>
|
|
210
|
+
SYS_NONE = 0x00
|
|
211
|
+
# <summary>System state ERROR</summary>
|
|
212
|
+
SYS_ERROR = 0xff
|
|
213
|
+
# <summary>System state STARTUP</summary>
|
|
214
|
+
SYS_STARTUP = 0x01
|
|
215
|
+
# <summary>System state IDLE</summary>
|
|
216
|
+
SYS_IDLE = 0x02
|
|
217
|
+
# <summary>System state STANDBY</summary>
|
|
218
|
+
SYS_STANDBY = 0x03
|
|
219
|
+
#<summary>System state LOG - acquisition mode</summary>
|
|
220
|
+
SYS_LOG = 0x04
|
|
221
|
+
#<summary>System state READOUT - memory file download</summary>
|
|
222
|
+
SYS_READOUT = 0x05
|
|
223
|
+
#<summary>System state STREAM - buffered acquisition (realtime)</summary>
|
|
224
|
+
SYS_TX_BUFFERED = 0x06
|
|
225
|
+
#<summary>System state CALIB - calibration routines</summary>
|
|
226
|
+
SYS_CALIB = 0x07
|
|
227
|
+
#<summary>System state STREAM - direct acquisition (realtime)</summary>
|
|
228
|
+
SYS_TX_DIRECT = 0x08
|
|
229
|
+
|
|
230
|
+
class RestartMode(Enum):
|
|
231
|
+
"""Restart modes
|
|
232
|
+
- APPLICATION: 0x00 Restart device in application mode
|
|
233
|
+
- BOOT: 0x01 Restart device in bootloader mode
|
|
234
|
+
- RESET: 0x02 Restart device in application mode after performing a factory reset
|
|
235
|
+
"""
|
|
236
|
+
#<summary>Restart device in application mode</summary>
|
|
237
|
+
APPLICATION = 0x00
|
|
238
|
+
#<summary>Restart device in bootloader mode</summary>
|
|
239
|
+
BOOT = 0x01
|
|
240
|
+
#<summary>Restart device in application mode after performing a factory reset</summary>
|
|
241
|
+
RESET = 0x02
|
|
242
|
+
|
|
243
|
+
class CommunicationChannel(Enum):
|
|
244
|
+
"""Communication Channels
|
|
245
|
+
- CHANNEL_NONE: 0x00 Channel NONE - used only on software side
|
|
246
|
+
- CHANNEL_BLE: 0x01 Bluetooth Low Energy
|
|
247
|
+
- CHANNEL_USB: 0x02 USB channel
|
|
248
|
+
"""
|
|
249
|
+
#<summary>Channel NONE - used only on software side</summary>
|
|
250
|
+
CHANNEL_NONE = 0x00
|
|
251
|
+
#<summary>Bluetooth Low Energy</summary>
|
|
252
|
+
CHANNEL_BLE = 0x01
|
|
253
|
+
#<summary>USB</summary>
|
|
254
|
+
CHANNEL_USB = 0x02
|
|
255
|
+
|
|
256
|
+
class StreamingChannel(Enum):
|
|
257
|
+
"""Streaming Channels
|
|
258
|
+
- CHANNEL_BLE: 0x00 Bluetooth Low Energy
|
|
259
|
+
- CHANNEL_USB: 0x01 USB channel
|
|
260
|
+
- CHANNEL_TCP: 0x02 TCP channel
|
|
261
|
+
- CHANNEL_MQTT: 0x03 MQTT channel
|
|
262
|
+
"""
|
|
263
|
+
#<summary>Bluetooth Low Energy</summary>
|
|
264
|
+
CHANNEL_BLE = 0x00
|
|
265
|
+
#<summary>USB</summary>
|
|
266
|
+
CHANNEL_USB = 0x01
|
|
267
|
+
#<summary>TCP</summary>
|
|
268
|
+
CHANNEL_TCP = 0x02
|
|
269
|
+
#<summary>MQTT</summary>
|
|
270
|
+
CHANNEL_MQTT = 0x03
|
|
271
|
+
|
|
272
|
+
# end DEVICE section
|
|
273
|
+
|
|
274
|
+
# DATA ACQUISITION section
|
|
275
|
+
class DataMode(Enum):
|
|
276
|
+
"""Acquisition modes"""
|
|
277
|
+
#<summary>Acquisition mode NONE - used only on software side</summary>
|
|
278
|
+
DATA_MODE_NONE = 0x00000000
|
|
279
|
+
#<summary>Acquisition mode Gyroscope</summary>
|
|
280
|
+
DATA_MODE_GYRO = 0x00000001
|
|
281
|
+
#<summary>Acquisition mode Accelerometer</summary>
|
|
282
|
+
DATA_MODE_AXL = 0x00000002
|
|
283
|
+
#<summary>Acquisition mode IMU: Gyroscope + Accelerometer</summary>
|
|
284
|
+
DATA_MODE_IMU = DATA_MODE_AXL | DATA_MODE_GYRO
|
|
285
|
+
#<summary>Acquisition mode Magnetometer</summary>
|
|
286
|
+
DATA_MODE_MAGN = 0x00000004
|
|
287
|
+
#<summary>Acquisition mode 9DOF: Gyroscope + Accelerometer + Magnetometer</summary>
|
|
288
|
+
DATA_MODE_9DOF = DATA_MODE_MAGN | DATA_MODE_IMU
|
|
289
|
+
#<summary>Acquisition mode High Dynamic Range (HDR) Accelerometer</summary>
|
|
290
|
+
DATA_MODE_HDR = 0x00000008
|
|
291
|
+
#<summary>Acquisition mode IMU + HDR</summary>
|
|
292
|
+
DATA_MODE_IMU_HDR = DATA_MODE_IMU | DATA_MODE_HDR
|
|
293
|
+
#<summary>Acquisition mode orientation quaternion</summary>
|
|
294
|
+
DATA_MODE_ORIENTATION = 0x00000010
|
|
295
|
+
#<summary>Acquisition mode IMU + orientation quaternion</summary>
|
|
296
|
+
DATA_MODE_IMU_ORIENTATION = DATA_MODE_ORIENTATION | DATA_MODE_IMU
|
|
297
|
+
#<summary>Acquisition mode 9DOF + orientation quaternion</summary>
|
|
298
|
+
DATA_MODE_9DOF_ORIENTATION = DATA_MODE_9DOF | DATA_MODE_ORIENTATION
|
|
299
|
+
# <summary>Acquisition mode timestamp</summary>
|
|
300
|
+
DATA_MODE_TIMESTAMP = 0x00000020
|
|
301
|
+
#<summary>Acquisition mode 9DOF + timestamp </summary>
|
|
302
|
+
DATA_MODE_9DOF_TIMESTAMP = DATA_MODE_9DOF | DATA_MODE_TIMESTAMP
|
|
303
|
+
#<summary>Acquisition mode orientation quaternion + timestamp</summary>
|
|
304
|
+
DATA_MODE_ORIENTATION_TIMESTAMP = DATA_MODE_ORIENTATION | DATA_MODE_TIMESTAMP
|
|
305
|
+
#<summary>Acquisition mode IMU + orientation quaternion + timestamp</summary>
|
|
306
|
+
DATA_MODE_IMU_ORIENTATION_TIMESTAMP = DATA_MODE_IMU_ORIENTATION | DATA_MODE_TIMESTAMP
|
|
307
|
+
#<summary>Acquisition mode temperature and humidity</summary>
|
|
308
|
+
DATA_MODE_TEMP_HUM = 0x00000040
|
|
309
|
+
# <summary>Acquisition mode temperature and barometric pressure</summary>
|
|
310
|
+
DATA_MODE_TEMP_PRESS = 0x00000080
|
|
311
|
+
#<summary>Acquisition mode range and light intensity</summary>
|
|
312
|
+
DATA_MODE_RANGE = 0x00000100
|
|
313
|
+
#<summary>Acquisition mode microphone</summary>
|
|
314
|
+
DATA_MODE_SOUND = 0x00000400
|
|
315
|
+
|
|
316
|
+
class DataSize(IntEnum):
|
|
317
|
+
"""Acquisition packet sizes"""
|
|
318
|
+
#<summary>Packet size Gyroscope</summary>
|
|
319
|
+
DATA_SIZE_GYRO = 6
|
|
320
|
+
#<summary>Packet size Accelerometer</summary>
|
|
321
|
+
DATA_SIZE_AXL = 6
|
|
322
|
+
#<summary>Packet size IMU: Gyroscope + Accelerometer</summary>
|
|
323
|
+
DATA_SIZE_IMU = DATA_SIZE_AXL + DATA_SIZE_GYRO
|
|
324
|
+
#<summary>Packet size Magnetometer</summary>
|
|
325
|
+
DATA_SIZE_MAGN = 6
|
|
326
|
+
#<summary>Packet size 9DOF: Gyroscope + Accelerometer + Magnetometer</summary>
|
|
327
|
+
DATA_SIZE_9DOF = DATA_SIZE_MAGN | DATA_SIZE_IMU
|
|
328
|
+
#<summary>Packet size High Dynamic Range (HDR) Accelerometer</summary>
|
|
329
|
+
DATA_SIZE_HDR = 6
|
|
330
|
+
#<summary>Packet size IMU + HDR</summary>
|
|
331
|
+
DATA_SIZE_IMU_HDR = DATA_SIZE_IMU | DATA_SIZE_HDR
|
|
332
|
+
#<summary>Packet size orientation quaternion</summary>
|
|
333
|
+
DATA_SIZE_ORIENTATION = 6
|
|
334
|
+
#<summary>Packet size IMU + orientation quaternion</summary>
|
|
335
|
+
DATA_SIZE_IMU_ORIENTATION = DATA_SIZE_ORIENTATION | DATA_SIZE_IMU
|
|
336
|
+
#<summary>Packet size 9DOF + orientation quaternion</summary>
|
|
337
|
+
DATA_SIZE_9DOF_ORIENTATION = DATA_SIZE_9DOF | DATA_SIZE_ORIENTATION
|
|
338
|
+
#<summary>Packet size timestamp</summary>
|
|
339
|
+
DATA_SIZE_TIMESTAMP = 6
|
|
340
|
+
#<summary>Packet size temperature and humidity</summary>
|
|
341
|
+
DATA_SIZE_TEMP_HUM = 6
|
|
342
|
+
#<summary>Packet size temperature and barometric pressure</summary>
|
|
343
|
+
DATA_SIZE_TEMP_PRESS = 6
|
|
344
|
+
# <summary>Packet size luminosity</summary>
|
|
345
|
+
DATA_SIZE_RANGE = 6
|
|
346
|
+
#<summary>Packet size microphone</summary>
|
|
347
|
+
DATA_SIZE_SOUND = 6
|
|
348
|
+
|
|
349
|
+
class DataFrequency(Enum):
|
|
350
|
+
"""Acquisition frequencies"""
|
|
351
|
+
#<summary>Acquisition Frequency NONE - used only on software side</summary>
|
|
352
|
+
DATA_FREQ_NONE = 0x00
|
|
353
|
+
#<summary>Acquisition frequency 25 Hz</summary>
|
|
354
|
+
DATA_FREQ_25Hz = 0x01
|
|
355
|
+
#<summary>Acquisition frequency 50 Hz</summary>
|
|
356
|
+
DATA_FREQ_50Hz = 0x02
|
|
357
|
+
#<summary>Acquisition frequency 100 Hz</summary>
|
|
358
|
+
DATA_FREQ_100Hz = 0x04
|
|
359
|
+
#<summary>Acquisition frequency 200 Hz</summary>
|
|
360
|
+
DATA_FREQ_200Hz = 0x08
|
|
361
|
+
#<summary>Acquisition frequency 400 Hz</summary>
|
|
362
|
+
DATA_FREQ_400Hz = 0x10
|
|
363
|
+
#<summary>Acquisition frequency 800 Hz</summary>
|
|
364
|
+
DATA_FREQ_800Hz = 0x20
|
|
365
|
+
#<summary>Acquisition frequency 1600 Hz</summary>
|
|
366
|
+
DATA_FREQ_1600Hz = 0x40
|
|
367
|
+
|
|
368
|
+
class AcquisitionType(Enum):
|
|
369
|
+
"""Acquisition types"""
|
|
370
|
+
#<summary>Type NONE - used only on software side</summary>
|
|
371
|
+
ACQ_NONE = 0x00
|
|
372
|
+
#<summary>Buffered - streaming</summary>
|
|
373
|
+
ACQ_TX_BUFFERED = 0x01
|
|
374
|
+
#<summary>Direct - streaming</summary>
|
|
375
|
+
ACQ_TX_DIRECT = 0x02
|
|
376
|
+
#<summary>Memory file offload</summary>
|
|
377
|
+
ACQ_READOUT = 0x03
|
|
378
|
+
|
|
379
|
+
# DATA ACQUISITION section
|
|
380
|
+
|
|
381
|
+
# CONFIGURATION section
|
|
382
|
+
class HardwareSkills(Enum):
|
|
383
|
+
"""Hardware features"""
|
|
384
|
+
#<summary>Hardware feature NONE - used only on software side</summary>
|
|
385
|
+
SKILLS_HW_NONE = 0x0000
|
|
386
|
+
#<summary>Gyroscope</summary>
|
|
387
|
+
SKILLS_HW_GYRO = 0x0001
|
|
388
|
+
#<summary>Accelerometer</summary>
|
|
389
|
+
SKILLS_HW_AXL = 0x0002
|
|
390
|
+
#<summary>Magnetometer</summary>
|
|
391
|
+
SKILLS_HW_MAGN = 0x0004
|
|
392
|
+
#<summary>High Dynamic Range (HDR) Accelerometer</summary>
|
|
393
|
+
SKILLS_HW_HDR = 0x0008
|
|
394
|
+
#<summary>Temperature</summary>
|
|
395
|
+
SKILLS_HW_TEMP = 0x0010
|
|
396
|
+
#<summary>Relative Humidity</summary>
|
|
397
|
+
SKILLS_HW_RH = 0x0020
|
|
398
|
+
#<summary>Barometric Pressure</summary>
|
|
399
|
+
SKILLS_HW_BAR = 0x0040
|
|
400
|
+
#<summary>Light intensity (i.e., visible)</summary>
|
|
401
|
+
SKILLS_HW_LUM_VIS = 0x0080
|
|
402
|
+
#<summary>Light intensity (i.e., infrared)</summary>
|
|
403
|
+
SKILLS_HW_LUM_IR = 0x0100
|
|
404
|
+
#<summary>Distance / Range</summary>
|
|
405
|
+
SKILLS_HW_RANGE = 0x0200
|
|
406
|
+
#<summary>Microphone</summary>
|
|
407
|
+
SKILLS_HW_MIC = 0x0400
|
|
408
|
+
|
|
409
|
+
class SoftwareSkills(Enum):
|
|
410
|
+
"""Software features"""
|
|
411
|
+
#<summary>Software feature NONE - used only on software side</summary>
|
|
412
|
+
SKILLS_SW_NONE = 0x0000
|
|
413
|
+
#<summary>MPE library</summary>
|
|
414
|
+
SKILLS_SW_MPE = 0x0001
|
|
415
|
+
#<summary>MAD library</summary>
|
|
416
|
+
SKILLS_SW_MAD = 0x0010
|
|
417
|
+
|
|
418
|
+
class MEMS_ID(Enum):
|
|
419
|
+
"""Sensors identifiers within the system"""
|
|
420
|
+
#<summary>Gyroscope</summary>
|
|
421
|
+
SENSORS_GYRO = 0x01
|
|
422
|
+
#<summary>Accelerometer</summary>
|
|
423
|
+
SENSORS_AXL = 0x02
|
|
424
|
+
#<summary>High Dynamic Range (HDR) Accelerometer</summary>
|
|
425
|
+
SENSORS_HDR = 0x04
|
|
426
|
+
#<summary>Magnetometer</summary>
|
|
427
|
+
SENSORS_MAGN = 0x08
|
|
428
|
+
|
|
429
|
+
class MEMS_FullScaleMask(Enum):
|
|
430
|
+
"""Sensors full scale bit-mask"""
|
|
431
|
+
#<summary>Gyroscope</summary>
|
|
432
|
+
SENSORSFS_MASK_GYRO = 0x03
|
|
433
|
+
#summary>Accelerometer</summary>
|
|
434
|
+
SENSORSFS_MASK_AXL = 0x0c
|
|
435
|
+
#<summary>High Dynamic Range (HDR) Accelerometer</summary>
|
|
436
|
+
SENSORSFS_MASK_HDR = 0x30
|
|
437
|
+
#<summary>Magnetometer</summary>
|
|
438
|
+
SENSORSFS_MASK_MAGN = 0xc0
|
|
439
|
+
|
|
440
|
+
# Gyroscope configurations dictionary (i.e., full scale and sensitivity coefficient)
|
|
441
|
+
Gyroscope_CFG = frozendict({
|
|
442
|
+
0x00: SensorConfig(245, 0.00875),
|
|
443
|
+
0x01: SensorConfig(500, 0.0175),
|
|
444
|
+
0x02: SensorConfig(1000, 0.035),
|
|
445
|
+
0x03: SensorConfig(2000, 0.070)})
|
|
446
|
+
|
|
447
|
+
# Accelerometer configurations dictionary (i.e., full scale and sensitivity coefficient)
|
|
448
|
+
Accelerometer_CFG = frozendict(
|
|
449
|
+
{0x00 : SensorConfig(4, 0.122) ,
|
|
450
|
+
0x08 : SensorConfig(8, 0.244) ,
|
|
451
|
+
0x0c : SensorConfig(16, 0.488) ,
|
|
452
|
+
0x04 : SensorConfig(32, 0.976) })
|
|
453
|
+
|
|
454
|
+
# Magnetometer configurations dictionary (i.e., full scale and sensitivity coefficient)
|
|
455
|
+
Magnetometer_CFG = frozendict(
|
|
456
|
+
{0x00 : SensorConfig(4, 1000.0/6842.0) ,
|
|
457
|
+
0x40 : SensorConfig(8, 1000.0/3421.0) ,
|
|
458
|
+
0x80 : SensorConfig(12, 1000.0/2281.0) ,
|
|
459
|
+
0xc0 : SensorConfig(16, 1000.0/1711.0) })
|
|
460
|
+
|
|
461
|
+
# High Dynamic Range (HDR) Accelerometer configurations dictionary (i.e., full scale and sensitivity coefficient)
|
|
462
|
+
AccelerometerHDR_CFG = frozendict(
|
|
463
|
+
{0x00 : SensorConfig(100, 49.0) ,
|
|
464
|
+
0x10 : SensorConfig(200, 98.0) ,
|
|
465
|
+
0x30 :SensorConfig(400, 195.0) ,
|
|
466
|
+
})
|
|
467
|
+
|
|
468
|
+
class GyroscopeFS(Enum):
|
|
469
|
+
"""Gyroscope full scales"""
|
|
470
|
+
#<summary>245 dps</summary>
|
|
471
|
+
GYR_FS_245dps = 0x00
|
|
472
|
+
#<summary>500 dps</summary>
|
|
473
|
+
GYR_FS_500dps = 0x01
|
|
474
|
+
#<summary>1000 dps</summary>
|
|
475
|
+
GYR_FS_1000dps = 0x02
|
|
476
|
+
# <summary>2000 dps</summary>
|
|
477
|
+
GYR_FS_2000dps = 0x03
|
|
478
|
+
|
|
479
|
+
class AccelerometerFS(Enum):
|
|
480
|
+
"""Accelerometer full scales"""
|
|
481
|
+
#<summary>4 g</summary>
|
|
482
|
+
AXL_FS_4g = 0x00
|
|
483
|
+
#<summary>8 g</summary>
|
|
484
|
+
AXL_FS_08g = 0x08
|
|
485
|
+
#<summary>16 g</summary>
|
|
486
|
+
AXL_FS_16g = 0x0c
|
|
487
|
+
#<summary>32 g</summary>
|
|
488
|
+
AXL_FS_32g = 0x04
|
|
489
|
+
|
|
490
|
+
class MagnetometerFS(Enum):
|
|
491
|
+
"""Magnetometer full scales"""
|
|
492
|
+
#<summary>4 Gauss</summary>
|
|
493
|
+
MAG_FS_04G = 0x00
|
|
494
|
+
#<summary>8 Gauss</summary>
|
|
495
|
+
MAG_FS_08G = 0x40
|
|
496
|
+
#<summary>12 Gauss</summary>
|
|
497
|
+
MAG_FS_12G = 0x80
|
|
498
|
+
#<summary>16 Gauss</summary>
|
|
499
|
+
MAG_FS_16G = 0xc0
|
|
500
|
+
|
|
501
|
+
class AccelerometerHDRFS(Enum):
|
|
502
|
+
"""High Dynamic Range (HDR) Accelerometer full scales"""
|
|
503
|
+
#<summary>100 g</summary>
|
|
504
|
+
HDR_FS_100g = 0x00
|
|
505
|
+
#<summary>200 g</summary>
|
|
506
|
+
HDR_FS_200g = 0x10
|
|
507
|
+
#<summary>400 g</summary>
|
|
508
|
+
HDR_FS_400g = 0x30
|
|
509
|
+
|
|
510
|
+
class UserConfigMask(Enum):
|
|
511
|
+
"""Bit-masks for user configuration encoding / decoding operations"""
|
|
512
|
+
#<summary>Extracts STANDBY configuration channel</summary>
|
|
513
|
+
USER_CFG_MASK_AUTO_STANDBY = 0x0001
|
|
514
|
+
#<summary>Extracts CIRCULAR MEMORY configuration channel</summary>
|
|
515
|
+
USER_CFG_MASK_CIRCULAR_MEMORY = 0x0002
|
|
516
|
+
#<summary>Extracts BLE STREAM configuration channel</summary>
|
|
517
|
+
USER_CFG_MASK_BLE_STREAM = 0x0000
|
|
518
|
+
#<summary>Extracts USB STREAM configuration channel</summary>
|
|
519
|
+
USER_CFG_MASK_USB_STREAM = 0x0004
|
|
520
|
+
#<summary>Extracts TCP STREAM configuration channel</summary>
|
|
521
|
+
USER_CFG_MASK_TCP_STREAM = 0x0008
|
|
522
|
+
#<summary>Extracts MQTT STREAM configuration channel</summary>
|
|
523
|
+
USER_CFG_MASK_MQTT_STREAM = 0x000C
|
|
524
|
+
#<summary>Extracts 9DOF MPE configuration channel</summary>
|
|
525
|
+
USER_CFG_MASK_9DOF_MPE = 0x0020
|
|
526
|
+
#<summary>Extracts SLOW FREQUENCY configuration channel</summary>
|
|
527
|
+
USER_CFG_MASK_SLOW_FREQUENCY = 0x0040
|
|
528
|
+
#<summary>Extracts MQTT commands configuration channel</summary>
|
|
529
|
+
USER_CFG_MASK_MQTT_COMMANDS = 0x0080
|
|
530
|
+
#<summary>mask for streaming channel decoding</summary>
|
|
531
|
+
USER_CFG_MASK_STREAMING_CHANNEL = 0x001C
|
|
532
|
+
|
|
533
|
+
# end CONFIGURATION section
|
|
534
|
+
|
|
535
|
+
# CALIBRATION section
|
|
536
|
+
class CalibrationType(IntEnum):
|
|
537
|
+
"""Calibration types"""
|
|
538
|
+
#<summary>Accelerometer</summary>
|
|
539
|
+
CALIB_TYPE_AXL = 0
|
|
540
|
+
#<summary>Gyroscope</summary>
|
|
541
|
+
CALIB_TYPE_GYR = 1
|
|
542
|
+
#<summary>Magnetometer</summary>
|
|
543
|
+
CALIB_TYPE_MAG = 2
|
|
544
|
+
|
|
545
|
+
# end CALIBRATION section
|
|
546
|
+
|
|
547
|
+
|