1#[allow(unused_imports)]
15use crate::{
16 base58::Uid, byte_converter::*, device::*, error::TinkerforgeError, ip_connection::async_io::AsyncIpConnection,
17 low_level_traits::LowLevelRead,
18};
19#[allow(unused_imports)]
20use futures_core::Stream;
21#[allow(unused_imports)]
22use tokio_stream::StreamExt;
23pub enum ImuBrickFunction {
24 GetAcceleration,
25 GetMagneticField,
26 GetAngularVelocity,
27 GetAllData,
28 GetOrientation,
29 GetQuaternion,
30 GetImuTemperature,
31 LedsOn,
32 LedsOff,
33 AreLedsOn,
34 SetAccelerationRange,
35 GetAccelerationRange,
36 SetMagnetometerRange,
37 GetMagnetometerRange,
38 SetConvergenceSpeed,
39 GetConvergenceSpeed,
40 SetCalibration,
41 GetCalibration,
42 SetAccelerationPeriod,
43 GetAccelerationPeriod,
44 SetMagneticFieldPeriod,
45 GetMagneticFieldPeriod,
46 SetAngularVelocityPeriod,
47 GetAngularVelocityPeriod,
48 SetAllDataPeriod,
49 GetAllDataPeriod,
50 SetOrientationPeriod,
51 GetOrientationPeriod,
52 SetQuaternionPeriod,
53 GetQuaternionPeriod,
54 OrientationCalculationOn,
55 OrientationCalculationOff,
56 IsOrientationCalculationOn,
57 SetSpitfpBaudrateConfig,
58 GetSpitfpBaudrateConfig,
59 GetSendTimeoutCount,
60 SetSpitfpBaudrate,
61 GetSpitfpBaudrate,
62 GetSpitfpErrorCount,
63 EnableStatusLed,
64 DisableStatusLed,
65 IsStatusLedEnabled,
66 GetProtocol1BrickletName,
67 GetChipTemperature,
68 Reset,
69 WriteBrickletPlugin,
70 ReadBrickletPlugin,
71 GetIdentity,
72 CallbackAcceleration,
73 CallbackMagneticField,
74 CallbackAngularVelocity,
75 CallbackAllData,
76 CallbackOrientation,
77 CallbackQuaternion,
78}
79impl From<ImuBrickFunction> for u8 {
80 fn from(fun: ImuBrickFunction) -> Self {
81 match fun {
82 ImuBrickFunction::GetAcceleration => 1,
83 ImuBrickFunction::GetMagneticField => 2,
84 ImuBrickFunction::GetAngularVelocity => 3,
85 ImuBrickFunction::GetAllData => 4,
86 ImuBrickFunction::GetOrientation => 5,
87 ImuBrickFunction::GetQuaternion => 6,
88 ImuBrickFunction::GetImuTemperature => 7,
89 ImuBrickFunction::LedsOn => 8,
90 ImuBrickFunction::LedsOff => 9,
91 ImuBrickFunction::AreLedsOn => 10,
92 ImuBrickFunction::SetAccelerationRange => 11,
93 ImuBrickFunction::GetAccelerationRange => 12,
94 ImuBrickFunction::SetMagnetometerRange => 13,
95 ImuBrickFunction::GetMagnetometerRange => 14,
96 ImuBrickFunction::SetConvergenceSpeed => 15,
97 ImuBrickFunction::GetConvergenceSpeed => 16,
98 ImuBrickFunction::SetCalibration => 17,
99 ImuBrickFunction::GetCalibration => 18,
100 ImuBrickFunction::SetAccelerationPeriod => 19,
101 ImuBrickFunction::GetAccelerationPeriod => 20,
102 ImuBrickFunction::SetMagneticFieldPeriod => 21,
103 ImuBrickFunction::GetMagneticFieldPeriod => 22,
104 ImuBrickFunction::SetAngularVelocityPeriod => 23,
105 ImuBrickFunction::GetAngularVelocityPeriod => 24,
106 ImuBrickFunction::SetAllDataPeriod => 25,
107 ImuBrickFunction::GetAllDataPeriod => 26,
108 ImuBrickFunction::SetOrientationPeriod => 27,
109 ImuBrickFunction::GetOrientationPeriod => 28,
110 ImuBrickFunction::SetQuaternionPeriod => 29,
111 ImuBrickFunction::GetQuaternionPeriod => 30,
112 ImuBrickFunction::OrientationCalculationOn => 37,
113 ImuBrickFunction::OrientationCalculationOff => 38,
114 ImuBrickFunction::IsOrientationCalculationOn => 39,
115 ImuBrickFunction::SetSpitfpBaudrateConfig => 231,
116 ImuBrickFunction::GetSpitfpBaudrateConfig => 232,
117 ImuBrickFunction::GetSendTimeoutCount => 233,
118 ImuBrickFunction::SetSpitfpBaudrate => 234,
119 ImuBrickFunction::GetSpitfpBaudrate => 235,
120 ImuBrickFunction::GetSpitfpErrorCount => 237,
121 ImuBrickFunction::EnableStatusLed => 238,
122 ImuBrickFunction::DisableStatusLed => 239,
123 ImuBrickFunction::IsStatusLedEnabled => 240,
124 ImuBrickFunction::GetProtocol1BrickletName => 241,
125 ImuBrickFunction::GetChipTemperature => 242,
126 ImuBrickFunction::Reset => 243,
127 ImuBrickFunction::WriteBrickletPlugin => 246,
128 ImuBrickFunction::ReadBrickletPlugin => 247,
129 ImuBrickFunction::GetIdentity => 255,
130 ImuBrickFunction::CallbackAcceleration => 31,
131 ImuBrickFunction::CallbackMagneticField => 32,
132 ImuBrickFunction::CallbackAngularVelocity => 33,
133 ImuBrickFunction::CallbackAllData => 34,
134 ImuBrickFunction::CallbackOrientation => 35,
135 ImuBrickFunction::CallbackQuaternion => 36,
136 }
137 }
138}
139pub const IMU_BRICK_CALIBRATION_TYPE_ACCELEROMETER_GAIN: u8 = 0;
140pub const IMU_BRICK_CALIBRATION_TYPE_ACCELEROMETER_BIAS: u8 = 1;
141pub const IMU_BRICK_CALIBRATION_TYPE_MAGNETOMETER_GAIN: u8 = 2;
142pub const IMU_BRICK_CALIBRATION_TYPE_MAGNETOMETER_BIAS: u8 = 3;
143pub const IMU_BRICK_CALIBRATION_TYPE_GYROSCOPE_GAIN: u8 = 4;
144pub const IMU_BRICK_CALIBRATION_TYPE_GYROSCOPE_BIAS: u8 = 5;
145pub const IMU_BRICK_COMMUNICATION_METHOD_NONE: u8 = 0;
146pub const IMU_BRICK_COMMUNICATION_METHOD_USB: u8 = 1;
147pub const IMU_BRICK_COMMUNICATION_METHOD_SPI_STACK: u8 = 2;
148pub const IMU_BRICK_COMMUNICATION_METHOD_CHIBI: u8 = 3;
149pub const IMU_BRICK_COMMUNICATION_METHOD_RS485: u8 = 4;
150pub const IMU_BRICK_COMMUNICATION_METHOD_WIFI: u8 = 5;
151pub const IMU_BRICK_COMMUNICATION_METHOD_ETHERNET: u8 = 6;
152pub const IMU_BRICK_COMMUNICATION_METHOD_WIFI_V2: u8 = 7;
153
154#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
155pub struct Acceleration {
156 pub x: i16,
157 pub y: i16,
158 pub z: i16,
159}
160impl FromByteSlice for Acceleration {
161 fn bytes_expected() -> usize {
162 6
163 }
164 fn from_le_byte_slice(bytes: &[u8]) -> Acceleration {
165 Acceleration {
166 x: <i16>::from_le_byte_slice(&bytes[0..2]),
167 y: <i16>::from_le_byte_slice(&bytes[2..4]),
168 z: <i16>::from_le_byte_slice(&bytes[4..6]),
169 }
170 }
171}
172
173#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
174pub struct MagneticField {
175 pub x: i16,
176 pub y: i16,
177 pub z: i16,
178}
179impl FromByteSlice for MagneticField {
180 fn bytes_expected() -> usize {
181 6
182 }
183 fn from_le_byte_slice(bytes: &[u8]) -> MagneticField {
184 MagneticField {
185 x: <i16>::from_le_byte_slice(&bytes[0..2]),
186 y: <i16>::from_le_byte_slice(&bytes[2..4]),
187 z: <i16>::from_le_byte_slice(&bytes[4..6]),
188 }
189 }
190}
191
192#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
193pub struct AngularVelocity {
194 pub x: i16,
195 pub y: i16,
196 pub z: i16,
197}
198impl FromByteSlice for AngularVelocity {
199 fn bytes_expected() -> usize {
200 6
201 }
202 fn from_le_byte_slice(bytes: &[u8]) -> AngularVelocity {
203 AngularVelocity {
204 x: <i16>::from_le_byte_slice(&bytes[0..2]),
205 y: <i16>::from_le_byte_slice(&bytes[2..4]),
206 z: <i16>::from_le_byte_slice(&bytes[4..6]),
207 }
208 }
209}
210
211#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
212pub struct AllData {
213 pub acc_x: i16,
214 pub acc_y: i16,
215 pub acc_z: i16,
216 pub mag_x: i16,
217 pub mag_y: i16,
218 pub mag_z: i16,
219 pub ang_x: i16,
220 pub ang_y: i16,
221 pub ang_z: i16,
222 pub temperature: i16,
223}
224impl FromByteSlice for AllData {
225 fn bytes_expected() -> usize {
226 20
227 }
228 fn from_le_byte_slice(bytes: &[u8]) -> AllData {
229 AllData {
230 acc_x: <i16>::from_le_byte_slice(&bytes[0..2]),
231 acc_y: <i16>::from_le_byte_slice(&bytes[2..4]),
232 acc_z: <i16>::from_le_byte_slice(&bytes[4..6]),
233 mag_x: <i16>::from_le_byte_slice(&bytes[6..8]),
234 mag_y: <i16>::from_le_byte_slice(&bytes[8..10]),
235 mag_z: <i16>::from_le_byte_slice(&bytes[10..12]),
236 ang_x: <i16>::from_le_byte_slice(&bytes[12..14]),
237 ang_y: <i16>::from_le_byte_slice(&bytes[14..16]),
238 ang_z: <i16>::from_le_byte_slice(&bytes[16..18]),
239 temperature: <i16>::from_le_byte_slice(&bytes[18..20]),
240 }
241 }
242}
243
244#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
245pub struct Orientation {
246 pub roll: i16,
247 pub pitch: i16,
248 pub yaw: i16,
249}
250impl FromByteSlice for Orientation {
251 fn bytes_expected() -> usize {
252 6
253 }
254 fn from_le_byte_slice(bytes: &[u8]) -> Orientation {
255 Orientation {
256 roll: <i16>::from_le_byte_slice(&bytes[0..2]),
257 pitch: <i16>::from_le_byte_slice(&bytes[2..4]),
258 yaw: <i16>::from_le_byte_slice(&bytes[4..6]),
259 }
260 }
261}
262
263#[derive(Clone, Copy, Debug, Default, PartialEq)]
264pub struct Quaternion {
265 pub x: f32,
266 pub y: f32,
267 pub z: f32,
268 pub w: f32,
269}
270impl FromByteSlice for Quaternion {
271 fn bytes_expected() -> usize {
272 16
273 }
274 fn from_le_byte_slice(bytes: &[u8]) -> Quaternion {
275 Quaternion {
276 x: <f32>::from_le_byte_slice(&bytes[0..4]),
277 y: <f32>::from_le_byte_slice(&bytes[4..8]),
278 z: <f32>::from_le_byte_slice(&bytes[8..12]),
279 w: <f32>::from_le_byte_slice(&bytes[12..16]),
280 }
281 }
282}
283
284#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
285pub struct AccelerationEvent {
286 pub x: i16,
287 pub y: i16,
288 pub z: i16,
289}
290impl FromByteSlice for AccelerationEvent {
291 fn bytes_expected() -> usize {
292 6
293 }
294 fn from_le_byte_slice(bytes: &[u8]) -> AccelerationEvent {
295 AccelerationEvent {
296 x: <i16>::from_le_byte_slice(&bytes[0..2]),
297 y: <i16>::from_le_byte_slice(&bytes[2..4]),
298 z: <i16>::from_le_byte_slice(&bytes[4..6]),
299 }
300 }
301}
302
303#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
304pub struct MagneticFieldEvent {
305 pub x: i16,
306 pub y: i16,
307 pub z: i16,
308}
309impl FromByteSlice for MagneticFieldEvent {
310 fn bytes_expected() -> usize {
311 6
312 }
313 fn from_le_byte_slice(bytes: &[u8]) -> MagneticFieldEvent {
314 MagneticFieldEvent {
315 x: <i16>::from_le_byte_slice(&bytes[0..2]),
316 y: <i16>::from_le_byte_slice(&bytes[2..4]),
317 z: <i16>::from_le_byte_slice(&bytes[4..6]),
318 }
319 }
320}
321
322#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
323pub struct AngularVelocityEvent {
324 pub x: i16,
325 pub y: i16,
326 pub z: i16,
327}
328impl FromByteSlice for AngularVelocityEvent {
329 fn bytes_expected() -> usize {
330 6
331 }
332 fn from_le_byte_slice(bytes: &[u8]) -> AngularVelocityEvent {
333 AngularVelocityEvent {
334 x: <i16>::from_le_byte_slice(&bytes[0..2]),
335 y: <i16>::from_le_byte_slice(&bytes[2..4]),
336 z: <i16>::from_le_byte_slice(&bytes[4..6]),
337 }
338 }
339}
340
341#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
342pub struct AllDataEvent {
343 pub acc_x: i16,
344 pub acc_y: i16,
345 pub acc_z: i16,
346 pub mag_x: i16,
347 pub mag_y: i16,
348 pub mag_z: i16,
349 pub ang_x: i16,
350 pub ang_y: i16,
351 pub ang_z: i16,
352 pub temperature: i16,
353}
354impl FromByteSlice for AllDataEvent {
355 fn bytes_expected() -> usize {
356 20
357 }
358 fn from_le_byte_slice(bytes: &[u8]) -> AllDataEvent {
359 AllDataEvent {
360 acc_x: <i16>::from_le_byte_slice(&bytes[0..2]),
361 acc_y: <i16>::from_le_byte_slice(&bytes[2..4]),
362 acc_z: <i16>::from_le_byte_slice(&bytes[4..6]),
363 mag_x: <i16>::from_le_byte_slice(&bytes[6..8]),
364 mag_y: <i16>::from_le_byte_slice(&bytes[8..10]),
365 mag_z: <i16>::from_le_byte_slice(&bytes[10..12]),
366 ang_x: <i16>::from_le_byte_slice(&bytes[12..14]),
367 ang_y: <i16>::from_le_byte_slice(&bytes[14..16]),
368 ang_z: <i16>::from_le_byte_slice(&bytes[16..18]),
369 temperature: <i16>::from_le_byte_slice(&bytes[18..20]),
370 }
371 }
372}
373
374#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
375pub struct OrientationEvent {
376 pub roll: i16,
377 pub pitch: i16,
378 pub yaw: i16,
379}
380impl FromByteSlice for OrientationEvent {
381 fn bytes_expected() -> usize {
382 6
383 }
384 fn from_le_byte_slice(bytes: &[u8]) -> OrientationEvent {
385 OrientationEvent {
386 roll: <i16>::from_le_byte_slice(&bytes[0..2]),
387 pitch: <i16>::from_le_byte_slice(&bytes[2..4]),
388 yaw: <i16>::from_le_byte_slice(&bytes[4..6]),
389 }
390 }
391}
392
393#[derive(Clone, Copy, Debug, Default, PartialEq)]
394pub struct QuaternionEvent {
395 pub x: f32,
396 pub y: f32,
397 pub z: f32,
398 pub w: f32,
399}
400impl FromByteSlice for QuaternionEvent {
401 fn bytes_expected() -> usize {
402 16
403 }
404 fn from_le_byte_slice(bytes: &[u8]) -> QuaternionEvent {
405 QuaternionEvent {
406 x: <f32>::from_le_byte_slice(&bytes[0..4]),
407 y: <f32>::from_le_byte_slice(&bytes[4..8]),
408 z: <f32>::from_le_byte_slice(&bytes[8..12]),
409 w: <f32>::from_le_byte_slice(&bytes[12..16]),
410 }
411 }
412}
413
414#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
415pub struct SpitfpBaudrateConfig {
416 pub enable_dynamic_baudrate: bool,
417 pub minimum_dynamic_baudrate: u32,
418}
419impl FromByteSlice for SpitfpBaudrateConfig {
420 fn bytes_expected() -> usize {
421 5
422 }
423 fn from_le_byte_slice(bytes: &[u8]) -> SpitfpBaudrateConfig {
424 SpitfpBaudrateConfig {
425 enable_dynamic_baudrate: <bool>::from_le_byte_slice(&bytes[0..1]),
426 minimum_dynamic_baudrate: <u32>::from_le_byte_slice(&bytes[1..5]),
427 }
428 }
429}
430
431#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
432pub struct SpitfpErrorCount {
433 pub error_count_ack_checksum: u32,
434 pub error_count_message_checksum: u32,
435 pub error_count_frame: u32,
436 pub error_count_overflow: u32,
437}
438impl FromByteSlice for SpitfpErrorCount {
439 fn bytes_expected() -> usize {
440 16
441 }
442 fn from_le_byte_slice(bytes: &[u8]) -> SpitfpErrorCount {
443 SpitfpErrorCount {
444 error_count_ack_checksum: <u32>::from_le_byte_slice(&bytes[0..4]),
445 error_count_message_checksum: <u32>::from_le_byte_slice(&bytes[4..8]),
446 error_count_frame: <u32>::from_le_byte_slice(&bytes[8..12]),
447 error_count_overflow: <u32>::from_le_byte_slice(&bytes[12..16]),
448 }
449 }
450}
451
452#[derive(Clone)]
453pub struct Protocol1BrickletName {
454 pub protocol_version: u8,
455 pub firmware_version: [u8; 3],
456 pub name: String,
457}
458impl FromByteSlice for Protocol1BrickletName {
459 fn bytes_expected() -> usize {
460 44
461 }
462 fn from_le_byte_slice(bytes: &[u8]) -> Protocol1BrickletName {
463 Protocol1BrickletName {
464 protocol_version: <u8>::from_le_byte_slice(&bytes[0..1]),
465 firmware_version: <[u8; 3]>::from_le_byte_slice(&bytes[1..4]),
466 name: <String>::from_le_byte_slice(&bytes[4..44]),
467 }
468 }
469}
470
471#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
472pub struct Identity {
473 pub uid: String,
474 pub connected_uid: String,
475 pub position: char,
476 pub hardware_version: [u8; 3],
477 pub firmware_version: [u8; 3],
478 pub device_identifier: u16,
479}
480impl FromByteSlice for Identity {
481 fn bytes_expected() -> usize {
482 25
483 }
484 fn from_le_byte_slice(bytes: &[u8]) -> Identity {
485 Identity {
486 uid: <String>::from_le_byte_slice(&bytes[0..8]),
487 connected_uid: <String>::from_le_byte_slice(&bytes[8..16]),
488 position: <char>::from_le_byte_slice(&bytes[16..17]),
489 hardware_version: <[u8; 3]>::from_le_byte_slice(&bytes[17..20]),
490 firmware_version: <[u8; 3]>::from_le_byte_slice(&bytes[20..23]),
491 device_identifier: <u16>::from_le_byte_slice(&bytes[23..25]),
492 }
493 }
494}
495
496#[derive(Clone)]
498pub struct ImuBrick {
499 device: Device,
500}
501impl ImuBrick {
502 pub const DEVICE_IDENTIFIER: u16 = 16;
503 pub const DEVICE_DISPLAY_NAME: &'static str = "IMU Brick";
504 pub fn new(uid: Uid, connection: AsyncIpConnection) -> ImuBrick {
506 let mut result = ImuBrick { device: Device::new([2, 0, 10], uid, connection, Self::DEVICE_DISPLAY_NAME) };
507 result.device.response_expected[u8::from(ImuBrickFunction::GetAcceleration) as usize] = ResponseExpectedFlag::AlwaysTrue;
508 result.device.response_expected[u8::from(ImuBrickFunction::GetMagneticField) as usize] = ResponseExpectedFlag::AlwaysTrue;
509 result.device.response_expected[u8::from(ImuBrickFunction::GetAngularVelocity) as usize] = ResponseExpectedFlag::AlwaysTrue;
510 result.device.response_expected[u8::from(ImuBrickFunction::GetAllData) as usize] = ResponseExpectedFlag::AlwaysTrue;
511 result.device.response_expected[u8::from(ImuBrickFunction::GetOrientation) as usize] = ResponseExpectedFlag::AlwaysTrue;
512 result.device.response_expected[u8::from(ImuBrickFunction::GetQuaternion) as usize] = ResponseExpectedFlag::AlwaysTrue;
513 result.device.response_expected[u8::from(ImuBrickFunction::GetImuTemperature) as usize] = ResponseExpectedFlag::AlwaysTrue;
514 result.device.response_expected[u8::from(ImuBrickFunction::LedsOn) as usize] = ResponseExpectedFlag::False;
515 result.device.response_expected[u8::from(ImuBrickFunction::LedsOff) as usize] = ResponseExpectedFlag::False;
516 result.device.response_expected[u8::from(ImuBrickFunction::AreLedsOn) as usize] = ResponseExpectedFlag::AlwaysTrue;
517 result.device.response_expected[u8::from(ImuBrickFunction::SetAccelerationRange) as usize] = ResponseExpectedFlag::False;
518 result.device.response_expected[u8::from(ImuBrickFunction::GetAccelerationRange) as usize] = ResponseExpectedFlag::AlwaysTrue;
519 result.device.response_expected[u8::from(ImuBrickFunction::SetMagnetometerRange) as usize] = ResponseExpectedFlag::False;
520 result.device.response_expected[u8::from(ImuBrickFunction::GetMagnetometerRange) as usize] = ResponseExpectedFlag::AlwaysTrue;
521 result.device.response_expected[u8::from(ImuBrickFunction::SetConvergenceSpeed) as usize] = ResponseExpectedFlag::False;
522 result.device.response_expected[u8::from(ImuBrickFunction::GetConvergenceSpeed) as usize] = ResponseExpectedFlag::AlwaysTrue;
523 result.device.response_expected[u8::from(ImuBrickFunction::SetCalibration) as usize] = ResponseExpectedFlag::False;
524 result.device.response_expected[u8::from(ImuBrickFunction::GetCalibration) as usize] = ResponseExpectedFlag::AlwaysTrue;
525 result.device.response_expected[u8::from(ImuBrickFunction::SetAccelerationPeriod) as usize] = ResponseExpectedFlag::True;
526 result.device.response_expected[u8::from(ImuBrickFunction::GetAccelerationPeriod) as usize] = ResponseExpectedFlag::AlwaysTrue;
527 result.device.response_expected[u8::from(ImuBrickFunction::SetMagneticFieldPeriod) as usize] = ResponseExpectedFlag::True;
528 result.device.response_expected[u8::from(ImuBrickFunction::GetMagneticFieldPeriod) as usize] = ResponseExpectedFlag::AlwaysTrue;
529 result.device.response_expected[u8::from(ImuBrickFunction::SetAngularVelocityPeriod) as usize] = ResponseExpectedFlag::True;
530 result.device.response_expected[u8::from(ImuBrickFunction::GetAngularVelocityPeriod) as usize] = ResponseExpectedFlag::AlwaysTrue;
531 result.device.response_expected[u8::from(ImuBrickFunction::SetAllDataPeriod) as usize] = ResponseExpectedFlag::True;
532 result.device.response_expected[u8::from(ImuBrickFunction::GetAllDataPeriod) as usize] = ResponseExpectedFlag::AlwaysTrue;
533 result.device.response_expected[u8::from(ImuBrickFunction::SetOrientationPeriod) as usize] = ResponseExpectedFlag::True;
534 result.device.response_expected[u8::from(ImuBrickFunction::GetOrientationPeriod) as usize] = ResponseExpectedFlag::AlwaysTrue;
535 result.device.response_expected[u8::from(ImuBrickFunction::SetQuaternionPeriod) as usize] = ResponseExpectedFlag::True;
536 result.device.response_expected[u8::from(ImuBrickFunction::GetQuaternionPeriod) as usize] = ResponseExpectedFlag::AlwaysTrue;
537 result.device.response_expected[u8::from(ImuBrickFunction::OrientationCalculationOn) as usize] = ResponseExpectedFlag::False;
538 result.device.response_expected[u8::from(ImuBrickFunction::OrientationCalculationOff) as usize] = ResponseExpectedFlag::False;
539 result.device.response_expected[u8::from(ImuBrickFunction::IsOrientationCalculationOn) as usize] = ResponseExpectedFlag::AlwaysTrue;
540 result.device.response_expected[u8::from(ImuBrickFunction::SetSpitfpBaudrateConfig) as usize] = ResponseExpectedFlag::False;
541 result.device.response_expected[u8::from(ImuBrickFunction::GetSpitfpBaudrateConfig) as usize] = ResponseExpectedFlag::AlwaysTrue;
542 result.device.response_expected[u8::from(ImuBrickFunction::GetSendTimeoutCount) as usize] = ResponseExpectedFlag::AlwaysTrue;
543 result.device.response_expected[u8::from(ImuBrickFunction::SetSpitfpBaudrate) as usize] = ResponseExpectedFlag::False;
544 result.device.response_expected[u8::from(ImuBrickFunction::GetSpitfpBaudrate) as usize] = ResponseExpectedFlag::AlwaysTrue;
545 result.device.response_expected[u8::from(ImuBrickFunction::GetSpitfpErrorCount) as usize] = ResponseExpectedFlag::AlwaysTrue;
546 result.device.response_expected[u8::from(ImuBrickFunction::EnableStatusLed) as usize] = ResponseExpectedFlag::False;
547 result.device.response_expected[u8::from(ImuBrickFunction::DisableStatusLed) as usize] = ResponseExpectedFlag::False;
548 result.device.response_expected[u8::from(ImuBrickFunction::IsStatusLedEnabled) as usize] = ResponseExpectedFlag::AlwaysTrue;
549 result.device.response_expected[u8::from(ImuBrickFunction::GetProtocol1BrickletName) as usize] = ResponseExpectedFlag::AlwaysTrue;
550 result.device.response_expected[u8::from(ImuBrickFunction::GetChipTemperature) as usize] = ResponseExpectedFlag::AlwaysTrue;
551 result.device.response_expected[u8::from(ImuBrickFunction::Reset) as usize] = ResponseExpectedFlag::False;
552 result.device.response_expected[u8::from(ImuBrickFunction::WriteBrickletPlugin) as usize] = ResponseExpectedFlag::False;
553 result.device.response_expected[u8::from(ImuBrickFunction::ReadBrickletPlugin) as usize] = ResponseExpectedFlag::AlwaysTrue;
554 result.device.response_expected[u8::from(ImuBrickFunction::GetIdentity) as usize] = ResponseExpectedFlag::AlwaysTrue;
555 result
556 }
557
558 pub fn get_response_expected(&mut self, fun: ImuBrickFunction) -> Result<bool, GetResponseExpectedError> {
573 self.device.get_response_expected(u8::from(fun))
574 }
575
576 pub fn set_response_expected(&mut self, fun: ImuBrickFunction, response_expected: bool) -> Result<(), SetResponseExpectedError> {
585 self.device.set_response_expected(u8::from(fun), response_expected)
586 }
587
588 pub fn set_response_expected_all(&mut self, response_expected: bool) {
590 self.device.set_response_expected_all(response_expected)
591 }
592
593 pub fn get_api_version(&self) -> [u8; 3] {
596 self.device.api_version
597 }
598
599 pub async fn get_acceleration_callback_receiver(&mut self) -> impl Stream<Item = AccelerationEvent> {
605 self.device
606 .get_callback_receiver(u8::from(ImuBrickFunction::CallbackAcceleration))
607 .await
608 .map(|p| AccelerationEvent::from_le_byte_slice(p.body()))
609 }
610
611 pub async fn get_magnetic_field_callback_receiver(&mut self) -> impl Stream<Item = MagneticFieldEvent> {
615 self.device
616 .get_callback_receiver(u8::from(ImuBrickFunction::CallbackMagneticField))
617 .await
618 .map(|p| MagneticFieldEvent::from_le_byte_slice(p.body()))
619 }
620
621 pub async fn get_angular_velocity_callback_receiver(&mut self) -> impl Stream<Item = AngularVelocityEvent> {
625 self.device
626 .get_callback_receiver(u8::from(ImuBrickFunction::CallbackAngularVelocity))
627 .await
628 .map(|p| AngularVelocityEvent::from_le_byte_slice(p.body()))
629 }
630
631 pub async fn get_all_data_callback_receiver(&mut self) -> impl Stream<Item = AllDataEvent> {
636 self.device
637 .get_callback_receiver(u8::from(ImuBrickFunction::CallbackAllData))
638 .await
639 .map(|p| AllDataEvent::from_le_byte_slice(p.body()))
640 }
641
642 pub async fn get_orientation_callback_receiver(&mut self) -> impl Stream<Item = OrientationEvent> {
647 self.device
648 .get_callback_receiver(u8::from(ImuBrickFunction::CallbackOrientation))
649 .await
650 .map(|p| OrientationEvent::from_le_byte_slice(p.body()))
651 }
652
653 pub async fn get_quaternion_callback_receiver(&mut self) -> impl Stream<Item = QuaternionEvent> {
658 self.device
659 .get_callback_receiver(u8::from(ImuBrickFunction::CallbackQuaternion))
660 .await
661 .map(|p| QuaternionEvent::from_le_byte_slice(p.body()))
662 }
663
664 pub async fn get_acceleration(&mut self) -> Result<Acceleration, TinkerforgeError> {
671 let payload = [0; 0];
672
673 #[allow(unused_variables)]
674 let result = self.device.get(u8::from(ImuBrickFunction::GetAcceleration), &payload).await?;
675 Ok(Acceleration::from_le_byte_slice(result.body()))
676 }
677
678 pub async fn get_magnetic_field(&mut self) -> Result<MagneticField, TinkerforgeError> {
685 let payload = [0; 0];
686
687 #[allow(unused_variables)]
688 let result = self.device.get(u8::from(ImuBrickFunction::GetMagneticField), &payload).await?;
689 Ok(MagneticField::from_le_byte_slice(result.body()))
690 }
691
692 pub async fn get_angular_velocity(&mut self) -> Result<AngularVelocity, TinkerforgeError> {
700 let payload = [0; 0];
701
702 #[allow(unused_variables)]
703 let result = self.device.get(u8::from(ImuBrickFunction::GetAngularVelocity), &payload).await?;
704 Ok(AngularVelocity::from_le_byte_slice(result.body()))
705 }
706
707 pub async fn get_all_data(&mut self) -> Result<AllData, TinkerforgeError> {
714 let payload = [0; 0];
715
716 #[allow(unused_variables)]
717 let result = self.device.get(u8::from(ImuBrickFunction::GetAllData), &payload).await?;
718 Ok(AllData::from_le_byte_slice(result.body()))
719 }
720
721 pub async fn get_orientation(&mut self) -> Result<Orientation, TinkerforgeError> {
734 let payload = [0; 0];
735
736 #[allow(unused_variables)]
737 let result = self.device.get(u8::from(ImuBrickFunction::GetOrientation), &payload).await?;
738 Ok(Orientation::from_le_byte_slice(result.body()))
739 }
740
741 pub async fn get_quaternion(&mut self) -> Result<Quaternion, TinkerforgeError> {
773 let payload = [0; 0];
774
775 #[allow(unused_variables)]
776 let result = self.device.get(u8::from(ImuBrickFunction::GetQuaternion), &payload).await?;
777 Ok(Quaternion::from_le_byte_slice(result.body()))
778 }
779
780 pub async fn get_imu_temperature(&mut self) -> Result<i16, TinkerforgeError> {
782 let payload = [0; 0];
783
784 #[allow(unused_variables)]
785 let result = self.device.get(u8::from(ImuBrickFunction::GetImuTemperature), &payload).await?;
786 Ok(i16::from_le_byte_slice(result.body()))
787 }
788
789 pub async fn leds_on(&mut self) -> Result<(), TinkerforgeError> {
791 let payload = [0; 0];
792
793 #[allow(unused_variables)]
794 let result = self.device.set(u8::from(ImuBrickFunction::LedsOn), &payload).await?;
795 Ok(())
796 }
797
798 pub async fn leds_off(&mut self) -> Result<(), TinkerforgeError> {
800 let payload = [0; 0];
801
802 #[allow(unused_variables)]
803 let result = self.device.set(u8::from(ImuBrickFunction::LedsOff), &payload).await?;
804 Ok(())
805 }
806
807 pub async fn are_leds_on(&mut self) -> Result<bool, TinkerforgeError> {
810 let payload = [0; 0];
811
812 #[allow(unused_variables)]
813 let result = self.device.get(u8::from(ImuBrickFunction::AreLedsOn), &payload).await?;
814 Ok(bool::from_le_byte_slice(result.body()))
815 }
816
817 pub async fn set_acceleration_range(&mut self, range: u8) -> Result<(), TinkerforgeError> {
819 let mut payload = [0; 1];
820 range.write_to_slice(&mut payload[0..1]);
821
822 #[allow(unused_variables)]
823 let result = self.device.set(u8::from(ImuBrickFunction::SetAccelerationRange), &payload).await?;
824 Ok(())
825 }
826
827 pub async fn get_acceleration_range(&mut self) -> Result<u8, TinkerforgeError> {
829 let payload = [0; 0];
830
831 #[allow(unused_variables)]
832 let result = self.device.get(u8::from(ImuBrickFunction::GetAccelerationRange), &payload).await?;
833 Ok(u8::from_le_byte_slice(result.body()))
834 }
835
836 pub async fn set_magnetometer_range(&mut self, range: u8) -> Result<(), TinkerforgeError> {
838 let mut payload = [0; 1];
839 range.write_to_slice(&mut payload[0..1]);
840
841 #[allow(unused_variables)]
842 let result = self.device.set(u8::from(ImuBrickFunction::SetMagnetometerRange), &payload).await?;
843 Ok(())
844 }
845
846 pub async fn get_magnetometer_range(&mut self) -> Result<u8, TinkerforgeError> {
848 let payload = [0; 0];
849
850 #[allow(unused_variables)]
851 let result = self.device.get(u8::from(ImuBrickFunction::GetMagnetometerRange), &payload).await?;
852 Ok(u8::from_le_byte_slice(result.body()))
853 }
854
855 pub async fn set_convergence_speed(&mut self, speed: u16) -> Result<(), TinkerforgeError> {
881 let mut payload = [0; 2];
882 speed.write_to_slice(&mut payload[0..2]);
883
884 #[allow(unused_variables)]
885 let result = self.device.set(u8::from(ImuBrickFunction::SetConvergenceSpeed), &payload).await?;
886 Ok(())
887 }
888
889 pub async fn get_convergence_speed(&mut self) -> Result<u16, TinkerforgeError> {
891 let payload = [0; 0];
892
893 #[allow(unused_variables)]
894 let result = self.device.get(u8::from(ImuBrickFunction::GetConvergenceSpeed), &payload).await?;
895 Ok(u16::from_le_byte_slice(result.body()))
896 }
897
898 pub async fn set_calibration(&mut self, typ: u8, data: &[i16; 10]) -> Result<(), TinkerforgeError> {
939 let mut payload = [0; 21];
940 typ.write_to_slice(&mut payload[0..1]);
941 data.write_to_slice(&mut payload[1..21]);
942
943 #[allow(unused_variables)]
944 let result = self.device.set(u8::from(ImuBrickFunction::SetCalibration), &payload).await?;
945 Ok(())
946 }
947
948 pub async fn get_calibration(&mut self, typ: u8) -> Result<Box<[i16; 10]>, TinkerforgeError> {
958 let mut payload = [0; 1];
959 typ.write_to_slice(&mut payload[0..1]);
960
961 #[allow(unused_variables)]
962 let result = self.device.get(u8::from(ImuBrickFunction::GetCalibration), &payload).await?;
963 Ok(Box::<[i16; 10]>::from_le_byte_slice(result.body()))
964 }
965
966 pub async fn set_acceleration_period(&mut self, period: u32) -> Result<(), TinkerforgeError> {
969 let mut payload = [0; 4];
970 period.write_to_slice(&mut payload[0..4]);
971
972 #[allow(unused_variables)]
973 let result = self.device.set(u8::from(ImuBrickFunction::SetAccelerationPeriod), &payload).await?;
974 Ok(())
975 }
976
977 pub async fn get_acceleration_period(&mut self) -> Result<u32, TinkerforgeError> {
979 let payload = [0; 0];
980
981 #[allow(unused_variables)]
982 let result = self.device.get(u8::from(ImuBrickFunction::GetAccelerationPeriod), &payload).await?;
983 Ok(u32::from_le_byte_slice(result.body()))
984 }
985
986 pub async fn set_magnetic_field_period(&mut self, period: u32) -> Result<(), TinkerforgeError> {
989 let mut payload = [0; 4];
990 period.write_to_slice(&mut payload[0..4]);
991
992 #[allow(unused_variables)]
993 let result = self.device.set(u8::from(ImuBrickFunction::SetMagneticFieldPeriod), &payload).await?;
994 Ok(())
995 }
996
997 pub async fn get_magnetic_field_period(&mut self) -> Result<u32, TinkerforgeError> {
999 let payload = [0; 0];
1000
1001 #[allow(unused_variables)]
1002 let result = self.device.get(u8::from(ImuBrickFunction::GetMagneticFieldPeriod), &payload).await?;
1003 Ok(u32::from_le_byte_slice(result.body()))
1004 }
1005
1006 pub async fn set_angular_velocity_period(&mut self, period: u32) -> Result<(), TinkerforgeError> {
1009 let mut payload = [0; 4];
1010 period.write_to_slice(&mut payload[0..4]);
1011
1012 #[allow(unused_variables)]
1013 let result = self.device.set(u8::from(ImuBrickFunction::SetAngularVelocityPeriod), &payload).await?;
1014 Ok(())
1015 }
1016
1017 pub async fn get_angular_velocity_period(&mut self) -> Result<u32, TinkerforgeError> {
1019 let payload = [0; 0];
1020
1021 #[allow(unused_variables)]
1022 let result = self.device.get(u8::from(ImuBrickFunction::GetAngularVelocityPeriod), &payload).await?;
1023 Ok(u32::from_le_byte_slice(result.body()))
1024 }
1025
1026 pub async fn set_all_data_period(&mut self, period: u32) -> Result<(), TinkerforgeError> {
1029 let mut payload = [0; 4];
1030 period.write_to_slice(&mut payload[0..4]);
1031
1032 #[allow(unused_variables)]
1033 let result = self.device.set(u8::from(ImuBrickFunction::SetAllDataPeriod), &payload).await?;
1034 Ok(())
1035 }
1036
1037 pub async fn get_all_data_period(&mut self) -> Result<u32, TinkerforgeError> {
1039 let payload = [0; 0];
1040
1041 #[allow(unused_variables)]
1042 let result = self.device.get(u8::from(ImuBrickFunction::GetAllDataPeriod), &payload).await?;
1043 Ok(u32::from_le_byte_slice(result.body()))
1044 }
1045
1046 pub async fn set_orientation_period(&mut self, period: u32) -> Result<(), TinkerforgeError> {
1049 let mut payload = [0; 4];
1050 period.write_to_slice(&mut payload[0..4]);
1051
1052 #[allow(unused_variables)]
1053 let result = self.device.set(u8::from(ImuBrickFunction::SetOrientationPeriod), &payload).await?;
1054 Ok(())
1055 }
1056
1057 pub async fn get_orientation_period(&mut self) -> Result<u32, TinkerforgeError> {
1059 let payload = [0; 0];
1060
1061 #[allow(unused_variables)]
1062 let result = self.device.get(u8::from(ImuBrickFunction::GetOrientationPeriod), &payload).await?;
1063 Ok(u32::from_le_byte_slice(result.body()))
1064 }
1065
1066 pub async fn set_quaternion_period(&mut self, period: u32) -> Result<(), TinkerforgeError> {
1069 let mut payload = [0; 4];
1070 period.write_to_slice(&mut payload[0..4]);
1071
1072 #[allow(unused_variables)]
1073 let result = self.device.set(u8::from(ImuBrickFunction::SetQuaternionPeriod), &payload).await?;
1074 Ok(())
1075 }
1076
1077 pub async fn get_quaternion_period(&mut self) -> Result<u32, TinkerforgeError> {
1079 let payload = [0; 0];
1080
1081 #[allow(unused_variables)]
1082 let result = self.device.get(u8::from(ImuBrickFunction::GetQuaternionPeriod), &payload).await?;
1083 Ok(u32::from_le_byte_slice(result.body()))
1084 }
1085
1086 pub async fn orientation_calculation_on(&mut self) -> Result<(), TinkerforgeError> {
1093 let payload = [0; 0];
1094
1095 #[allow(unused_variables)]
1096 let result = self.device.set(u8::from(ImuBrickFunction::OrientationCalculationOn), &payload).await?;
1097 Ok(())
1098 }
1099
1100 pub async fn orientation_calculation_off(&mut self) -> Result<(), TinkerforgeError> {
1115 let payload = [0; 0];
1116
1117 #[allow(unused_variables)]
1118 let result = self.device.set(u8::from(ImuBrickFunction::OrientationCalculationOff), &payload).await?;
1119 Ok(())
1120 }
1121
1122 pub async fn is_orientation_calculation_on(&mut self) -> Result<bool, TinkerforgeError> {
1128 let payload = [0; 0];
1129
1130 #[allow(unused_variables)]
1131 let result = self.device.get(u8::from(ImuBrickFunction::IsOrientationCalculationOn), &payload).await?;
1132 Ok(bool::from_le_byte_slice(result.body()))
1133 }
1134
1135 pub async fn set_spitfp_baudrate_config(
1157 &mut self,
1158 enable_dynamic_baudrate: bool,
1159 minimum_dynamic_baudrate: u32,
1160 ) -> Result<(), TinkerforgeError> {
1161 let mut payload = [0; 5];
1162 enable_dynamic_baudrate.write_to_slice(&mut payload[0..1]);
1163 minimum_dynamic_baudrate.write_to_slice(&mut payload[1..5]);
1164
1165 #[allow(unused_variables)]
1166 let result = self.device.set(u8::from(ImuBrickFunction::SetSpitfpBaudrateConfig), &payload).await?;
1167 Ok(())
1168 }
1169
1170 pub async fn get_spitfp_baudrate_config(&mut self) -> Result<SpitfpBaudrateConfig, TinkerforgeError> {
1175 let payload = [0; 0];
1176
1177 #[allow(unused_variables)]
1178 let result = self.device.get(u8::from(ImuBrickFunction::GetSpitfpBaudrateConfig), &payload).await?;
1179 Ok(SpitfpBaudrateConfig::from_le_byte_slice(result.body()))
1180 }
1181
1182 pub async fn get_send_timeout_count(&mut self, communication_method: u8) -> Result<u32, TinkerforgeError> {
1202 let mut payload = [0; 1];
1203 communication_method.write_to_slice(&mut payload[0..1]);
1204
1205 #[allow(unused_variables)]
1206 let result = self.device.get(u8::from(ImuBrickFunction::GetSendTimeoutCount), &payload).await?;
1207 Ok(u32::from_le_byte_slice(result.body()))
1208 }
1209
1210 pub async fn set_spitfp_baudrate(&mut self, bricklet_port: char, baudrate: u32) -> Result<(), TinkerforgeError> {
1227 let mut payload = [0; 5];
1228 bricklet_port.write_to_slice(&mut payload[0..1]);
1229 baudrate.write_to_slice(&mut payload[1..5]);
1230
1231 #[allow(unused_variables)]
1232 let result = self.device.set(u8::from(ImuBrickFunction::SetSpitfpBaudrate), &payload).await?;
1233 Ok(())
1234 }
1235
1236 pub async fn get_spitfp_baudrate(&mut self, bricklet_port: char) -> Result<u32, TinkerforgeError> {
1241 let mut payload = [0; 1];
1242 bricklet_port.write_to_slice(&mut payload[0..1]);
1243
1244 #[allow(unused_variables)]
1245 let result = self.device.get(u8::from(ImuBrickFunction::GetSpitfpBaudrate), &payload).await?;
1246 Ok(u32::from_le_byte_slice(result.body()))
1247 }
1248
1249 pub async fn get_spitfp_error_count(&mut self, bricklet_port: char) -> Result<SpitfpErrorCount, TinkerforgeError> {
1264 let mut payload = [0; 1];
1265 bricklet_port.write_to_slice(&mut payload[0..1]);
1266
1267 #[allow(unused_variables)]
1268 let result = self.device.get(u8::from(ImuBrickFunction::GetSpitfpErrorCount), &payload).await?;
1269 Ok(SpitfpErrorCount::from_le_byte_slice(result.body()))
1270 }
1271
1272 pub async fn enable_status_led(&mut self) -> Result<(), TinkerforgeError> {
1282 let payload = [0; 0];
1283
1284 #[allow(unused_variables)]
1285 let result = self.device.set(u8::from(ImuBrickFunction::EnableStatusLed), &payload).await?;
1286 Ok(())
1287 }
1288
1289 pub async fn disable_status_led(&mut self) -> Result<(), TinkerforgeError> {
1299 let payload = [0; 0];
1300
1301 #[allow(unused_variables)]
1302 let result = self.device.set(u8::from(ImuBrickFunction::DisableStatusLed), &payload).await?;
1303 Ok(())
1304 }
1305
1306 pub async fn is_status_led_enabled(&mut self) -> Result<bool, TinkerforgeError> {
1311 let payload = [0; 0];
1312
1313 #[allow(unused_variables)]
1314 let result = self.device.get(u8::from(ImuBrickFunction::IsStatusLedEnabled), &payload).await?;
1315 Ok(bool::from_le_byte_slice(result.body()))
1316 }
1317
1318 pub async fn get_protocol1_bricklet_name(&mut self, port: char) -> Result<Protocol1BrickletName, TinkerforgeError> {
1324 let mut payload = [0; 1];
1325 port.write_to_slice(&mut payload[0..1]);
1326
1327 #[allow(unused_variables)]
1328 let result = self.device.get(u8::from(ImuBrickFunction::GetProtocol1BrickletName), &payload).await?;
1329 Ok(Protocol1BrickletName::from_le_byte_slice(result.body()))
1330 }
1331
1332 pub async fn get_chip_temperature(&mut self) -> Result<i16, TinkerforgeError> {
1339 let payload = [0; 0];
1340
1341 #[allow(unused_variables)]
1342 let result = self.device.get(u8::from(ImuBrickFunction::GetChipTemperature), &payload).await?;
1343 Ok(i16::from_le_byte_slice(result.body()))
1344 }
1345
1346 pub async fn reset(&mut self) -> Result<(), TinkerforgeError> {
1353 let payload = [0; 0];
1354
1355 #[allow(unused_variables)]
1356 let result = self.device.set(u8::from(ImuBrickFunction::Reset), &payload).await?;
1357 Ok(())
1358 }
1359
1360 pub async fn write_bricklet_plugin(&mut self, port: char, offset: u8, chunk: &[u8; 32]) -> Result<(), TinkerforgeError> {
1366 let mut payload = [0; 34];
1367 port.write_to_slice(&mut payload[0..1]);
1368 offset.write_to_slice(&mut payload[1..2]);
1369 chunk.write_to_slice(&mut payload[2..34]);
1370
1371 #[allow(unused_variables)]
1372 let result = self.device.set(u8::from(ImuBrickFunction::WriteBrickletPlugin), &payload).await?;
1373 Ok(())
1374 }
1375
1376 pub async fn read_bricklet_plugin(&mut self, port: char, offset: u8) -> Result<Box<[u8; 32]>, TinkerforgeError> {
1382 let mut payload = [0; 2];
1383 port.write_to_slice(&mut payload[0..1]);
1384 offset.write_to_slice(&mut payload[1..2]);
1385
1386 #[allow(unused_variables)]
1387 let result = self.device.get(u8::from(ImuBrickFunction::ReadBrickletPlugin), &payload).await?;
1388 Ok(Box::<[u8; 32]>::from_le_byte_slice(result.body()))
1389 }
1390
1391 pub async fn get_identity(&mut self) -> Result<Identity, TinkerforgeError> {
1400 let payload = [0; 0];
1401
1402 #[allow(unused_variables)]
1403 let result = self.device.get(u8::from(ImuBrickFunction::GetIdentity), &payload).await?;
1404 Ok(Identity::from_le_byte_slice(result.body()))
1405 }
1406}