1#[allow(unused_imports)]
15use crate::{
16 base58::Uid, byte_converter::*, converting_receiver::BrickletError, device::*, error::TinkerforgeError,
17 ip_connection::async_io::AsyncIpConnection, low_level_traits::LowLevelRead,
18};
19#[allow(unused_imports)]
20use futures_core::Stream;
21#[allow(unused_imports)]
22use tokio_stream::StreamExt;
23pub enum MasterBrickFunction {
24 GetStackVoltage,
25 GetStackCurrent,
26 SetExtensionType,
27 GetExtensionType,
28 IsChibiPresent,
29 SetChibiAddress,
30 GetChibiAddress,
31 SetChibiMasterAddress,
32 GetChibiMasterAddress,
33 SetChibiSlaveAddress,
34 GetChibiSlaveAddress,
35 GetChibiSignalStrength,
36 GetChibiErrorLog,
37 SetChibiFrequency,
38 GetChibiFrequency,
39 SetChibiChannel,
40 GetChibiChannel,
41 IsRs485Present,
42 SetRs485Address,
43 GetRs485Address,
44 SetRs485SlaveAddress,
45 GetRs485SlaveAddress,
46 GetRs485ErrorLog,
47 SetRs485Configuration,
48 GetRs485Configuration,
49 IsWifiPresent,
50 SetWifiConfiguration,
51 GetWifiConfiguration,
52 SetWifiEncryption,
53 GetWifiEncryption,
54 GetWifiStatus,
55 RefreshWifiStatus,
56 SetWifiCertificate,
57 GetWifiCertificate,
58 SetWifiPowerMode,
59 GetWifiPowerMode,
60 GetWifiBufferInfo,
61 SetWifiRegulatoryDomain,
62 GetWifiRegulatoryDomain,
63 GetUsbVoltage,
64 SetLongWifiKey,
65 GetLongWifiKey,
66 SetWifiHostname,
67 GetWifiHostname,
68 SetStackCurrentCallbackPeriod,
69 GetStackCurrentCallbackPeriod,
70 SetStackVoltageCallbackPeriod,
71 GetStackVoltageCallbackPeriod,
72 SetUsbVoltageCallbackPeriod,
73 GetUsbVoltageCallbackPeriod,
74 SetStackCurrentCallbackThreshold,
75 GetStackCurrentCallbackThreshold,
76 SetStackVoltageCallbackThreshold,
77 GetStackVoltageCallbackThreshold,
78 SetUsbVoltageCallbackThreshold,
79 GetUsbVoltageCallbackThreshold,
80 SetDebouncePeriod,
81 GetDebouncePeriod,
82 IsEthernetPresent,
83 SetEthernetConfiguration,
84 GetEthernetConfiguration,
85 GetEthernetStatus,
86 SetEthernetHostname,
87 SetEthernetMacAddress,
88 SetEthernetWebsocketConfiguration,
89 GetEthernetWebsocketConfiguration,
90 SetEthernetAuthenticationSecret,
91 GetEthernetAuthenticationSecret,
92 SetWifiAuthenticationSecret,
93 GetWifiAuthenticationSecret,
94 GetConnectionType,
95 IsWifi2Present,
96 StartWifi2Bootloader,
97 WriteWifi2SerialPort,
98 ReadWifi2SerialPort,
99 SetWifi2AuthenticationSecret,
100 GetWifi2AuthenticationSecret,
101 SetWifi2Configuration,
102 GetWifi2Configuration,
103 GetWifi2Status,
104 SetWifi2ClientConfiguration,
105 GetWifi2ClientConfiguration,
106 SetWifi2ClientHostname,
107 GetWifi2ClientHostname,
108 SetWifi2ClientPassword,
109 GetWifi2ClientPassword,
110 SetWifi2ApConfiguration,
111 GetWifi2ApConfiguration,
112 SetWifi2ApPassword,
113 GetWifi2ApPassword,
114 SaveWifi2Configuration,
115 GetWifi2FirmwareVersion,
116 EnableWifi2StatusLed,
117 DisableWifi2StatusLed,
118 IsWifi2StatusLedEnabled,
119 SetWifi2MeshConfiguration,
120 GetWifi2MeshConfiguration,
121 SetWifi2MeshRouterSsid,
122 GetWifi2MeshRouterSsid,
123 SetWifi2MeshRouterPassword,
124 GetWifi2MeshRouterPassword,
125 GetWifi2MeshCommonStatus,
126 GetWifi2MeshClientStatus,
127 GetWifi2MeshApStatus,
128 SetBrickletXmcFlashConfig,
129 SetBrickletXmcFlashData,
130 SetBrickletsEnabled,
131 GetBrickletsEnabled,
132 SetSpitfpBaudrateConfig,
133 GetSpitfpBaudrateConfig,
134 GetSendTimeoutCount,
135 SetSpitfpBaudrate,
136 GetSpitfpBaudrate,
137 GetSpitfpErrorCount,
138 EnableStatusLed,
139 DisableStatusLed,
140 IsStatusLedEnabled,
141 GetProtocol1BrickletName,
142 GetChipTemperature,
143 Reset,
144 WriteBrickletPlugin,
145 ReadBrickletPlugin,
146 GetIdentity,
147 CallbackStackCurrent,
148 CallbackStackVoltage,
149 CallbackUsbVoltage,
150 CallbackStackCurrentReached,
151 CallbackStackVoltageReached,
152 CallbackUsbVoltageReached,
153}
154impl From<MasterBrickFunction> for u8 {
155 fn from(fun: MasterBrickFunction) -> Self {
156 match fun {
157 MasterBrickFunction::GetStackVoltage => 1,
158 MasterBrickFunction::GetStackCurrent => 2,
159 MasterBrickFunction::SetExtensionType => 3,
160 MasterBrickFunction::GetExtensionType => 4,
161 MasterBrickFunction::IsChibiPresent => 5,
162 MasterBrickFunction::SetChibiAddress => 6,
163 MasterBrickFunction::GetChibiAddress => 7,
164 MasterBrickFunction::SetChibiMasterAddress => 8,
165 MasterBrickFunction::GetChibiMasterAddress => 9,
166 MasterBrickFunction::SetChibiSlaveAddress => 10,
167 MasterBrickFunction::GetChibiSlaveAddress => 11,
168 MasterBrickFunction::GetChibiSignalStrength => 12,
169 MasterBrickFunction::GetChibiErrorLog => 13,
170 MasterBrickFunction::SetChibiFrequency => 14,
171 MasterBrickFunction::GetChibiFrequency => 15,
172 MasterBrickFunction::SetChibiChannel => 16,
173 MasterBrickFunction::GetChibiChannel => 17,
174 MasterBrickFunction::IsRs485Present => 18,
175 MasterBrickFunction::SetRs485Address => 19,
176 MasterBrickFunction::GetRs485Address => 20,
177 MasterBrickFunction::SetRs485SlaveAddress => 21,
178 MasterBrickFunction::GetRs485SlaveAddress => 22,
179 MasterBrickFunction::GetRs485ErrorLog => 23,
180 MasterBrickFunction::SetRs485Configuration => 24,
181 MasterBrickFunction::GetRs485Configuration => 25,
182 MasterBrickFunction::IsWifiPresent => 26,
183 MasterBrickFunction::SetWifiConfiguration => 27,
184 MasterBrickFunction::GetWifiConfiguration => 28,
185 MasterBrickFunction::SetWifiEncryption => 29,
186 MasterBrickFunction::GetWifiEncryption => 30,
187 MasterBrickFunction::GetWifiStatus => 31,
188 MasterBrickFunction::RefreshWifiStatus => 32,
189 MasterBrickFunction::SetWifiCertificate => 33,
190 MasterBrickFunction::GetWifiCertificate => 34,
191 MasterBrickFunction::SetWifiPowerMode => 35,
192 MasterBrickFunction::GetWifiPowerMode => 36,
193 MasterBrickFunction::GetWifiBufferInfo => 37,
194 MasterBrickFunction::SetWifiRegulatoryDomain => 38,
195 MasterBrickFunction::GetWifiRegulatoryDomain => 39,
196 MasterBrickFunction::GetUsbVoltage => 40,
197 MasterBrickFunction::SetLongWifiKey => 41,
198 MasterBrickFunction::GetLongWifiKey => 42,
199 MasterBrickFunction::SetWifiHostname => 43,
200 MasterBrickFunction::GetWifiHostname => 44,
201 MasterBrickFunction::SetStackCurrentCallbackPeriod => 45,
202 MasterBrickFunction::GetStackCurrentCallbackPeriod => 46,
203 MasterBrickFunction::SetStackVoltageCallbackPeriod => 47,
204 MasterBrickFunction::GetStackVoltageCallbackPeriod => 48,
205 MasterBrickFunction::SetUsbVoltageCallbackPeriod => 49,
206 MasterBrickFunction::GetUsbVoltageCallbackPeriod => 50,
207 MasterBrickFunction::SetStackCurrentCallbackThreshold => 51,
208 MasterBrickFunction::GetStackCurrentCallbackThreshold => 52,
209 MasterBrickFunction::SetStackVoltageCallbackThreshold => 53,
210 MasterBrickFunction::GetStackVoltageCallbackThreshold => 54,
211 MasterBrickFunction::SetUsbVoltageCallbackThreshold => 55,
212 MasterBrickFunction::GetUsbVoltageCallbackThreshold => 56,
213 MasterBrickFunction::SetDebouncePeriod => 57,
214 MasterBrickFunction::GetDebouncePeriod => 58,
215 MasterBrickFunction::IsEthernetPresent => 65,
216 MasterBrickFunction::SetEthernetConfiguration => 66,
217 MasterBrickFunction::GetEthernetConfiguration => 67,
218 MasterBrickFunction::GetEthernetStatus => 68,
219 MasterBrickFunction::SetEthernetHostname => 69,
220 MasterBrickFunction::SetEthernetMacAddress => 70,
221 MasterBrickFunction::SetEthernetWebsocketConfiguration => 71,
222 MasterBrickFunction::GetEthernetWebsocketConfiguration => 72,
223 MasterBrickFunction::SetEthernetAuthenticationSecret => 73,
224 MasterBrickFunction::GetEthernetAuthenticationSecret => 74,
225 MasterBrickFunction::SetWifiAuthenticationSecret => 75,
226 MasterBrickFunction::GetWifiAuthenticationSecret => 76,
227 MasterBrickFunction::GetConnectionType => 77,
228 MasterBrickFunction::IsWifi2Present => 78,
229 MasterBrickFunction::StartWifi2Bootloader => 79,
230 MasterBrickFunction::WriteWifi2SerialPort => 80,
231 MasterBrickFunction::ReadWifi2SerialPort => 81,
232 MasterBrickFunction::SetWifi2AuthenticationSecret => 82,
233 MasterBrickFunction::GetWifi2AuthenticationSecret => 83,
234 MasterBrickFunction::SetWifi2Configuration => 84,
235 MasterBrickFunction::GetWifi2Configuration => 85,
236 MasterBrickFunction::GetWifi2Status => 86,
237 MasterBrickFunction::SetWifi2ClientConfiguration => 87,
238 MasterBrickFunction::GetWifi2ClientConfiguration => 88,
239 MasterBrickFunction::SetWifi2ClientHostname => 89,
240 MasterBrickFunction::GetWifi2ClientHostname => 90,
241 MasterBrickFunction::SetWifi2ClientPassword => 91,
242 MasterBrickFunction::GetWifi2ClientPassword => 92,
243 MasterBrickFunction::SetWifi2ApConfiguration => 93,
244 MasterBrickFunction::GetWifi2ApConfiguration => 94,
245 MasterBrickFunction::SetWifi2ApPassword => 95,
246 MasterBrickFunction::GetWifi2ApPassword => 96,
247 MasterBrickFunction::SaveWifi2Configuration => 97,
248 MasterBrickFunction::GetWifi2FirmwareVersion => 98,
249 MasterBrickFunction::EnableWifi2StatusLed => 99,
250 MasterBrickFunction::DisableWifi2StatusLed => 100,
251 MasterBrickFunction::IsWifi2StatusLedEnabled => 101,
252 MasterBrickFunction::SetWifi2MeshConfiguration => 102,
253 MasterBrickFunction::GetWifi2MeshConfiguration => 103,
254 MasterBrickFunction::SetWifi2MeshRouterSsid => 104,
255 MasterBrickFunction::GetWifi2MeshRouterSsid => 105,
256 MasterBrickFunction::SetWifi2MeshRouterPassword => 106,
257 MasterBrickFunction::GetWifi2MeshRouterPassword => 107,
258 MasterBrickFunction::GetWifi2MeshCommonStatus => 108,
259 MasterBrickFunction::GetWifi2MeshClientStatus => 109,
260 MasterBrickFunction::GetWifi2MeshApStatus => 110,
261 MasterBrickFunction::SetBrickletXmcFlashConfig => 111,
262 MasterBrickFunction::SetBrickletXmcFlashData => 112,
263 MasterBrickFunction::SetBrickletsEnabled => 113,
264 MasterBrickFunction::GetBrickletsEnabled => 114,
265 MasterBrickFunction::SetSpitfpBaudrateConfig => 231,
266 MasterBrickFunction::GetSpitfpBaudrateConfig => 232,
267 MasterBrickFunction::GetSendTimeoutCount => 233,
268 MasterBrickFunction::SetSpitfpBaudrate => 234,
269 MasterBrickFunction::GetSpitfpBaudrate => 235,
270 MasterBrickFunction::GetSpitfpErrorCount => 237,
271 MasterBrickFunction::EnableStatusLed => 238,
272 MasterBrickFunction::DisableStatusLed => 239,
273 MasterBrickFunction::IsStatusLedEnabled => 240,
274 MasterBrickFunction::GetProtocol1BrickletName => 241,
275 MasterBrickFunction::GetChipTemperature => 242,
276 MasterBrickFunction::Reset => 243,
277 MasterBrickFunction::WriteBrickletPlugin => 246,
278 MasterBrickFunction::ReadBrickletPlugin => 247,
279 MasterBrickFunction::GetIdentity => 255,
280 MasterBrickFunction::CallbackStackCurrent => 59,
281 MasterBrickFunction::CallbackStackVoltage => 60,
282 MasterBrickFunction::CallbackUsbVoltage => 61,
283 MasterBrickFunction::CallbackStackCurrentReached => 62,
284 MasterBrickFunction::CallbackStackVoltageReached => 63,
285 MasterBrickFunction::CallbackUsbVoltageReached => 64,
286 }
287 }
288}
289pub const MASTER_BRICK_EXTENSION_TYPE_CHIBI: u32 = 1;
290pub const MASTER_BRICK_EXTENSION_TYPE_RS485: u32 = 2;
291pub const MASTER_BRICK_EXTENSION_TYPE_WIFI: u32 = 3;
292pub const MASTER_BRICK_EXTENSION_TYPE_ETHERNET: u32 = 4;
293pub const MASTER_BRICK_EXTENSION_TYPE_WIFI2: u32 = 5;
294pub const MASTER_BRICK_CHIBI_FREQUENCY_OQPSK_868_MHZ: u8 = 0;
295pub const MASTER_BRICK_CHIBI_FREQUENCY_OQPSK_915_MHZ: u8 = 1;
296pub const MASTER_BRICK_CHIBI_FREQUENCY_OQPSK_780_MHZ: u8 = 2;
297pub const MASTER_BRICK_CHIBI_FREQUENCY_BPSK40_915_MHZ: u8 = 3;
298pub const MASTER_BRICK_RS485_PARITY_NONE: char = 'n';
299pub const MASTER_BRICK_RS485_PARITY_EVEN: char = 'e';
300pub const MASTER_BRICK_RS485_PARITY_ODD: char = 'o';
301pub const MASTER_BRICK_WIFI_CONNECTION_DHCP: u8 = 0;
302pub const MASTER_BRICK_WIFI_CONNECTION_STATIC_IP: u8 = 1;
303pub const MASTER_BRICK_WIFI_CONNECTION_ACCESS_POINT_DHCP: u8 = 2;
304pub const MASTER_BRICK_WIFI_CONNECTION_ACCESS_POINT_STATIC_IP: u8 = 3;
305pub const MASTER_BRICK_WIFI_CONNECTION_AD_HOC_DHCP: u8 = 4;
306pub const MASTER_BRICK_WIFI_CONNECTION_AD_HOC_STATIC_IP: u8 = 5;
307pub const MASTER_BRICK_WIFI_ENCRYPTION_WPA_WPA2: u8 = 0;
308pub const MASTER_BRICK_WIFI_ENCRYPTION_WPA_ENTERPRISE: u8 = 1;
309pub const MASTER_BRICK_WIFI_ENCRYPTION_WEP: u8 = 2;
310pub const MASTER_BRICK_WIFI_ENCRYPTION_NO_ENCRYPTION: u8 = 3;
311pub const MASTER_BRICK_WIFI_EAP_OPTION_OUTER_AUTH_EAP_FAST: u8 = 0;
312pub const MASTER_BRICK_WIFI_EAP_OPTION_OUTER_AUTH_EAP_TLS: u8 = 1;
313pub const MASTER_BRICK_WIFI_EAP_OPTION_OUTER_AUTH_EAP_TTLS: u8 = 2;
314pub const MASTER_BRICK_WIFI_EAP_OPTION_OUTER_AUTH_EAP_PEAP: u8 = 3;
315pub const MASTER_BRICK_WIFI_EAP_OPTION_INNER_AUTH_EAP_MSCHAP: u8 = 0;
316pub const MASTER_BRICK_WIFI_EAP_OPTION_INNER_AUTH_EAP_GTC: u8 = 4;
317pub const MASTER_BRICK_WIFI_EAP_OPTION_CERT_TYPE_CA_CERT: u8 = 0;
318pub const MASTER_BRICK_WIFI_EAP_OPTION_CERT_TYPE_CLIENT_CERT: u8 = 8;
319pub const MASTER_BRICK_WIFI_EAP_OPTION_CERT_TYPE_PRIVATE_KEY: u8 = 16;
320pub const MASTER_BRICK_WIFI_STATE_DISASSOCIATED: u8 = 0;
321pub const MASTER_BRICK_WIFI_STATE_ASSOCIATED: u8 = 1;
322pub const MASTER_BRICK_WIFI_STATE_ASSOCIATING: u8 = 2;
323pub const MASTER_BRICK_WIFI_STATE_ERROR: u8 = 3;
324pub const MASTER_BRICK_WIFI_STATE_NOT_INITIALIZED_YET: u8 = 255;
325pub const MASTER_BRICK_WIFI_POWER_MODE_FULL_SPEED: u8 = 0;
326pub const MASTER_BRICK_WIFI_POWER_MODE_LOW_POWER: u8 = 1;
327pub const MASTER_BRICK_WIFI_DOMAIN_CHANNEL_1TO11: u8 = 0;
328pub const MASTER_BRICK_WIFI_DOMAIN_CHANNEL_1TO13: u8 = 1;
329pub const MASTER_BRICK_WIFI_DOMAIN_CHANNEL_1TO14: u8 = 2;
330pub const MASTER_BRICK_THRESHOLD_OPTION_OFF: char = 'x';
331pub const MASTER_BRICK_THRESHOLD_OPTION_OUTSIDE: char = 'o';
332pub const MASTER_BRICK_THRESHOLD_OPTION_INSIDE: char = 'i';
333pub const MASTER_BRICK_THRESHOLD_OPTION_SMALLER: char = '<';
334pub const MASTER_BRICK_THRESHOLD_OPTION_GREATER: char = '>';
335pub const MASTER_BRICK_ETHERNET_CONNECTION_DHCP: u8 = 0;
336pub const MASTER_BRICK_ETHERNET_CONNECTION_STATIC_IP: u8 = 1;
337pub const MASTER_BRICK_CONNECTION_TYPE_NONE: u8 = 0;
338pub const MASTER_BRICK_CONNECTION_TYPE_USB: u8 = 1;
339pub const MASTER_BRICK_CONNECTION_TYPE_SPI_STACK: u8 = 2;
340pub const MASTER_BRICK_CONNECTION_TYPE_CHIBI: u8 = 3;
341pub const MASTER_BRICK_CONNECTION_TYPE_RS485: u8 = 4;
342pub const MASTER_BRICK_CONNECTION_TYPE_WIFI: u8 = 5;
343pub const MASTER_BRICK_CONNECTION_TYPE_ETHERNET: u8 = 6;
344pub const MASTER_BRICK_CONNECTION_TYPE_WIFI2: u8 = 7;
345pub const MASTER_BRICK_WIFI2_PHY_MODE_B: u8 = 0;
346pub const MASTER_BRICK_WIFI2_PHY_MODE_G: u8 = 1;
347pub const MASTER_BRICK_WIFI2_PHY_MODE_N: u8 = 2;
348pub const MASTER_BRICK_WIFI2_CLIENT_STATUS_IDLE: u8 = 0;
349pub const MASTER_BRICK_WIFI2_CLIENT_STATUS_CONNECTING: u8 = 1;
350pub const MASTER_BRICK_WIFI2_CLIENT_STATUS_WRONG_PASSWORD: u8 = 2;
351pub const MASTER_BRICK_WIFI2_CLIENT_STATUS_NO_AP_FOUND: u8 = 3;
352pub const MASTER_BRICK_WIFI2_CLIENT_STATUS_CONNECT_FAILED: u8 = 4;
353pub const MASTER_BRICK_WIFI2_CLIENT_STATUS_GOT_IP: u8 = 5;
354pub const MASTER_BRICK_WIFI2_CLIENT_STATUS_UNKNOWN: u8 = 255;
355pub const MASTER_BRICK_WIFI2_AP_ENCRYPTION_OPEN: u8 = 0;
356pub const MASTER_BRICK_WIFI2_AP_ENCRYPTION_WEP: u8 = 1;
357pub const MASTER_BRICK_WIFI2_AP_ENCRYPTION_WPA_PSK: u8 = 2;
358pub const MASTER_BRICK_WIFI2_AP_ENCRYPTION_WPA2_PSK: u8 = 3;
359pub const MASTER_BRICK_WIFI2_AP_ENCRYPTION_WPA_WPA2_PSK: u8 = 4;
360pub const MASTER_BRICK_WIFI2_MESH_STATUS_DISABLED: u8 = 0;
361pub const MASTER_BRICK_WIFI2_MESH_STATUS_WIFI_CONNECTING: u8 = 1;
362pub const MASTER_BRICK_WIFI2_MESH_STATUS_GOT_IP: u8 = 2;
363pub const MASTER_BRICK_WIFI2_MESH_STATUS_MESH_LOCAL: u8 = 3;
364pub const MASTER_BRICK_WIFI2_MESH_STATUS_MESH_ONLINE: u8 = 4;
365pub const MASTER_BRICK_WIFI2_MESH_STATUS_AP_AVAILABLE: u8 = 5;
366pub const MASTER_BRICK_WIFI2_MESH_STATUS_AP_SETUP: u8 = 6;
367pub const MASTER_BRICK_WIFI2_MESH_STATUS_LEAF_AVAILABLE: u8 = 7;
368pub const MASTER_BRICK_COMMUNICATION_METHOD_NONE: u8 = 0;
369pub const MASTER_BRICK_COMMUNICATION_METHOD_USB: u8 = 1;
370pub const MASTER_BRICK_COMMUNICATION_METHOD_SPI_STACK: u8 = 2;
371pub const MASTER_BRICK_COMMUNICATION_METHOD_CHIBI: u8 = 3;
372pub const MASTER_BRICK_COMMUNICATION_METHOD_RS485: u8 = 4;
373pub const MASTER_BRICK_COMMUNICATION_METHOD_WIFI: u8 = 5;
374pub const MASTER_BRICK_COMMUNICATION_METHOD_ETHERNET: u8 = 6;
375pub const MASTER_BRICK_COMMUNICATION_METHOD_WIFI_V2: u8 = 7;
376
377#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
378pub struct ChibiErrorLog {
379 pub underrun: u16,
380 pub crc_error: u16,
381 pub no_ack: u16,
382 pub overflow: u16,
383}
384impl FromByteSlice for ChibiErrorLog {
385 fn bytes_expected() -> usize {
386 8
387 }
388 fn from_le_byte_slice(bytes: &[u8]) -> ChibiErrorLog {
389 ChibiErrorLog {
390 underrun: <u16>::from_le_byte_slice(&bytes[0..2]),
391 crc_error: <u16>::from_le_byte_slice(&bytes[2..4]),
392 no_ack: <u16>::from_le_byte_slice(&bytes[4..6]),
393 overflow: <u16>::from_le_byte_slice(&bytes[6..8]),
394 }
395 }
396}
397
398#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
399pub struct Rs485Configuration {
400 pub speed: u32,
401 pub parity: char,
402 pub stopbits: u8,
403}
404impl FromByteSlice for Rs485Configuration {
405 fn bytes_expected() -> usize {
406 6
407 }
408 fn from_le_byte_slice(bytes: &[u8]) -> Rs485Configuration {
409 Rs485Configuration {
410 speed: <u32>::from_le_byte_slice(&bytes[0..4]),
411 parity: <char>::from_le_byte_slice(&bytes[4..5]),
412 stopbits: <u8>::from_le_byte_slice(&bytes[5..6]),
413 }
414 }
415}
416
417#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
418pub struct WifiConfiguration {
419 pub ssid: String,
420 pub connection: u8,
421 pub ip: [u8; 4],
422 pub subnet_mask: [u8; 4],
423 pub gateway: [u8; 4],
424 pub port: u16,
425}
426impl FromByteSlice for WifiConfiguration {
427 fn bytes_expected() -> usize {
428 47
429 }
430 fn from_le_byte_slice(bytes: &[u8]) -> WifiConfiguration {
431 WifiConfiguration {
432 ssid: <String>::from_le_byte_slice(&bytes[0..32]),
433 connection: <u8>::from_le_byte_slice(&bytes[32..33]),
434 ip: <[u8; 4]>::from_le_byte_slice(&bytes[33..37]),
435 subnet_mask: <[u8; 4]>::from_le_byte_slice(&bytes[37..41]),
436 gateway: <[u8; 4]>::from_le_byte_slice(&bytes[41..45]),
437 port: <u16>::from_le_byte_slice(&bytes[45..47]),
438 }
439 }
440}
441
442#[derive(Clone)]
443pub struct WifiEncryption {
444 pub encryption: u8,
445 pub key: String,
446 pub key_index: u8,
447 pub eap_options: u8,
448 pub ca_certificate_length: u16,
449 pub client_certificate_length: u16,
450 pub private_key_length: u16,
451}
452impl FromByteSlice for WifiEncryption {
453 fn bytes_expected() -> usize {
454 59
455 }
456 fn from_le_byte_slice(bytes: &[u8]) -> WifiEncryption {
457 WifiEncryption {
458 encryption: <u8>::from_le_byte_slice(&bytes[0..1]),
459 key: <String>::from_le_byte_slice(&bytes[1..51]),
460 key_index: <u8>::from_le_byte_slice(&bytes[51..52]),
461 eap_options: <u8>::from_le_byte_slice(&bytes[52..53]),
462 ca_certificate_length: <u16>::from_le_byte_slice(&bytes[53..55]),
463 client_certificate_length: <u16>::from_le_byte_slice(&bytes[55..57]),
464 private_key_length: <u16>::from_le_byte_slice(&bytes[57..59]),
465 }
466 }
467}
468
469#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
470pub struct WifiStatus {
471 pub mac_address: [u8; 6],
472 pub bssid: [u8; 6],
473 pub channel: u8,
474 pub rssi: i16,
475 pub ip: [u8; 4],
476 pub subnet_mask: [u8; 4],
477 pub gateway: [u8; 4],
478 pub rx_count: u32,
479 pub tx_count: u32,
480 pub state: u8,
481}
482impl FromByteSlice for WifiStatus {
483 fn bytes_expected() -> usize {
484 36
485 }
486 fn from_le_byte_slice(bytes: &[u8]) -> WifiStatus {
487 WifiStatus {
488 mac_address: <[u8; 6]>::from_le_byte_slice(&bytes[0..6]),
489 bssid: <[u8; 6]>::from_le_byte_slice(&bytes[6..12]),
490 channel: <u8>::from_le_byte_slice(&bytes[12..13]),
491 rssi: <i16>::from_le_byte_slice(&bytes[13..15]),
492 ip: <[u8; 4]>::from_le_byte_slice(&bytes[15..19]),
493 subnet_mask: <[u8; 4]>::from_le_byte_slice(&bytes[19..23]),
494 gateway: <[u8; 4]>::from_le_byte_slice(&bytes[23..27]),
495 rx_count: <u32>::from_le_byte_slice(&bytes[27..31]),
496 tx_count: <u32>::from_le_byte_slice(&bytes[31..35]),
497 state: <u8>::from_le_byte_slice(&bytes[35..36]),
498 }
499 }
500}
501
502#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
503pub struct WifiCertificate {
504 pub data: [u8; 32],
505 pub data_length: u8,
506}
507impl FromByteSlice for WifiCertificate {
508 fn bytes_expected() -> usize {
509 33
510 }
511 fn from_le_byte_slice(bytes: &[u8]) -> WifiCertificate {
512 WifiCertificate { data: <[u8; 32]>::from_le_byte_slice(&bytes[0..32]), data_length: <u8>::from_le_byte_slice(&bytes[32..33]) }
513 }
514}
515
516#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
517pub struct WifiBufferInfo {
518 pub overflow: u32,
519 pub low_watermark: u16,
520 pub used: u16,
521}
522impl FromByteSlice for WifiBufferInfo {
523 fn bytes_expected() -> usize {
524 8
525 }
526 fn from_le_byte_slice(bytes: &[u8]) -> WifiBufferInfo {
527 WifiBufferInfo {
528 overflow: <u32>::from_le_byte_slice(&bytes[0..4]),
529 low_watermark: <u16>::from_le_byte_slice(&bytes[4..6]),
530 used: <u16>::from_le_byte_slice(&bytes[6..8]),
531 }
532 }
533}
534
535#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
536pub struct StackCurrentCallbackThreshold {
537 pub option: char,
538 pub min: u16,
539 pub max: u16,
540}
541impl FromByteSlice for StackCurrentCallbackThreshold {
542 fn bytes_expected() -> usize {
543 5
544 }
545 fn from_le_byte_slice(bytes: &[u8]) -> StackCurrentCallbackThreshold {
546 StackCurrentCallbackThreshold {
547 option: <char>::from_le_byte_slice(&bytes[0..1]),
548 min: <u16>::from_le_byte_slice(&bytes[1..3]),
549 max: <u16>::from_le_byte_slice(&bytes[3..5]),
550 }
551 }
552}
553
554#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
555pub struct StackVoltageCallbackThreshold {
556 pub option: char,
557 pub min: u16,
558 pub max: u16,
559}
560impl FromByteSlice for StackVoltageCallbackThreshold {
561 fn bytes_expected() -> usize {
562 5
563 }
564 fn from_le_byte_slice(bytes: &[u8]) -> StackVoltageCallbackThreshold {
565 StackVoltageCallbackThreshold {
566 option: <char>::from_le_byte_slice(&bytes[0..1]),
567 min: <u16>::from_le_byte_slice(&bytes[1..3]),
568 max: <u16>::from_le_byte_slice(&bytes[3..5]),
569 }
570 }
571}
572
573#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
574pub struct UsbVoltageCallbackThreshold {
575 pub option: char,
576 pub min: u16,
577 pub max: u16,
578}
579impl FromByteSlice for UsbVoltageCallbackThreshold {
580 fn bytes_expected() -> usize {
581 5
582 }
583 fn from_le_byte_slice(bytes: &[u8]) -> UsbVoltageCallbackThreshold {
584 UsbVoltageCallbackThreshold {
585 option: <char>::from_le_byte_slice(&bytes[0..1]),
586 min: <u16>::from_le_byte_slice(&bytes[1..3]),
587 max: <u16>::from_le_byte_slice(&bytes[3..5]),
588 }
589 }
590}
591
592#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
593pub struct EthernetConfiguration {
594 pub connection: u8,
595 pub ip: [u8; 4],
596 pub subnet_mask: [u8; 4],
597 pub gateway: [u8; 4],
598 pub port: u16,
599}
600impl FromByteSlice for EthernetConfiguration {
601 fn bytes_expected() -> usize {
602 15
603 }
604 fn from_le_byte_slice(bytes: &[u8]) -> EthernetConfiguration {
605 EthernetConfiguration {
606 connection: <u8>::from_le_byte_slice(&bytes[0..1]),
607 ip: <[u8; 4]>::from_le_byte_slice(&bytes[1..5]),
608 subnet_mask: <[u8; 4]>::from_le_byte_slice(&bytes[5..9]),
609 gateway: <[u8; 4]>::from_le_byte_slice(&bytes[9..13]),
610 port: <u16>::from_le_byte_slice(&bytes[13..15]),
611 }
612 }
613}
614
615#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
616pub struct EthernetStatus {
617 pub mac_address: [u8; 6],
618 pub ip: [u8; 4],
619 pub subnet_mask: [u8; 4],
620 pub gateway: [u8; 4],
621 pub rx_count: u32,
622 pub tx_count: u32,
623 pub hostname: String,
624}
625impl FromByteSlice for EthernetStatus {
626 fn bytes_expected() -> usize {
627 58
628 }
629 fn from_le_byte_slice(bytes: &[u8]) -> EthernetStatus {
630 EthernetStatus {
631 mac_address: <[u8; 6]>::from_le_byte_slice(&bytes[0..6]),
632 ip: <[u8; 4]>::from_le_byte_slice(&bytes[6..10]),
633 subnet_mask: <[u8; 4]>::from_le_byte_slice(&bytes[10..14]),
634 gateway: <[u8; 4]>::from_le_byte_slice(&bytes[14..18]),
635 rx_count: <u32>::from_le_byte_slice(&bytes[18..22]),
636 tx_count: <u32>::from_le_byte_slice(&bytes[22..26]),
637 hostname: <String>::from_le_byte_slice(&bytes[26..58]),
638 }
639 }
640}
641
642#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
643pub struct EthernetWebsocketConfiguration {
644 pub sockets: u8,
645 pub port: u16,
646}
647impl FromByteSlice for EthernetWebsocketConfiguration {
648 fn bytes_expected() -> usize {
649 3
650 }
651 fn from_le_byte_slice(bytes: &[u8]) -> EthernetWebsocketConfiguration {
652 EthernetWebsocketConfiguration { sockets: <u8>::from_le_byte_slice(&bytes[0..1]), port: <u16>::from_le_byte_slice(&bytes[1..3]) }
653 }
654}
655
656#[derive(Clone, Copy)]
657pub struct ReadWifi2SerialPort {
658 pub data: [u8; 60],
659 pub result: u8,
660}
661impl FromByteSlice for ReadWifi2SerialPort {
662 fn bytes_expected() -> usize {
663 61
664 }
665 fn from_le_byte_slice(bytes: &[u8]) -> ReadWifi2SerialPort {
666 ReadWifi2SerialPort { data: <[u8; 60]>::from_le_byte_slice(&bytes[0..60]), result: <u8>::from_le_byte_slice(&bytes[60..61]) }
667 }
668}
669
670#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
671pub struct Wifi2Configuration {
672 pub port: u16,
673 pub websocket_port: u16,
674 pub website_port: u16,
675 pub phy_mode: u8,
676 pub sleep_mode: u8,
677 pub website: u8,
678}
679impl FromByteSlice for Wifi2Configuration {
680 fn bytes_expected() -> usize {
681 9
682 }
683 fn from_le_byte_slice(bytes: &[u8]) -> Wifi2Configuration {
684 Wifi2Configuration {
685 port: <u16>::from_le_byte_slice(&bytes[0..2]),
686 websocket_port: <u16>::from_le_byte_slice(&bytes[2..4]),
687 website_port: <u16>::from_le_byte_slice(&bytes[4..6]),
688 phy_mode: <u8>::from_le_byte_slice(&bytes[6..7]),
689 sleep_mode: <u8>::from_le_byte_slice(&bytes[7..8]),
690 website: <u8>::from_le_byte_slice(&bytes[8..9]),
691 }
692 }
693}
694
695#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
696pub struct Wifi2Status {
697 pub client_enabled: bool,
698 pub client_status: u8,
699 pub client_ip: [u8; 4],
700 pub client_subnet_mask: [u8; 4],
701 pub client_gateway: [u8; 4],
702 pub client_mac_address: [u8; 6],
703 pub client_rx_count: u32,
704 pub client_tx_count: u32,
705 pub client_rssi: i8,
706 pub ap_enabled: bool,
707 pub ap_ip: [u8; 4],
708 pub ap_subnet_mask: [u8; 4],
709 pub ap_gateway: [u8; 4],
710 pub ap_mac_address: [u8; 6],
711 pub ap_rx_count: u32,
712 pub ap_tx_count: u32,
713 pub ap_connected_count: u8,
714}
715impl FromByteSlice for Wifi2Status {
716 fn bytes_expected() -> usize {
717 57
718 }
719 fn from_le_byte_slice(bytes: &[u8]) -> Wifi2Status {
720 Wifi2Status {
721 client_enabled: <bool>::from_le_byte_slice(&bytes[0..1]),
722 client_status: <u8>::from_le_byte_slice(&bytes[1..2]),
723 client_ip: <[u8; 4]>::from_le_byte_slice(&bytes[2..6]),
724 client_subnet_mask: <[u8; 4]>::from_le_byte_slice(&bytes[6..10]),
725 client_gateway: <[u8; 4]>::from_le_byte_slice(&bytes[10..14]),
726 client_mac_address: <[u8; 6]>::from_le_byte_slice(&bytes[14..20]),
727 client_rx_count: <u32>::from_le_byte_slice(&bytes[20..24]),
728 client_tx_count: <u32>::from_le_byte_slice(&bytes[24..28]),
729 client_rssi: <i8>::from_le_byte_slice(&bytes[28..29]),
730 ap_enabled: <bool>::from_le_byte_slice(&bytes[29..30]),
731 ap_ip: <[u8; 4]>::from_le_byte_slice(&bytes[30..34]),
732 ap_subnet_mask: <[u8; 4]>::from_le_byte_slice(&bytes[34..38]),
733 ap_gateway: <[u8; 4]>::from_le_byte_slice(&bytes[38..42]),
734 ap_mac_address: <[u8; 6]>::from_le_byte_slice(&bytes[42..48]),
735 ap_rx_count: <u32>::from_le_byte_slice(&bytes[48..52]),
736 ap_tx_count: <u32>::from_le_byte_slice(&bytes[52..56]),
737 ap_connected_count: <u8>::from_le_byte_slice(&bytes[56..57]),
738 }
739 }
740}
741
742#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
743pub struct Wifi2ClientConfiguration {
744 pub enable: bool,
745 pub ssid: String,
746 pub ip: [u8; 4],
747 pub subnet_mask: [u8; 4],
748 pub gateway: [u8; 4],
749 pub mac_address: [u8; 6],
750 pub bssid: [u8; 6],
751}
752impl FromByteSlice for Wifi2ClientConfiguration {
753 fn bytes_expected() -> usize {
754 57
755 }
756 fn from_le_byte_slice(bytes: &[u8]) -> Wifi2ClientConfiguration {
757 Wifi2ClientConfiguration {
758 enable: <bool>::from_le_byte_slice(&bytes[0..1]),
759 ssid: <String>::from_le_byte_slice(&bytes[1..33]),
760 ip: <[u8; 4]>::from_le_byte_slice(&bytes[33..37]),
761 subnet_mask: <[u8; 4]>::from_le_byte_slice(&bytes[37..41]),
762 gateway: <[u8; 4]>::from_le_byte_slice(&bytes[41..45]),
763 mac_address: <[u8; 6]>::from_le_byte_slice(&bytes[45..51]),
764 bssid: <[u8; 6]>::from_le_byte_slice(&bytes[51..57]),
765 }
766 }
767}
768
769#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
770pub struct Wifi2ApConfiguration {
771 pub enable: bool,
772 pub ssid: String,
773 pub ip: [u8; 4],
774 pub subnet_mask: [u8; 4],
775 pub gateway: [u8; 4],
776 pub encryption: u8,
777 pub hidden: bool,
778 pub channel: u8,
779 pub mac_address: [u8; 6],
780}
781impl FromByteSlice for Wifi2ApConfiguration {
782 fn bytes_expected() -> usize {
783 54
784 }
785 fn from_le_byte_slice(bytes: &[u8]) -> Wifi2ApConfiguration {
786 Wifi2ApConfiguration {
787 enable: <bool>::from_le_byte_slice(&bytes[0..1]),
788 ssid: <String>::from_le_byte_slice(&bytes[1..33]),
789 ip: <[u8; 4]>::from_le_byte_slice(&bytes[33..37]),
790 subnet_mask: <[u8; 4]>::from_le_byte_slice(&bytes[37..41]),
791 gateway: <[u8; 4]>::from_le_byte_slice(&bytes[41..45]),
792 encryption: <u8>::from_le_byte_slice(&bytes[45..46]),
793 hidden: <bool>::from_le_byte_slice(&bytes[46..47]),
794 channel: <u8>::from_le_byte_slice(&bytes[47..48]),
795 mac_address: <[u8; 6]>::from_le_byte_slice(&bytes[48..54]),
796 }
797 }
798}
799
800#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
801pub struct Wifi2MeshConfiguration {
802 pub enable: bool,
803 pub root_ip: [u8; 4],
804 pub root_subnet_mask: [u8; 4],
805 pub root_gateway: [u8; 4],
806 pub router_bssid: [u8; 6],
807 pub group_id: [u8; 6],
808 pub group_ssid_prefix: String,
809 pub gateway_ip: [u8; 4],
810 pub gateway_port: u16,
811}
812impl FromByteSlice for Wifi2MeshConfiguration {
813 fn bytes_expected() -> usize {
814 47
815 }
816 fn from_le_byte_slice(bytes: &[u8]) -> Wifi2MeshConfiguration {
817 Wifi2MeshConfiguration {
818 enable: <bool>::from_le_byte_slice(&bytes[0..1]),
819 root_ip: <[u8; 4]>::from_le_byte_slice(&bytes[1..5]),
820 root_subnet_mask: <[u8; 4]>::from_le_byte_slice(&bytes[5..9]),
821 root_gateway: <[u8; 4]>::from_le_byte_slice(&bytes[9..13]),
822 router_bssid: <[u8; 6]>::from_le_byte_slice(&bytes[13..19]),
823 group_id: <[u8; 6]>::from_le_byte_slice(&bytes[19..25]),
824 group_ssid_prefix: <String>::from_le_byte_slice(&bytes[25..41]),
825 gateway_ip: <[u8; 4]>::from_le_byte_slice(&bytes[41..45]),
826 gateway_port: <u16>::from_le_byte_slice(&bytes[45..47]),
827 }
828 }
829}
830
831#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
832pub struct Wifi2MeshCommonStatus {
833 pub status: u8,
834 pub root_node: bool,
835 pub root_candidate: bool,
836 pub connected_nodes: u16,
837 pub rx_count: u32,
838 pub tx_count: u32,
839}
840impl FromByteSlice for Wifi2MeshCommonStatus {
841 fn bytes_expected() -> usize {
842 13
843 }
844 fn from_le_byte_slice(bytes: &[u8]) -> Wifi2MeshCommonStatus {
845 Wifi2MeshCommonStatus {
846 status: <u8>::from_le_byte_slice(&bytes[0..1]),
847 root_node: <bool>::from_le_byte_slice(&bytes[1..2]),
848 root_candidate: <bool>::from_le_byte_slice(&bytes[2..3]),
849 connected_nodes: <u16>::from_le_byte_slice(&bytes[3..5]),
850 rx_count: <u32>::from_le_byte_slice(&bytes[5..9]),
851 tx_count: <u32>::from_le_byte_slice(&bytes[9..13]),
852 }
853 }
854}
855
856#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
857pub struct Wifi2MeshClientStatus {
858 pub hostname: String,
859 pub ip: [u8; 4],
860 pub subnet_mask: [u8; 4],
861 pub gateway: [u8; 4],
862 pub mac_address: [u8; 6],
863}
864impl FromByteSlice for Wifi2MeshClientStatus {
865 fn bytes_expected() -> usize {
866 50
867 }
868 fn from_le_byte_slice(bytes: &[u8]) -> Wifi2MeshClientStatus {
869 Wifi2MeshClientStatus {
870 hostname: <String>::from_le_byte_slice(&bytes[0..32]),
871 ip: <[u8; 4]>::from_le_byte_slice(&bytes[32..36]),
872 subnet_mask: <[u8; 4]>::from_le_byte_slice(&bytes[36..40]),
873 gateway: <[u8; 4]>::from_le_byte_slice(&bytes[40..44]),
874 mac_address: <[u8; 6]>::from_le_byte_slice(&bytes[44..50]),
875 }
876 }
877}
878
879#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
880pub struct Wifi2MeshApStatus {
881 pub ssid: String,
882 pub ip: [u8; 4],
883 pub subnet_mask: [u8; 4],
884 pub gateway: [u8; 4],
885 pub mac_address: [u8; 6],
886}
887impl FromByteSlice for Wifi2MeshApStatus {
888 fn bytes_expected() -> usize {
889 50
890 }
891 fn from_le_byte_slice(bytes: &[u8]) -> Wifi2MeshApStatus {
892 Wifi2MeshApStatus {
893 ssid: <String>::from_le_byte_slice(&bytes[0..32]),
894 ip: <[u8; 4]>::from_le_byte_slice(&bytes[32..36]),
895 subnet_mask: <[u8; 4]>::from_le_byte_slice(&bytes[36..40]),
896 gateway: <[u8; 4]>::from_le_byte_slice(&bytes[40..44]),
897 mac_address: <[u8; 6]>::from_le_byte_slice(&bytes[44..50]),
898 }
899 }
900}
901
902#[derive(Clone, Copy)]
903pub struct SetBrickletXmcFlashConfig {
904 pub return_value: u32,
905 pub return_data: [u8; 60],
906}
907impl FromByteSlice for SetBrickletXmcFlashConfig {
908 fn bytes_expected() -> usize {
909 64
910 }
911 fn from_le_byte_slice(bytes: &[u8]) -> SetBrickletXmcFlashConfig {
912 SetBrickletXmcFlashConfig {
913 return_value: <u32>::from_le_byte_slice(&bytes[0..4]),
914 return_data: <[u8; 60]>::from_le_byte_slice(&bytes[4..64]),
915 }
916 }
917}
918
919#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
920pub struct SpitfpBaudrateConfig {
921 pub enable_dynamic_baudrate: bool,
922 pub minimum_dynamic_baudrate: u32,
923}
924impl FromByteSlice for SpitfpBaudrateConfig {
925 fn bytes_expected() -> usize {
926 5
927 }
928 fn from_le_byte_slice(bytes: &[u8]) -> SpitfpBaudrateConfig {
929 SpitfpBaudrateConfig {
930 enable_dynamic_baudrate: <bool>::from_le_byte_slice(&bytes[0..1]),
931 minimum_dynamic_baudrate: <u32>::from_le_byte_slice(&bytes[1..5]),
932 }
933 }
934}
935
936#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
937pub struct SpitfpErrorCount {
938 pub error_count_ack_checksum: u32,
939 pub error_count_message_checksum: u32,
940 pub error_count_frame: u32,
941 pub error_count_overflow: u32,
942}
943impl FromByteSlice for SpitfpErrorCount {
944 fn bytes_expected() -> usize {
945 16
946 }
947 fn from_le_byte_slice(bytes: &[u8]) -> SpitfpErrorCount {
948 SpitfpErrorCount {
949 error_count_ack_checksum: <u32>::from_le_byte_slice(&bytes[0..4]),
950 error_count_message_checksum: <u32>::from_le_byte_slice(&bytes[4..8]),
951 error_count_frame: <u32>::from_le_byte_slice(&bytes[8..12]),
952 error_count_overflow: <u32>::from_le_byte_slice(&bytes[12..16]),
953 }
954 }
955}
956
957#[derive(Clone)]
958pub struct Protocol1BrickletName {
959 pub protocol_version: u8,
960 pub firmware_version: [u8; 3],
961 pub name: String,
962}
963impl FromByteSlice for Protocol1BrickletName {
964 fn bytes_expected() -> usize {
965 44
966 }
967 fn from_le_byte_slice(bytes: &[u8]) -> Protocol1BrickletName {
968 Protocol1BrickletName {
969 protocol_version: <u8>::from_le_byte_slice(&bytes[0..1]),
970 firmware_version: <[u8; 3]>::from_le_byte_slice(&bytes[1..4]),
971 name: <String>::from_le_byte_slice(&bytes[4..44]),
972 }
973 }
974}
975
976#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
977pub struct Identity {
978 pub uid: String,
979 pub connected_uid: String,
980 pub position: char,
981 pub hardware_version: [u8; 3],
982 pub firmware_version: [u8; 3],
983 pub device_identifier: u16,
984}
985impl FromByteSlice for Identity {
986 fn bytes_expected() -> usize {
987 25
988 }
989 fn from_le_byte_slice(bytes: &[u8]) -> Identity {
990 Identity {
991 uid: <String>::from_le_byte_slice(&bytes[0..8]),
992 connected_uid: <String>::from_le_byte_slice(&bytes[8..16]),
993 position: <char>::from_le_byte_slice(&bytes[16..17]),
994 hardware_version: <[u8; 3]>::from_le_byte_slice(&bytes[17..20]),
995 firmware_version: <[u8; 3]>::from_le_byte_slice(&bytes[20..23]),
996 device_identifier: <u16>::from_le_byte_slice(&bytes[23..25]),
997 }
998 }
999}
1000
1001#[derive(Clone)]
1003pub struct MasterBrick {
1004 device: Device,
1005}
1006impl MasterBrick {
1007 pub const DEVICE_IDENTIFIER: u16 = 13;
1008 pub const DEVICE_DISPLAY_NAME: &'static str = "Master Brick";
1009 pub fn new(uid: Uid, connection: AsyncIpConnection) -> MasterBrick {
1011 let mut result = MasterBrick { device: Device::new([2, 0, 10], uid, connection, Self::DEVICE_DISPLAY_NAME) };
1012 result.device.response_expected[u8::from(MasterBrickFunction::GetStackVoltage) as usize] = ResponseExpectedFlag::AlwaysTrue;
1013 result.device.response_expected[u8::from(MasterBrickFunction::GetStackCurrent) as usize] = ResponseExpectedFlag::AlwaysTrue;
1014 result.device.response_expected[u8::from(MasterBrickFunction::SetExtensionType) as usize] = ResponseExpectedFlag::False;
1015 result.device.response_expected[u8::from(MasterBrickFunction::GetExtensionType) as usize] = ResponseExpectedFlag::AlwaysTrue;
1016 result.device.response_expected[u8::from(MasterBrickFunction::IsChibiPresent) as usize] = ResponseExpectedFlag::AlwaysTrue;
1017 result.device.response_expected[u8::from(MasterBrickFunction::SetChibiAddress) as usize] = ResponseExpectedFlag::False;
1018 result.device.response_expected[u8::from(MasterBrickFunction::GetChibiAddress) as usize] = ResponseExpectedFlag::AlwaysTrue;
1019 result.device.response_expected[u8::from(MasterBrickFunction::SetChibiMasterAddress) as usize] = ResponseExpectedFlag::False;
1020 result.device.response_expected[u8::from(MasterBrickFunction::GetChibiMasterAddress) as usize] = ResponseExpectedFlag::AlwaysTrue;
1021 result.device.response_expected[u8::from(MasterBrickFunction::SetChibiSlaveAddress) as usize] = ResponseExpectedFlag::False;
1022 result.device.response_expected[u8::from(MasterBrickFunction::GetChibiSlaveAddress) as usize] = ResponseExpectedFlag::AlwaysTrue;
1023 result.device.response_expected[u8::from(MasterBrickFunction::GetChibiSignalStrength) as usize] = ResponseExpectedFlag::AlwaysTrue;
1024 result.device.response_expected[u8::from(MasterBrickFunction::GetChibiErrorLog) as usize] = ResponseExpectedFlag::AlwaysTrue;
1025 result.device.response_expected[u8::from(MasterBrickFunction::SetChibiFrequency) as usize] = ResponseExpectedFlag::False;
1026 result.device.response_expected[u8::from(MasterBrickFunction::GetChibiFrequency) as usize] = ResponseExpectedFlag::AlwaysTrue;
1027 result.device.response_expected[u8::from(MasterBrickFunction::SetChibiChannel) as usize] = ResponseExpectedFlag::False;
1028 result.device.response_expected[u8::from(MasterBrickFunction::GetChibiChannel) as usize] = ResponseExpectedFlag::AlwaysTrue;
1029 result.device.response_expected[u8::from(MasterBrickFunction::IsRs485Present) as usize] = ResponseExpectedFlag::AlwaysTrue;
1030 result.device.response_expected[u8::from(MasterBrickFunction::SetRs485Address) as usize] = ResponseExpectedFlag::False;
1031 result.device.response_expected[u8::from(MasterBrickFunction::GetRs485Address) as usize] = ResponseExpectedFlag::AlwaysTrue;
1032 result.device.response_expected[u8::from(MasterBrickFunction::SetRs485SlaveAddress) as usize] = ResponseExpectedFlag::False;
1033 result.device.response_expected[u8::from(MasterBrickFunction::GetRs485SlaveAddress) as usize] = ResponseExpectedFlag::AlwaysTrue;
1034 result.device.response_expected[u8::from(MasterBrickFunction::GetRs485ErrorLog) as usize] = ResponseExpectedFlag::AlwaysTrue;
1035 result.device.response_expected[u8::from(MasterBrickFunction::SetRs485Configuration) as usize] = ResponseExpectedFlag::False;
1036 result.device.response_expected[u8::from(MasterBrickFunction::GetRs485Configuration) as usize] = ResponseExpectedFlag::AlwaysTrue;
1037 result.device.response_expected[u8::from(MasterBrickFunction::IsWifiPresent) as usize] = ResponseExpectedFlag::AlwaysTrue;
1038 result.device.response_expected[u8::from(MasterBrickFunction::SetWifiConfiguration) as usize] = ResponseExpectedFlag::False;
1039 result.device.response_expected[u8::from(MasterBrickFunction::GetWifiConfiguration) as usize] = ResponseExpectedFlag::AlwaysTrue;
1040 result.device.response_expected[u8::from(MasterBrickFunction::SetWifiEncryption) as usize] = ResponseExpectedFlag::False;
1041 result.device.response_expected[u8::from(MasterBrickFunction::GetWifiEncryption) as usize] = ResponseExpectedFlag::AlwaysTrue;
1042 result.device.response_expected[u8::from(MasterBrickFunction::GetWifiStatus) as usize] = ResponseExpectedFlag::AlwaysTrue;
1043 result.device.response_expected[u8::from(MasterBrickFunction::RefreshWifiStatus) as usize] = ResponseExpectedFlag::False;
1044 result.device.response_expected[u8::from(MasterBrickFunction::SetWifiCertificate) as usize] = ResponseExpectedFlag::False;
1045 result.device.response_expected[u8::from(MasterBrickFunction::GetWifiCertificate) as usize] = ResponseExpectedFlag::AlwaysTrue;
1046 result.device.response_expected[u8::from(MasterBrickFunction::SetWifiPowerMode) as usize] = ResponseExpectedFlag::False;
1047 result.device.response_expected[u8::from(MasterBrickFunction::GetWifiPowerMode) as usize] = ResponseExpectedFlag::AlwaysTrue;
1048 result.device.response_expected[u8::from(MasterBrickFunction::GetWifiBufferInfo) as usize] = ResponseExpectedFlag::AlwaysTrue;
1049 result.device.response_expected[u8::from(MasterBrickFunction::SetWifiRegulatoryDomain) as usize] = ResponseExpectedFlag::False;
1050 result.device.response_expected[u8::from(MasterBrickFunction::GetWifiRegulatoryDomain) as usize] = ResponseExpectedFlag::AlwaysTrue;
1051 result.device.response_expected[u8::from(MasterBrickFunction::GetUsbVoltage) as usize] = ResponseExpectedFlag::AlwaysTrue;
1052 result.device.response_expected[u8::from(MasterBrickFunction::SetLongWifiKey) as usize] = ResponseExpectedFlag::False;
1053 result.device.response_expected[u8::from(MasterBrickFunction::GetLongWifiKey) as usize] = ResponseExpectedFlag::AlwaysTrue;
1054 result.device.response_expected[u8::from(MasterBrickFunction::SetWifiHostname) as usize] = ResponseExpectedFlag::False;
1055 result.device.response_expected[u8::from(MasterBrickFunction::GetWifiHostname) as usize] = ResponseExpectedFlag::AlwaysTrue;
1056 result.device.response_expected[u8::from(MasterBrickFunction::SetStackCurrentCallbackPeriod) as usize] = ResponseExpectedFlag::True;
1057 result.device.response_expected[u8::from(MasterBrickFunction::GetStackCurrentCallbackPeriod) as usize] =
1058 ResponseExpectedFlag::AlwaysTrue;
1059 result.device.response_expected[u8::from(MasterBrickFunction::SetStackVoltageCallbackPeriod) as usize] = ResponseExpectedFlag::True;
1060 result.device.response_expected[u8::from(MasterBrickFunction::GetStackVoltageCallbackPeriod) as usize] =
1061 ResponseExpectedFlag::AlwaysTrue;
1062 result.device.response_expected[u8::from(MasterBrickFunction::SetUsbVoltageCallbackPeriod) as usize] = ResponseExpectedFlag::True;
1063 result.device.response_expected[u8::from(MasterBrickFunction::GetUsbVoltageCallbackPeriod) as usize] =
1064 ResponseExpectedFlag::AlwaysTrue;
1065 result.device.response_expected[u8::from(MasterBrickFunction::SetStackCurrentCallbackThreshold) as usize] =
1066 ResponseExpectedFlag::True;
1067 result.device.response_expected[u8::from(MasterBrickFunction::GetStackCurrentCallbackThreshold) as usize] =
1068 ResponseExpectedFlag::AlwaysTrue;
1069 result.device.response_expected[u8::from(MasterBrickFunction::SetStackVoltageCallbackThreshold) as usize] =
1070 ResponseExpectedFlag::True;
1071 result.device.response_expected[u8::from(MasterBrickFunction::GetStackVoltageCallbackThreshold) as usize] =
1072 ResponseExpectedFlag::AlwaysTrue;
1073 result.device.response_expected[u8::from(MasterBrickFunction::SetUsbVoltageCallbackThreshold) as usize] =
1074 ResponseExpectedFlag::True;
1075 result.device.response_expected[u8::from(MasterBrickFunction::GetUsbVoltageCallbackThreshold) as usize] =
1076 ResponseExpectedFlag::AlwaysTrue;
1077 result.device.response_expected[u8::from(MasterBrickFunction::SetDebouncePeriod) as usize] = ResponseExpectedFlag::True;
1078 result.device.response_expected[u8::from(MasterBrickFunction::GetDebouncePeriod) as usize] = ResponseExpectedFlag::AlwaysTrue;
1079 result.device.response_expected[u8::from(MasterBrickFunction::IsEthernetPresent) as usize] = ResponseExpectedFlag::AlwaysTrue;
1080 result.device.response_expected[u8::from(MasterBrickFunction::SetEthernetConfiguration) as usize] = ResponseExpectedFlag::False;
1081 result.device.response_expected[u8::from(MasterBrickFunction::GetEthernetConfiguration) as usize] =
1082 ResponseExpectedFlag::AlwaysTrue;
1083 result.device.response_expected[u8::from(MasterBrickFunction::GetEthernetStatus) as usize] = ResponseExpectedFlag::AlwaysTrue;
1084 result.device.response_expected[u8::from(MasterBrickFunction::SetEthernetHostname) as usize] = ResponseExpectedFlag::False;
1085 result.device.response_expected[u8::from(MasterBrickFunction::SetEthernetMacAddress) as usize] = ResponseExpectedFlag::False;
1086 result.device.response_expected[u8::from(MasterBrickFunction::SetEthernetWebsocketConfiguration) as usize] =
1087 ResponseExpectedFlag::False;
1088 result.device.response_expected[u8::from(MasterBrickFunction::GetEthernetWebsocketConfiguration) as usize] =
1089 ResponseExpectedFlag::AlwaysTrue;
1090 result.device.response_expected[u8::from(MasterBrickFunction::SetEthernetAuthenticationSecret) as usize] =
1091 ResponseExpectedFlag::False;
1092 result.device.response_expected[u8::from(MasterBrickFunction::GetEthernetAuthenticationSecret) as usize] =
1093 ResponseExpectedFlag::AlwaysTrue;
1094 result.device.response_expected[u8::from(MasterBrickFunction::SetWifiAuthenticationSecret) as usize] = ResponseExpectedFlag::False;
1095 result.device.response_expected[u8::from(MasterBrickFunction::GetWifiAuthenticationSecret) as usize] =
1096 ResponseExpectedFlag::AlwaysTrue;
1097 result.device.response_expected[u8::from(MasterBrickFunction::GetConnectionType) as usize] = ResponseExpectedFlag::AlwaysTrue;
1098 result.device.response_expected[u8::from(MasterBrickFunction::IsWifi2Present) as usize] = ResponseExpectedFlag::AlwaysTrue;
1099 result.device.response_expected[u8::from(MasterBrickFunction::StartWifi2Bootloader) as usize] = ResponseExpectedFlag::AlwaysTrue;
1100 result.device.response_expected[u8::from(MasterBrickFunction::WriteWifi2SerialPort) as usize] = ResponseExpectedFlag::AlwaysTrue;
1101 result.device.response_expected[u8::from(MasterBrickFunction::ReadWifi2SerialPort) as usize] = ResponseExpectedFlag::AlwaysTrue;
1102 result.device.response_expected[u8::from(MasterBrickFunction::SetWifi2AuthenticationSecret) as usize] = ResponseExpectedFlag::False;
1103 result.device.response_expected[u8::from(MasterBrickFunction::GetWifi2AuthenticationSecret) as usize] =
1104 ResponseExpectedFlag::AlwaysTrue;
1105 result.device.response_expected[u8::from(MasterBrickFunction::SetWifi2Configuration) as usize] = ResponseExpectedFlag::False;
1106 result.device.response_expected[u8::from(MasterBrickFunction::GetWifi2Configuration) as usize] = ResponseExpectedFlag::AlwaysTrue;
1107 result.device.response_expected[u8::from(MasterBrickFunction::GetWifi2Status) as usize] = ResponseExpectedFlag::AlwaysTrue;
1108 result.device.response_expected[u8::from(MasterBrickFunction::SetWifi2ClientConfiguration) as usize] = ResponseExpectedFlag::False;
1109 result.device.response_expected[u8::from(MasterBrickFunction::GetWifi2ClientConfiguration) as usize] =
1110 ResponseExpectedFlag::AlwaysTrue;
1111 result.device.response_expected[u8::from(MasterBrickFunction::SetWifi2ClientHostname) as usize] = ResponseExpectedFlag::False;
1112 result.device.response_expected[u8::from(MasterBrickFunction::GetWifi2ClientHostname) as usize] = ResponseExpectedFlag::AlwaysTrue;
1113 result.device.response_expected[u8::from(MasterBrickFunction::SetWifi2ClientPassword) as usize] = ResponseExpectedFlag::False;
1114 result.device.response_expected[u8::from(MasterBrickFunction::GetWifi2ClientPassword) as usize] = ResponseExpectedFlag::AlwaysTrue;
1115 result.device.response_expected[u8::from(MasterBrickFunction::SetWifi2ApConfiguration) as usize] = ResponseExpectedFlag::False;
1116 result.device.response_expected[u8::from(MasterBrickFunction::GetWifi2ApConfiguration) as usize] = ResponseExpectedFlag::AlwaysTrue;
1117 result.device.response_expected[u8::from(MasterBrickFunction::SetWifi2ApPassword) as usize] = ResponseExpectedFlag::False;
1118 result.device.response_expected[u8::from(MasterBrickFunction::GetWifi2ApPassword) as usize] = ResponseExpectedFlag::AlwaysTrue;
1119 result.device.response_expected[u8::from(MasterBrickFunction::SaveWifi2Configuration) as usize] = ResponseExpectedFlag::AlwaysTrue;
1120 result.device.response_expected[u8::from(MasterBrickFunction::GetWifi2FirmwareVersion) as usize] = ResponseExpectedFlag::AlwaysTrue;
1121 result.device.response_expected[u8::from(MasterBrickFunction::EnableWifi2StatusLed) as usize] = ResponseExpectedFlag::False;
1122 result.device.response_expected[u8::from(MasterBrickFunction::DisableWifi2StatusLed) as usize] = ResponseExpectedFlag::False;
1123 result.device.response_expected[u8::from(MasterBrickFunction::IsWifi2StatusLedEnabled) as usize] = ResponseExpectedFlag::AlwaysTrue;
1124 result.device.response_expected[u8::from(MasterBrickFunction::SetWifi2MeshConfiguration) as usize] = ResponseExpectedFlag::False;
1125 result.device.response_expected[u8::from(MasterBrickFunction::GetWifi2MeshConfiguration) as usize] =
1126 ResponseExpectedFlag::AlwaysTrue;
1127 result.device.response_expected[u8::from(MasterBrickFunction::SetWifi2MeshRouterSsid) as usize] = ResponseExpectedFlag::False;
1128 result.device.response_expected[u8::from(MasterBrickFunction::GetWifi2MeshRouterSsid) as usize] = ResponseExpectedFlag::AlwaysTrue;
1129 result.device.response_expected[u8::from(MasterBrickFunction::SetWifi2MeshRouterPassword) as usize] = ResponseExpectedFlag::False;
1130 result.device.response_expected[u8::from(MasterBrickFunction::GetWifi2MeshRouterPassword) as usize] =
1131 ResponseExpectedFlag::AlwaysTrue;
1132 result.device.response_expected[u8::from(MasterBrickFunction::GetWifi2MeshCommonStatus) as usize] =
1133 ResponseExpectedFlag::AlwaysTrue;
1134 result.device.response_expected[u8::from(MasterBrickFunction::GetWifi2MeshClientStatus) as usize] =
1135 ResponseExpectedFlag::AlwaysTrue;
1136 result.device.response_expected[u8::from(MasterBrickFunction::GetWifi2MeshApStatus) as usize] = ResponseExpectedFlag::AlwaysTrue;
1137 result.device.response_expected[u8::from(MasterBrickFunction::SetBrickletXmcFlashConfig) as usize] =
1138 ResponseExpectedFlag::AlwaysTrue;
1139 result.device.response_expected[u8::from(MasterBrickFunction::SetBrickletXmcFlashData) as usize] = ResponseExpectedFlag::AlwaysTrue;
1140 result.device.response_expected[u8::from(MasterBrickFunction::SetBrickletsEnabled) as usize] = ResponseExpectedFlag::False;
1141 result.device.response_expected[u8::from(MasterBrickFunction::GetBrickletsEnabled) as usize] = ResponseExpectedFlag::AlwaysTrue;
1142 result.device.response_expected[u8::from(MasterBrickFunction::SetSpitfpBaudrateConfig) as usize] = ResponseExpectedFlag::False;
1143 result.device.response_expected[u8::from(MasterBrickFunction::GetSpitfpBaudrateConfig) as usize] = ResponseExpectedFlag::AlwaysTrue;
1144 result.device.response_expected[u8::from(MasterBrickFunction::GetSendTimeoutCount) as usize] = ResponseExpectedFlag::AlwaysTrue;
1145 result.device.response_expected[u8::from(MasterBrickFunction::SetSpitfpBaudrate) as usize] = ResponseExpectedFlag::False;
1146 result.device.response_expected[u8::from(MasterBrickFunction::GetSpitfpBaudrate) as usize] = ResponseExpectedFlag::AlwaysTrue;
1147 result.device.response_expected[u8::from(MasterBrickFunction::GetSpitfpErrorCount) as usize] = ResponseExpectedFlag::AlwaysTrue;
1148 result.device.response_expected[u8::from(MasterBrickFunction::EnableStatusLed) as usize] = ResponseExpectedFlag::False;
1149 result.device.response_expected[u8::from(MasterBrickFunction::DisableStatusLed) as usize] = ResponseExpectedFlag::False;
1150 result.device.response_expected[u8::from(MasterBrickFunction::IsStatusLedEnabled) as usize] = ResponseExpectedFlag::AlwaysTrue;
1151 result.device.response_expected[u8::from(MasterBrickFunction::GetProtocol1BrickletName) as usize] =
1152 ResponseExpectedFlag::AlwaysTrue;
1153 result.device.response_expected[u8::from(MasterBrickFunction::GetChipTemperature) as usize] = ResponseExpectedFlag::AlwaysTrue;
1154 result.device.response_expected[u8::from(MasterBrickFunction::Reset) as usize] = ResponseExpectedFlag::False;
1155 result.device.response_expected[u8::from(MasterBrickFunction::WriteBrickletPlugin) as usize] = ResponseExpectedFlag::False;
1156 result.device.response_expected[u8::from(MasterBrickFunction::ReadBrickletPlugin) as usize] = ResponseExpectedFlag::AlwaysTrue;
1157 result.device.response_expected[u8::from(MasterBrickFunction::GetIdentity) as usize] = ResponseExpectedFlag::AlwaysTrue;
1158 result
1159 }
1160
1161 pub fn get_response_expected(&mut self, fun: MasterBrickFunction) -> Result<bool, GetResponseExpectedError> {
1176 self.device.get_response_expected(u8::from(fun))
1177 }
1178
1179 pub fn set_response_expected(&mut self, fun: MasterBrickFunction, response_expected: bool) -> Result<(), SetResponseExpectedError> {
1188 self.device.set_response_expected(u8::from(fun), response_expected)
1189 }
1190
1191 pub fn set_response_expected_all(&mut self, response_expected: bool) {
1193 self.device.set_response_expected_all(response_expected)
1194 }
1195
1196 pub fn get_api_version(&self) -> [u8; 3] {
1199 self.device.api_version
1200 }
1201
1202 pub async fn get_stack_current_callback_receiver(&mut self) -> impl Stream<Item = u16> {
1213 self.device
1214 .get_callback_receiver(u8::from(MasterBrickFunction::CallbackStackCurrent))
1215 .await
1216 .map(|p| u16::from_le_byte_slice(p.body()))
1217 }
1218
1219 pub async fn get_stack_voltage_callback_receiver(&mut self) -> impl Stream<Item = u16> {
1229 self.device
1230 .get_callback_receiver(u8::from(MasterBrickFunction::CallbackStackVoltage))
1231 .await
1232 .map(|p| u16::from_le_byte_slice(p.body()))
1233 }
1234
1235 pub async fn get_usb_voltage_callback_receiver(&mut self) -> impl Stream<Item = u16> {
1247 self.device
1248 .get_callback_receiver(u8::from(MasterBrickFunction::CallbackUsbVoltage))
1249 .await
1250 .map(|p| u16::from_le_byte_slice(p.body()))
1251 }
1252
1253 pub async fn get_stack_current_reached_callback_receiver(&mut self) -> impl Stream<Item = u16> {
1263 self.device
1264 .get_callback_receiver(u8::from(MasterBrickFunction::CallbackStackCurrentReached))
1265 .await
1266 .map(|p| u16::from_le_byte_slice(p.body()))
1267 }
1268
1269 pub async fn get_stack_voltage_reached_callback_receiver(&mut self) -> impl Stream<Item = u16> {
1279 self.device
1280 .get_callback_receiver(u8::from(MasterBrickFunction::CallbackStackVoltageReached))
1281 .await
1282 .map(|p| u16::from_le_byte_slice(p.body()))
1283 }
1284
1285 pub async fn get_usb_voltage_reached_callback_receiver(&mut self) -> impl Stream<Item = u16> {
1295 self.device
1296 .get_callback_receiver(u8::from(MasterBrickFunction::CallbackUsbVoltageReached))
1297 .await
1298 .map(|p| u16::from_le_byte_slice(p.body()))
1299 }
1300
1301 pub async fn get_stack_voltage(&mut self) -> Result<u16, TinkerforgeError> {
1308 let payload = [0; 0];
1309
1310 #[allow(unused_variables)]
1311 let result = self.device.get(u8::from(MasterBrickFunction::GetStackVoltage), &payload).await?;
1312 Ok(u16::from_le_byte_slice(result.body()))
1313 }
1314
1315 pub async fn get_stack_current(&mut self) -> Result<u16, TinkerforgeError> {
1322 let payload = [0; 0];
1323
1324 #[allow(unused_variables)]
1325 let result = self.device.get(u8::from(MasterBrickFunction::GetStackCurrent), &payload).await?;
1326 Ok(u16::from_le_byte_slice(result.body()))
1327 }
1328
1329 pub async fn set_extension_type(&mut self, extension: u8, exttype: u32) -> Result<(), TinkerforgeError> {
1353 let mut payload = [0; 5];
1354 extension.write_to_slice(&mut payload[0..1]);
1355 exttype.write_to_slice(&mut payload[1..5]);
1356
1357 #[allow(unused_variables)]
1358 let result = self.device.set(u8::from(MasterBrickFunction::SetExtensionType), &payload).await?;
1359 Ok(())
1360 }
1361
1362 pub async fn get_extension_type(&mut self, extension: u8) -> Result<u32, TinkerforgeError> {
1371 let mut payload = [0; 1];
1372 extension.write_to_slice(&mut payload[0..1]);
1373
1374 #[allow(unused_variables)]
1375 let result = self.device.get(u8::from(MasterBrickFunction::GetExtensionType), &payload).await?;
1376 Ok(u32::from_le_byte_slice(result.body()))
1377 }
1378
1379 pub async fn is_chibi_present(&mut self) -> Result<bool, TinkerforgeError> {
1382 let payload = [0; 0];
1383
1384 #[allow(unused_variables)]
1385 let result = self.device.get(u8::from(MasterBrickFunction::IsChibiPresent), &payload).await?;
1386 Ok(bool::from_le_byte_slice(result.body()))
1387 }
1388
1389 pub async fn set_chibi_address(&mut self, address: u8) -> Result<(), TinkerforgeError> {
1395 let mut payload = [0; 1];
1396 address.write_to_slice(&mut payload[0..1]);
1397
1398 #[allow(unused_variables)]
1399 let result = self.device.set(u8::from(MasterBrickFunction::SetChibiAddress), &payload).await?;
1400 Ok(())
1401 }
1402
1403 pub async fn get_chibi_address(&mut self) -> Result<u8, TinkerforgeError> {
1405 let payload = [0; 0];
1406
1407 #[allow(unused_variables)]
1408 let result = self.device.get(u8::from(MasterBrickFunction::GetChibiAddress), &payload).await?;
1409 Ok(u8::from_le_byte_slice(result.body()))
1410 }
1411
1412 pub async fn set_chibi_master_address(&mut self, address: u8) -> Result<(), TinkerforgeError> {
1419 let mut payload = [0; 1];
1420 address.write_to_slice(&mut payload[0..1]);
1421
1422 #[allow(unused_variables)]
1423 let result = self.device.set(u8::from(MasterBrickFunction::SetChibiMasterAddress), &payload).await?;
1424 Ok(())
1425 }
1426
1427 pub async fn get_chibi_master_address(&mut self) -> Result<u8, TinkerforgeError> {
1429 let payload = [0; 0];
1430
1431 #[allow(unused_variables)]
1432 let result = self.device.get(u8::from(MasterBrickFunction::GetChibiMasterAddress), &payload).await?;
1433 Ok(u8::from_le_byte_slice(result.body()))
1434 }
1435
1436 pub async fn set_chibi_slave_address(&mut self, num: u8, address: u8) -> Result<(), TinkerforgeError> {
1452 let mut payload = [0; 2];
1453 num.write_to_slice(&mut payload[0..1]);
1454 address.write_to_slice(&mut payload[1..2]);
1455
1456 #[allow(unused_variables)]
1457 let result = self.device.set(u8::from(MasterBrickFunction::SetChibiSlaveAddress), &payload).await?;
1458 Ok(())
1459 }
1460
1461 pub async fn get_chibi_slave_address(&mut self, num: u8) -> Result<u8, TinkerforgeError> {
1464 let mut payload = [0; 1];
1465 num.write_to_slice(&mut payload[0..1]);
1466
1467 #[allow(unused_variables)]
1468 let result = self.device.get(u8::from(MasterBrickFunction::GetChibiSlaveAddress), &payload).await?;
1469 Ok(u8::from_le_byte_slice(result.body()))
1470 }
1471
1472 pub async fn get_chibi_signal_strength(&mut self) -> Result<u8, TinkerforgeError> {
1475 let payload = [0; 0];
1476
1477 #[allow(unused_variables)]
1478 let result = self.device.get(u8::from(MasterBrickFunction::GetChibiSignalStrength), &payload).await?;
1479 Ok(u8::from_le_byte_slice(result.body()))
1480 }
1481
1482 pub async fn get_chibi_error_log(&mut self) -> Result<ChibiErrorLog, TinkerforgeError> {
1487 let payload = [0; 0];
1488
1489 #[allow(unused_variables)]
1490 let result = self.device.get(u8::from(MasterBrickFunction::GetChibiErrorLog), &payload).await?;
1491 Ok(ChibiErrorLog::from_le_byte_slice(result.body()))
1492 }
1493
1494 pub async fn set_chibi_frequency(&mut self, frequency: u8) -> Result<(), TinkerforgeError> {
1513 let mut payload = [0; 1];
1514 frequency.write_to_slice(&mut payload[0..1]);
1515
1516 #[allow(unused_variables)]
1517 let result = self.device.set(u8::from(MasterBrickFunction::SetChibiFrequency), &payload).await?;
1518 Ok(())
1519 }
1520
1521 pub async fn get_chibi_frequency(&mut self) -> Result<u8, TinkerforgeError> {
1529 let payload = [0; 0];
1530
1531 #[allow(unused_variables)]
1532 let result = self.device.get(u8::from(MasterBrickFunction::GetChibiFrequency), &payload).await?;
1533 Ok(u8::from_le_byte_slice(result.body()))
1534 }
1535
1536 pub async fn set_chibi_channel(&mut self, channel: u8) -> Result<(), TinkerforgeError> {
1550 let mut payload = [0; 1];
1551 channel.write_to_slice(&mut payload[0..1]);
1552
1553 #[allow(unused_variables)]
1554 let result = self.device.set(u8::from(MasterBrickFunction::SetChibiChannel), &payload).await?;
1555 Ok(())
1556 }
1557
1558 pub async fn get_chibi_channel(&mut self) -> Result<u8, TinkerforgeError> {
1560 let payload = [0; 0];
1561
1562 #[allow(unused_variables)]
1563 let result = self.device.get(u8::from(MasterBrickFunction::GetChibiChannel), &payload).await?;
1564 Ok(u8::from_le_byte_slice(result.body()))
1565 }
1566
1567 pub async fn is_rs485_present(&mut self) -> Result<bool, TinkerforgeError> {
1570 let payload = [0; 0];
1571
1572 #[allow(unused_variables)]
1573 let result = self.device.get(u8::from(MasterBrickFunction::IsRs485Present), &payload).await?;
1574 Ok(bool::from_le_byte_slice(result.body()))
1575 }
1576
1577 pub async fn set_rs485_address(&mut self, address: u8) -> Result<(), TinkerforgeError> {
1586 let mut payload = [0; 1];
1587 address.write_to_slice(&mut payload[0..1]);
1588
1589 #[allow(unused_variables)]
1590 let result = self.device.set(u8::from(MasterBrickFunction::SetRs485Address), &payload).await?;
1591 Ok(())
1592 }
1593
1594 pub async fn get_rs485_address(&mut self) -> Result<u8, TinkerforgeError> {
1596 let payload = [0; 0];
1597
1598 #[allow(unused_variables)]
1599 let result = self.device.get(u8::from(MasterBrickFunction::GetRs485Address), &payload).await?;
1600 Ok(u8::from_le_byte_slice(result.body()))
1601 }
1602
1603 pub async fn set_rs485_slave_address(&mut self, num: u8, address: u8) -> Result<(), TinkerforgeError> {
1619 let mut payload = [0; 2];
1620 num.write_to_slice(&mut payload[0..1]);
1621 address.write_to_slice(&mut payload[1..2]);
1622
1623 #[allow(unused_variables)]
1624 let result = self.device.set(u8::from(MasterBrickFunction::SetRs485SlaveAddress), &payload).await?;
1625 Ok(())
1626 }
1627
1628 pub async fn get_rs485_slave_address(&mut self, num: u8) -> Result<u8, TinkerforgeError> {
1631 let mut payload = [0; 1];
1632 num.write_to_slice(&mut payload[0..1]);
1633
1634 #[allow(unused_variables)]
1635 let result = self.device.get(u8::from(MasterBrickFunction::GetRs485SlaveAddress), &payload).await?;
1636 Ok(u8::from_le_byte_slice(result.body()))
1637 }
1638
1639 pub async fn get_rs485_error_log(&mut self) -> Result<u16, TinkerforgeError> {
1644 let payload = [0; 0];
1645
1646 #[allow(unused_variables)]
1647 let result = self.device.get(u8::from(MasterBrickFunction::GetRs485ErrorLog), &payload).await?;
1648 Ok(u16::from_le_byte_slice(result.body()))
1649 }
1650
1651 pub async fn set_rs485_configuration(&mut self, speed: u32, parity: char, stopbits: u8) -> Result<(), TinkerforgeError> {
1668 let mut payload = [0; 6];
1669 speed.write_to_slice(&mut payload[0..4]);
1670 parity.write_to_slice(&mut payload[4..5]);
1671 stopbits.write_to_slice(&mut payload[5..6]);
1672
1673 #[allow(unused_variables)]
1674 let result = self.device.set(u8::from(MasterBrickFunction::SetRs485Configuration), &payload).await?;
1675 Ok(())
1676 }
1677
1678 pub async fn get_rs485_configuration(&mut self) -> Result<Rs485Configuration, TinkerforgeError> {
1685 let payload = [0; 0];
1686
1687 #[allow(unused_variables)]
1688 let result = self.device.get(u8::from(MasterBrickFunction::GetRs485Configuration), &payload).await?;
1689 Ok(Rs485Configuration::from_le_byte_slice(result.body()))
1690 }
1691
1692 pub async fn is_wifi_present(&mut self) -> Result<bool, TinkerforgeError> {
1695 let payload = [0; 0];
1696
1697 #[allow(unused_variables)]
1698 let result = self.device.get(u8::from(MasterBrickFunction::IsWifiPresent), &payload).await?;
1699 Ok(bool::from_le_byte_slice(result.body()))
1700 }
1701
1702 pub async fn set_wifi_configuration(
1735 &mut self,
1736 ssid: String,
1737 connection: u8,
1738 ip: &[u8; 4],
1739 subnet_mask: &[u8; 4],
1740 gateway: &[u8; 4],
1741 port: u16,
1742 ) -> Result<(), TinkerforgeError> {
1743 let mut payload = [0; 47];
1744 ssid.try_write_to_slice(32, &mut payload)?;
1745 connection.write_to_slice(&mut payload[32..33]);
1746 ip.write_to_slice(&mut payload[33..37]);
1747 subnet_mask.write_to_slice(&mut payload[37..41]);
1748 gateway.write_to_slice(&mut payload[41..45]);
1749 port.write_to_slice(&mut payload[45..47]);
1750
1751 #[allow(unused_variables)]
1752 let result = self.device.set(u8::from(MasterBrickFunction::SetWifiConfiguration), &payload).await?;
1753 Ok(())
1754 }
1755
1756 pub async fn get_wifi_configuration(&mut self) -> Result<WifiConfiguration, TinkerforgeError> {
1766 let payload = [0; 0];
1767
1768 #[allow(unused_variables)]
1769 let result = self.device.get(u8::from(MasterBrickFunction::GetWifiConfiguration), &payload).await?;
1770 Ok(WifiConfiguration::from_le_byte_slice(result.body()))
1771 }
1772
1773 pub async fn set_wifi_encryption(
1828 &mut self,
1829 encryption: u8,
1830 key: String,
1831 key_index: u8,
1832 eap_options: u8,
1833 ca_certificate_length: u16,
1834 client_certificate_length: u16,
1835 private_key_length: u16,
1836 ) -> Result<(), TinkerforgeError> {
1837 let mut payload = [0; 59];
1838 encryption.write_to_slice(&mut payload[0..1]);
1839 key.try_write_to_slice(50, &mut payload)?;
1840 key_index.write_to_slice(&mut payload[51..52]);
1841 eap_options.write_to_slice(&mut payload[52..53]);
1842 ca_certificate_length.write_to_slice(&mut payload[53..55]);
1843 client_certificate_length.write_to_slice(&mut payload[55..57]);
1844 private_key_length.write_to_slice(&mut payload[57..59]);
1845
1846 #[allow(unused_variables)]
1847 let result = self.device.set(u8::from(MasterBrickFunction::SetWifiEncryption), &payload).await?;
1848 Ok(())
1849 }
1850
1851 pub async fn get_wifi_encryption(&mut self) -> Result<WifiEncryption, TinkerforgeError> {
1871 let payload = [0; 0];
1872
1873 #[allow(unused_variables)]
1874 let result = self.device.get(u8::from(MasterBrickFunction::GetWifiEncryption), &payload).await?;
1875 Ok(WifiEncryption::from_le_byte_slice(result.body()))
1876 }
1877
1878 pub async fn get_wifi_status(&mut self) -> Result<WifiStatus, TinkerforgeError> {
1899 let payload = [0; 0];
1900
1901 #[allow(unused_variables)]
1902 let result = self.device.get(u8::from(MasterBrickFunction::GetWifiStatus), &payload).await?;
1903 Ok(WifiStatus::from_le_byte_slice(result.body()))
1904 }
1905
1906 pub async fn refresh_wifi_status(&mut self) -> Result<(), TinkerforgeError> {
1913 let payload = [0; 0];
1914
1915 #[allow(unused_variables)]
1916 let result = self.device.set(u8::from(MasterBrickFunction::RefreshWifiStatus), &payload).await?;
1917 Ok(())
1918 }
1919
1920 pub async fn set_wifi_certificate(&mut self, index: u16, data: &[u8; 32], data_length: u8) -> Result<(), TinkerforgeError> {
1939 let mut payload = [0; 35];
1940 index.write_to_slice(&mut payload[0..2]);
1941 data.write_to_slice(&mut payload[2..34]);
1942 data_length.write_to_slice(&mut payload[34..35]);
1943
1944 #[allow(unused_variables)]
1945 let result = self.device.set(u8::from(MasterBrickFunction::SetWifiCertificate), &payload).await?;
1946 Ok(())
1947 }
1948
1949 pub async fn get_wifi_certificate(&mut self, index: u16) -> Result<WifiCertificate, TinkerforgeError> {
1951 let mut payload = [0; 2];
1952 index.write_to_slice(&mut payload[0..2]);
1953
1954 #[allow(unused_variables)]
1955 let result = self.device.get(u8::from(MasterBrickFunction::GetWifiCertificate), &payload).await?;
1956 Ok(WifiCertificate::from_le_byte_slice(result.body()))
1957 }
1958
1959 pub async fn set_wifi_power_mode(&mut self, mode: u8) -> Result<(), TinkerforgeError> {
1970 let mut payload = [0; 1];
1971 mode.write_to_slice(&mut payload[0..1]);
1972
1973 #[allow(unused_variables)]
1974 let result = self.device.set(u8::from(MasterBrickFunction::SetWifiPowerMode), &payload).await?;
1975 Ok(())
1976 }
1977
1978 pub async fn get_wifi_power_mode(&mut self) -> Result<u8, TinkerforgeError> {
1984 let payload = [0; 0];
1985
1986 #[allow(unused_variables)]
1987 let result = self.device.get(u8::from(MasterBrickFunction::GetWifiPowerMode), &payload).await?;
1988 Ok(u8::from_le_byte_slice(result.body()))
1989 }
1990
1991 pub async fn get_wifi_buffer_info(&mut self) -> Result<WifiBufferInfo, TinkerforgeError> {
2006 let payload = [0; 0];
2007
2008 #[allow(unused_variables)]
2009 let result = self.device.get(u8::from(MasterBrickFunction::GetWifiBufferInfo), &payload).await?;
2010 Ok(WifiBufferInfo::from_le_byte_slice(result.body()))
2011 }
2012
2013 pub async fn set_wifi_regulatory_domain(&mut self, domain: u8) -> Result<(), TinkerforgeError> {
2026 let mut payload = [0; 1];
2027 domain.write_to_slice(&mut payload[0..1]);
2028
2029 #[allow(unused_variables)]
2030 let result = self.device.set(u8::from(MasterBrickFunction::SetWifiRegulatoryDomain), &payload).await?;
2031 Ok(())
2032 }
2033
2034 pub async fn get_wifi_regulatory_domain(&mut self) -> Result<u8, TinkerforgeError> {
2041 let payload = [0; 0];
2042
2043 #[allow(unused_variables)]
2044 let result = self.device.get(u8::from(MasterBrickFunction::GetWifiRegulatoryDomain), &payload).await?;
2045 Ok(u8::from_le_byte_slice(result.body()))
2046 }
2047
2048 pub async fn get_usb_voltage(&mut self) -> Result<u16, TinkerforgeError> {
2050 let payload = [0; 0];
2051
2052 #[allow(unused_variables)]
2053 let result = self.device.get(u8::from(MasterBrickFunction::GetUsbVoltage), &payload).await?;
2054 Ok(u16::from_le_byte_slice(result.body()))
2055 }
2056
2057 pub async fn set_long_wifi_key(&mut self, key: String) -> Result<(), TinkerforgeError> {
2068 let mut payload = [0; 64];
2069 key.try_write_to_slice(64, &mut payload)?;
2070
2071 #[allow(unused_variables)]
2072 let result = self.device.set(u8::from(MasterBrickFunction::SetLongWifiKey), &payload).await?;
2073 Ok(())
2074 }
2075
2076 pub async fn get_long_wifi_key(&mut self) -> Result<String, TinkerforgeError> {
2084 let payload = [0; 0];
2085
2086 #[allow(unused_variables)]
2087 let result = self.device.get(u8::from(MasterBrickFunction::GetLongWifiKey), &payload).await?;
2088 Ok(String::from_le_byte_slice(result.body()))
2089 }
2090
2091 pub async fn set_wifi_hostname(&mut self, hostname: String) -> Result<(), TinkerforgeError> {
2099 let mut payload = [0; 16];
2100 hostname.try_write_to_slice(16, &mut payload)?;
2101
2102 #[allow(unused_variables)]
2103 let result = self.device.set(u8::from(MasterBrickFunction::SetWifiHostname), &payload).await?;
2104 Ok(())
2105 }
2106
2107 pub async fn get_wifi_hostname(&mut self) -> Result<String, TinkerforgeError> {
2114 let payload = [0; 0];
2115
2116 #[allow(unused_variables)]
2117 let result = self.device.get(u8::from(MasterBrickFunction::GetWifiHostname), &payload).await?;
2118 Ok(String::from_le_byte_slice(result.body()))
2119 }
2120
2121 pub async fn set_stack_current_callback_period(&mut self, period: u32) -> Result<(), TinkerforgeError> {
2130 let mut payload = [0; 4];
2131 period.write_to_slice(&mut payload[0..4]);
2132
2133 #[allow(unused_variables)]
2134 let result = self.device.set(u8::from(MasterBrickFunction::SetStackCurrentCallbackPeriod), &payload).await?;
2135 Ok(())
2136 }
2137
2138 pub async fn get_stack_current_callback_period(&mut self) -> Result<u32, TinkerforgeError> {
2143 let payload = [0; 0];
2144
2145 #[allow(unused_variables)]
2146 let result = self.device.get(u8::from(MasterBrickFunction::GetStackCurrentCallbackPeriod), &payload).await?;
2147 Ok(u32::from_le_byte_slice(result.body()))
2148 }
2149
2150 pub async fn set_stack_voltage_callback_period(&mut self, period: u32) -> Result<(), TinkerforgeError> {
2159 let mut payload = [0; 4];
2160 period.write_to_slice(&mut payload[0..4]);
2161
2162 #[allow(unused_variables)]
2163 let result = self.device.set(u8::from(MasterBrickFunction::SetStackVoltageCallbackPeriod), &payload).await?;
2164 Ok(())
2165 }
2166
2167 pub async fn get_stack_voltage_callback_period(&mut self) -> Result<u32, TinkerforgeError> {
2172 let payload = [0; 0];
2173
2174 #[allow(unused_variables)]
2175 let result = self.device.get(u8::from(MasterBrickFunction::GetStackVoltageCallbackPeriod), &payload).await?;
2176 Ok(u32::from_le_byte_slice(result.body()))
2177 }
2178
2179 pub async fn set_usb_voltage_callback_period(&mut self, period: u32) -> Result<(), TinkerforgeError> {
2188 let mut payload = [0; 4];
2189 period.write_to_slice(&mut payload[0..4]);
2190
2191 #[allow(unused_variables)]
2192 let result = self.device.set(u8::from(MasterBrickFunction::SetUsbVoltageCallbackPeriod), &payload).await?;
2193 Ok(())
2194 }
2195
2196 pub async fn get_usb_voltage_callback_period(&mut self) -> Result<u32, TinkerforgeError> {
2201 let payload = [0; 0];
2202
2203 #[allow(unused_variables)]
2204 let result = self.device.get(u8::from(MasterBrickFunction::GetUsbVoltageCallbackPeriod), &payload).await?;
2205 Ok(u32::from_le_byte_slice(result.body()))
2206 }
2207
2208 pub async fn set_stack_current_callback_threshold(&mut self, option: char, min: u16, max: u16) -> Result<(), TinkerforgeError> {
2230 let mut payload = [0; 5];
2231 option.write_to_slice(&mut payload[0..1]);
2232 min.write_to_slice(&mut payload[1..3]);
2233 max.write_to_slice(&mut payload[3..5]);
2234
2235 #[allow(unused_variables)]
2236 let result = self.device.set(u8::from(MasterBrickFunction::SetStackCurrentCallbackThreshold), &payload).await?;
2237 Ok(())
2238 }
2239
2240 pub async fn get_stack_current_callback_threshold(&mut self) -> Result<StackCurrentCallbackThreshold, TinkerforgeError> {
2252 let payload = [0; 0];
2253
2254 #[allow(unused_variables)]
2255 let result = self.device.get(u8::from(MasterBrickFunction::GetStackCurrentCallbackThreshold), &payload).await?;
2256 Ok(StackCurrentCallbackThreshold::from_le_byte_slice(result.body()))
2257 }
2258
2259 pub async fn set_stack_voltage_callback_threshold(&mut self, option: char, min: u16, max: u16) -> Result<(), TinkerforgeError> {
2281 let mut payload = [0; 5];
2282 option.write_to_slice(&mut payload[0..1]);
2283 min.write_to_slice(&mut payload[1..3]);
2284 max.write_to_slice(&mut payload[3..5]);
2285
2286 #[allow(unused_variables)]
2287 let result = self.device.set(u8::from(MasterBrickFunction::SetStackVoltageCallbackThreshold), &payload).await?;
2288 Ok(())
2289 }
2290
2291 pub async fn get_stack_voltage_callback_threshold(&mut self) -> Result<StackVoltageCallbackThreshold, TinkerforgeError> {
2303 let payload = [0; 0];
2304
2305 #[allow(unused_variables)]
2306 let result = self.device.get(u8::from(MasterBrickFunction::GetStackVoltageCallbackThreshold), &payload).await?;
2307 Ok(StackVoltageCallbackThreshold::from_le_byte_slice(result.body()))
2308 }
2309
2310 pub async fn set_usb_voltage_callback_threshold(&mut self, option: char, min: u16, max: u16) -> Result<(), TinkerforgeError> {
2332 let mut payload = [0; 5];
2333 option.write_to_slice(&mut payload[0..1]);
2334 min.write_to_slice(&mut payload[1..3]);
2335 max.write_to_slice(&mut payload[3..5]);
2336
2337 #[allow(unused_variables)]
2338 let result = self.device.set(u8::from(MasterBrickFunction::SetUsbVoltageCallbackThreshold), &payload).await?;
2339 Ok(())
2340 }
2341
2342 pub async fn get_usb_voltage_callback_threshold(&mut self) -> Result<UsbVoltageCallbackThreshold, TinkerforgeError> {
2354 let payload = [0; 0];
2355
2356 #[allow(unused_variables)]
2357 let result = self.device.get(u8::from(MasterBrickFunction::GetUsbVoltageCallbackThreshold), &payload).await?;
2358 Ok(UsbVoltageCallbackThreshold::from_le_byte_slice(result.body()))
2359 }
2360
2361 pub async fn set_debounce_period(&mut self, debounce: u32) -> Result<(), TinkerforgeError> {
2378 let mut payload = [0; 4];
2379 debounce.write_to_slice(&mut payload[0..4]);
2380
2381 #[allow(unused_variables)]
2382 let result = self.device.set(u8::from(MasterBrickFunction::SetDebouncePeriod), &payload).await?;
2383 Ok(())
2384 }
2385
2386 pub async fn get_debounce_period(&mut self) -> Result<u32, TinkerforgeError> {
2391 let payload = [0; 0];
2392
2393 #[allow(unused_variables)]
2394 let result = self.device.get(u8::from(MasterBrickFunction::GetDebouncePeriod), &payload).await?;
2395 Ok(u32::from_le_byte_slice(result.body()))
2396 }
2397
2398 pub async fn is_ethernet_present(&mut self) -> Result<bool, TinkerforgeError> {
2404 let payload = [0; 0];
2405
2406 #[allow(unused_variables)]
2407 let result = self.device.get(u8::from(MasterBrickFunction::IsEthernetPresent), &payload).await?;
2408 Ok(bool::from_le_byte_slice(result.body()))
2409 }
2410
2411 pub async fn set_ethernet_configuration(
2439 &mut self,
2440 connection: u8,
2441 ip: &[u8; 4],
2442 subnet_mask: &[u8; 4],
2443 gateway: &[u8; 4],
2444 port: u16,
2445 ) -> Result<(), TinkerforgeError> {
2446 let mut payload = [0; 15];
2447 connection.write_to_slice(&mut payload[0..1]);
2448 ip.write_to_slice(&mut payload[1..5]);
2449 subnet_mask.write_to_slice(&mut payload[5..9]);
2450 gateway.write_to_slice(&mut payload[9..13]);
2451 port.write_to_slice(&mut payload[13..15]);
2452
2453 #[allow(unused_variables)]
2454 let result = self.device.set(u8::from(MasterBrickFunction::SetEthernetConfiguration), &payload).await?;
2455 Ok(())
2456 }
2457
2458 pub async fn get_ethernet_configuration(&mut self) -> Result<EthernetConfiguration, TinkerforgeError> {
2467 let payload = [0; 0];
2468
2469 #[allow(unused_variables)]
2470 let result = self.device.get(u8::from(MasterBrickFunction::GetEthernetConfiguration), &payload).await?;
2471 Ok(EthernetConfiguration::from_le_byte_slice(result.body()))
2472 }
2473
2474 pub async fn get_ethernet_status(&mut self) -> Result<EthernetStatus, TinkerforgeError> {
2487 let payload = [0; 0];
2488
2489 #[allow(unused_variables)]
2490 let result = self.device.get(u8::from(MasterBrickFunction::GetEthernetStatus), &payload).await?;
2491 Ok(EthernetStatus::from_le_byte_slice(result.body()))
2492 }
2493
2494 pub async fn set_ethernet_hostname(&mut self, hostname: String) -> Result<(), TinkerforgeError> {
2504 let mut payload = [0; 32];
2505 hostname.try_write_to_slice(32, &mut payload)?;
2506
2507 #[allow(unused_variables)]
2508 let result = self.device.set(u8::from(MasterBrickFunction::SetEthernetHostname), &payload).await?;
2509 Ok(())
2510 }
2511
2512 pub async fn set_ethernet_mac_address(&mut self, mac_address: &[u8; 6]) -> Result<(), TinkerforgeError> {
2521 let mut payload = [0; 6];
2522 mac_address.write_to_slice(&mut payload[0..6]);
2523
2524 #[allow(unused_variables)]
2525 let result = self.device.set(u8::from(MasterBrickFunction::SetEthernetMacAddress), &payload).await?;
2526 Ok(())
2527 }
2528
2529 pub async fn set_ethernet_websocket_configuration(&mut self, sockets: u8, port: u16) -> Result<(), TinkerforgeError> {
2545 let mut payload = [0; 3];
2546 sockets.write_to_slice(&mut payload[0..1]);
2547 port.write_to_slice(&mut payload[1..3]);
2548
2549 #[allow(unused_variables)]
2550 let result = self.device.set(u8::from(MasterBrickFunction::SetEthernetWebsocketConfiguration), &payload).await?;
2551 Ok(())
2552 }
2553
2554 pub async fn get_ethernet_websocket_configuration(&mut self) -> Result<EthernetWebsocketConfiguration, TinkerforgeError> {
2559 let payload = [0; 0];
2560
2561 #[allow(unused_variables)]
2562 let result = self.device.get(u8::from(MasterBrickFunction::GetEthernetWebsocketConfiguration), &payload).await?;
2563 Ok(EthernetWebsocketConfiguration::from_le_byte_slice(result.body()))
2564 }
2565
2566 pub async fn set_ethernet_authentication_secret(&mut self, secret: String) -> Result<(), TinkerforgeError> {
2582 let mut payload = [0; 64];
2583 secret.try_write_to_slice(64, &mut payload)?;
2584
2585 #[allow(unused_variables)]
2586 let result = self.device.set(u8::from(MasterBrickFunction::SetEthernetAuthenticationSecret), &payload).await?;
2587 Ok(())
2588 }
2589
2590 pub async fn get_ethernet_authentication_secret(&mut self) -> Result<String, TinkerforgeError> {
2596 let payload = [0; 0];
2597
2598 #[allow(unused_variables)]
2599 let result = self.device.get(u8::from(MasterBrickFunction::GetEthernetAuthenticationSecret), &payload).await?;
2600 Ok(String::from_le_byte_slice(result.body()))
2601 }
2602
2603 pub async fn set_wifi_authentication_secret(&mut self, secret: String) -> Result<(), TinkerforgeError> {
2619 let mut payload = [0; 64];
2620 secret.try_write_to_slice(64, &mut payload)?;
2621
2622 #[allow(unused_variables)]
2623 let result = self.device.set(u8::from(MasterBrickFunction::SetWifiAuthenticationSecret), &payload).await?;
2624 Ok(())
2625 }
2626
2627 pub async fn get_wifi_authentication_secret(&mut self) -> Result<String, TinkerforgeError> {
2633 let payload = [0; 0];
2634
2635 #[allow(unused_variables)]
2636 let result = self.device.get(u8::from(MasterBrickFunction::GetWifiAuthenticationSecret), &payload).await?;
2637 Ok(String::from_le_byte_slice(result.body()))
2638 }
2639
2640 pub async fn get_connection_type(&mut self) -> Result<u8, TinkerforgeError> {
2655 let payload = [0; 0];
2656
2657 #[allow(unused_variables)]
2658 let result = self.device.get(u8::from(MasterBrickFunction::GetConnectionType), &payload).await?;
2659 Ok(u8::from_le_byte_slice(result.body()))
2660 }
2661
2662 pub async fn is_wifi2_present(&mut self) -> Result<bool, TinkerforgeError> {
2668 let payload = [0; 0];
2669
2670 #[allow(unused_variables)]
2671 let result = self.device.get(u8::from(MasterBrickFunction::IsWifi2Present), &payload).await?;
2672 Ok(bool::from_le_byte_slice(result.body()))
2673 }
2674
2675 pub async fn start_wifi2_bootloader(&mut self) -> Result<i8, TinkerforgeError> {
2689 let payload = [0; 0];
2690
2691 #[allow(unused_variables)]
2692 let result = self.device.get(u8::from(MasterBrickFunction::StartWifi2Bootloader), &payload).await?;
2693 Ok(i8::from_le_byte_slice(result.body()))
2694 }
2695
2696 pub async fn write_wifi2_serial_port(&mut self, data: &[u8; 60], length: u8) -> Result<i8, TinkerforgeError> {
2709 let mut payload = [0; 61];
2710 data.write_to_slice(&mut payload[0..60]);
2711 length.write_to_slice(&mut payload[60..61]);
2712
2713 #[allow(unused_variables)]
2714 let result = self.device.get(u8::from(MasterBrickFunction::WriteWifi2SerialPort), &payload).await?;
2715 Ok(i8::from_le_byte_slice(result.body()))
2716 }
2717
2718 pub async fn read_wifi2_serial_port(&mut self, length: u8) -> Result<ReadWifi2SerialPort, TinkerforgeError> {
2731 let mut payload = [0; 1];
2732 length.write_to_slice(&mut payload[0..1]);
2733
2734 #[allow(unused_variables)]
2735 let result = self.device.get(u8::from(MasterBrickFunction::ReadWifi2SerialPort), &payload).await?;
2736 Ok(ReadWifi2SerialPort::from_le_byte_slice(result.body()))
2737 }
2738
2739 pub async fn set_wifi2_authentication_secret(&mut self, secret: String) -> Result<(), TinkerforgeError> {
2755 let mut payload = [0; 64];
2756 secret.try_write_to_slice(64, &mut payload)?;
2757
2758 #[allow(unused_variables)]
2759 let result = self.device.set(u8::from(MasterBrickFunction::SetWifi2AuthenticationSecret), &payload).await?;
2760 Ok(())
2761 }
2762
2763 pub async fn get_wifi2_authentication_secret(&mut self) -> Result<String, TinkerforgeError> {
2769 let payload = [0; 0];
2770
2771 #[allow(unused_variables)]
2772 let result = self.device.get(u8::from(MasterBrickFunction::GetWifi2AuthenticationSecret), &payload).await?;
2773 Ok(String::from_le_byte_slice(result.body()))
2774 }
2775
2776 pub async fn set_wifi2_configuration(
2814 &mut self,
2815 port: u16,
2816 websocket_port: u16,
2817 website_port: u16,
2818 phy_mode: u8,
2819 sleep_mode: u8,
2820 website: u8,
2821 ) -> Result<(), TinkerforgeError> {
2822 let mut payload = [0; 9];
2823 port.write_to_slice(&mut payload[0..2]);
2824 websocket_port.write_to_slice(&mut payload[2..4]);
2825 website_port.write_to_slice(&mut payload[4..6]);
2826 phy_mode.write_to_slice(&mut payload[6..7]);
2827 sleep_mode.write_to_slice(&mut payload[7..8]);
2828 website.write_to_slice(&mut payload[8..9]);
2829
2830 #[allow(unused_variables)]
2831 let result = self.device.set(u8::from(MasterBrickFunction::SetWifi2Configuration), &payload).await?;
2832 Ok(())
2833 }
2834
2835 pub async fn get_wifi2_configuration(&mut self) -> Result<Wifi2Configuration, TinkerforgeError> {
2845 let payload = [0; 0];
2846
2847 #[allow(unused_variables)]
2848 let result = self.device.get(u8::from(MasterBrickFunction::GetWifi2Configuration), &payload).await?;
2849 Ok(Wifi2Configuration::from_le_byte_slice(result.body()))
2850 }
2851
2852 pub async fn get_wifi2_status(&mut self) -> Result<Wifi2Status, TinkerforgeError> {
2866 let payload = [0; 0];
2867
2868 #[allow(unused_variables)]
2869 let result = self.device.get(u8::from(MasterBrickFunction::GetWifi2Status), &payload).await?;
2870 Ok(Wifi2Status::from_le_byte_slice(result.body()))
2871 }
2872
2873 pub async fn set_wifi2_client_configuration(
2904 &mut self,
2905 enable: bool,
2906 ssid: String,
2907 ip: &[u8; 4],
2908 subnet_mask: &[u8; 4],
2909 gateway: &[u8; 4],
2910 mac_address: &[u8; 6],
2911 bssid: &[u8; 6],
2912 ) -> Result<(), TinkerforgeError> {
2913 let mut payload = [0; 57];
2914 enable.write_to_slice(&mut payload[0..1]);
2915 ssid.try_write_to_slice(32, &mut payload)?;
2916 ip.write_to_slice(&mut payload[33..37]);
2917 subnet_mask.write_to_slice(&mut payload[37..41]);
2918 gateway.write_to_slice(&mut payload[41..45]);
2919 mac_address.write_to_slice(&mut payload[45..51]);
2920 bssid.write_to_slice(&mut payload[51..57]);
2921
2922 #[allow(unused_variables)]
2923 let result = self.device.set(u8::from(MasterBrickFunction::SetWifi2ClientConfiguration), &payload).await?;
2924 Ok(())
2925 }
2926
2927 pub async fn get_wifi2_client_configuration(&mut self) -> Result<Wifi2ClientConfiguration, TinkerforgeError> {
2932 let payload = [0; 0];
2933
2934 #[allow(unused_variables)]
2935 let result = self.device.get(u8::from(MasterBrickFunction::GetWifi2ClientConfiguration), &payload).await?;
2936 Ok(Wifi2ClientConfiguration::from_le_byte_slice(result.body()))
2937 }
2938
2939 pub async fn set_wifi2_client_hostname(&mut self, hostname: String) -> Result<(), TinkerforgeError> {
2952 let mut payload = [0; 32];
2953 hostname.try_write_to_slice(32, &mut payload)?;
2954
2955 #[allow(unused_variables)]
2956 let result = self.device.set(u8::from(MasterBrickFunction::SetWifi2ClientHostname), &payload).await?;
2957 Ok(())
2958 }
2959
2960 pub async fn get_wifi2_client_hostname(&mut self) -> Result<String, TinkerforgeError> {
2965 let payload = [0; 0];
2966
2967 #[allow(unused_variables)]
2968 let result = self.device.get(u8::from(MasterBrickFunction::GetWifi2ClientHostname), &payload).await?;
2969 Ok(String::from_le_byte_slice(result.body()))
2970 }
2971
2972 pub async fn set_wifi2_client_password(&mut self, password: String) -> Result<(), TinkerforgeError> {
2983 let mut payload = [0; 64];
2984 password.try_write_to_slice(64, &mut payload)?;
2985
2986 #[allow(unused_variables)]
2987 let result = self.device.set(u8::from(MasterBrickFunction::SetWifi2ClientPassword), &payload).await?;
2988 Ok(())
2989 }
2990
2991 pub async fn get_wifi2_client_password(&mut self) -> Result<String, TinkerforgeError> {
3000 let payload = [0; 0];
3001
3002 #[allow(unused_variables)]
3003 let result = self.device.get(u8::from(MasterBrickFunction::GetWifi2ClientPassword), &payload).await?;
3004 Ok(String::from_le_byte_slice(result.body()))
3005 }
3006
3007 pub async fn set_wifi2_ap_configuration(
3048 &mut self,
3049 enable: bool,
3050 ssid: String,
3051 ip: &[u8; 4],
3052 subnet_mask: &[u8; 4],
3053 gateway: &[u8; 4],
3054 encryption: u8,
3055 hidden: bool,
3056 channel: u8,
3057 mac_address: &[u8; 6],
3058 ) -> Result<(), TinkerforgeError> {
3059 let mut payload = [0; 54];
3060 enable.write_to_slice(&mut payload[0..1]);
3061 ssid.try_write_to_slice(32, &mut payload)?;
3062 ip.write_to_slice(&mut payload[33..37]);
3063 subnet_mask.write_to_slice(&mut payload[37..41]);
3064 gateway.write_to_slice(&mut payload[41..45]);
3065 encryption.write_to_slice(&mut payload[45..46]);
3066 hidden.write_to_slice(&mut payload[46..47]);
3067 channel.write_to_slice(&mut payload[47..48]);
3068 mac_address.write_to_slice(&mut payload[48..54]);
3069
3070 #[allow(unused_variables)]
3071 let result = self.device.set(u8::from(MasterBrickFunction::SetWifi2ApConfiguration), &payload).await?;
3072 Ok(())
3073 }
3074
3075 pub async fn get_wifi2_ap_configuration(&mut self) -> Result<Wifi2ApConfiguration, TinkerforgeError> {
3087 let payload = [0; 0];
3088
3089 #[allow(unused_variables)]
3090 let result = self.device.get(u8::from(MasterBrickFunction::GetWifi2ApConfiguration), &payload).await?;
3091 Ok(Wifi2ApConfiguration::from_le_byte_slice(result.body()))
3092 }
3093
3094 pub async fn set_wifi2_ap_password(&mut self, password: String) -> Result<(), TinkerforgeError> {
3106 let mut payload = [0; 64];
3107 password.try_write_to_slice(64, &mut payload)?;
3108
3109 #[allow(unused_variables)]
3110 let result = self.device.set(u8::from(MasterBrickFunction::SetWifi2ApPassword), &payload).await?;
3111 Ok(())
3112 }
3113
3114 pub async fn get_wifi2_ap_password(&mut self) -> Result<String, TinkerforgeError> {
3123 let payload = [0; 0];
3124
3125 #[allow(unused_variables)]
3126 let result = self.device.get(u8::from(MasterBrickFunction::GetWifi2ApPassword), &payload).await?;
3127 Ok(String::from_le_byte_slice(result.body()))
3128 }
3129
3130 pub async fn save_wifi2_configuration(&mut self) -> Result<u8, TinkerforgeError> {
3140 let payload = [0; 0];
3141
3142 #[allow(unused_variables)]
3143 let result = self.device.get(u8::from(MasterBrickFunction::SaveWifi2Configuration), &payload).await?;
3144 Ok(u8::from_le_byte_slice(result.body()))
3145 }
3146
3147 pub async fn get_wifi2_firmware_version(&mut self) -> Result<Box<[u8; 3]>, TinkerforgeError> {
3152 let payload = [0; 0];
3153
3154 #[allow(unused_variables)]
3155 let result = self.device.get(u8::from(MasterBrickFunction::GetWifi2FirmwareVersion), &payload).await?;
3156 Ok(Box::<[u8; 3]>::from_le_byte_slice(result.body()))
3157 }
3158
3159 pub async fn enable_wifi2_status_led(&mut self) -> Result<(), TinkerforgeError> {
3164 let payload = [0; 0];
3165
3166 #[allow(unused_variables)]
3167 let result = self.device.set(u8::from(MasterBrickFunction::EnableWifi2StatusLed), &payload).await?;
3168 Ok(())
3169 }
3170
3171 pub async fn disable_wifi2_status_led(&mut self) -> Result<(), TinkerforgeError> {
3176 let payload = [0; 0];
3177
3178 #[allow(unused_variables)]
3179 let result = self.device.set(u8::from(MasterBrickFunction::DisableWifi2StatusLed), &payload).await?;
3180 Ok(())
3181 }
3182
3183 pub async fn is_wifi2_status_led_enabled(&mut self) -> Result<bool, TinkerforgeError> {
3188 let payload = [0; 0];
3189
3190 #[allow(unused_variables)]
3191 let result = self.device.get(u8::from(MasterBrickFunction::IsWifi2StatusLedEnabled), &payload).await?;
3192 Ok(bool::from_le_byte_slice(result.body()))
3193 }
3194
3195 pub async fn set_wifi2_mesh_configuration(
3230 &mut self,
3231 enable: bool,
3232 root_ip: &[u8; 4],
3233 root_subnet_mask: &[u8; 4],
3234 root_gateway: &[u8; 4],
3235 router_bssid: &[u8; 6],
3236 group_id: &[u8; 6],
3237 group_ssid_prefix: String,
3238 gateway_ip: &[u8; 4],
3239 gateway_port: u16,
3240 ) -> Result<(), TinkerforgeError> {
3241 let mut payload = [0; 47];
3242 enable.write_to_slice(&mut payload[0..1]);
3243 root_ip.write_to_slice(&mut payload[1..5]);
3244 root_subnet_mask.write_to_slice(&mut payload[5..9]);
3245 root_gateway.write_to_slice(&mut payload[9..13]);
3246 router_bssid.write_to_slice(&mut payload[13..19]);
3247 group_id.write_to_slice(&mut payload[19..25]);
3248 group_ssid_prefix.try_write_to_slice(16, &mut payload)?;
3249 gateway_ip.write_to_slice(&mut payload[41..45]);
3250 gateway_port.write_to_slice(&mut payload[45..47]);
3251
3252 #[allow(unused_variables)]
3253 let result = self.device.set(u8::from(MasterBrickFunction::SetWifi2MeshConfiguration), &payload).await?;
3254 Ok(())
3255 }
3256
3257 pub async fn get_wifi2_mesh_configuration(&mut self) -> Result<Wifi2MeshConfiguration, TinkerforgeError> {
3264 let payload = [0; 0];
3265
3266 #[allow(unused_variables)]
3267 let result = self.device.get(u8::from(MasterBrickFunction::GetWifi2MeshConfiguration), &payload).await?;
3268 Ok(Wifi2MeshConfiguration::from_le_byte_slice(result.body()))
3269 }
3270
3271 pub async fn set_wifi2_mesh_router_ssid(&mut self, ssid: String) -> Result<(), TinkerforgeError> {
3289 let mut payload = [0; 32];
3290 ssid.try_write_to_slice(32, &mut payload)?;
3291
3292 #[allow(unused_variables)]
3293 let result = self.device.set(u8::from(MasterBrickFunction::SetWifi2MeshRouterSsid), &payload).await?;
3294 Ok(())
3295 }
3296
3297 pub async fn get_wifi2_mesh_router_ssid(&mut self) -> Result<String, TinkerforgeError> {
3304 let payload = [0; 0];
3305
3306 #[allow(unused_variables)]
3307 let result = self.device.get(u8::from(MasterBrickFunction::GetWifi2MeshRouterSsid), &payload).await?;
3308 Ok(String::from_le_byte_slice(result.body()))
3309 }
3310
3311 pub async fn set_wifi2_mesh_router_password(&mut self, password: String) -> Result<(), TinkerforgeError> {
3325 let mut payload = [0; 64];
3326 password.try_write_to_slice(64, &mut payload)?;
3327
3328 #[allow(unused_variables)]
3329 let result = self.device.set(u8::from(MasterBrickFunction::SetWifi2MeshRouterPassword), &payload).await?;
3330 Ok(())
3331 }
3332
3333 pub async fn get_wifi2_mesh_router_password(&mut self) -> Result<String, TinkerforgeError> {
3340 let payload = [0; 0];
3341
3342 #[allow(unused_variables)]
3343 let result = self.device.get(u8::from(MasterBrickFunction::GetWifi2MeshRouterPassword), &payload).await?;
3344 Ok(String::from_le_byte_slice(result.body()))
3345 }
3346
3347 pub async fn get_wifi2_mesh_common_status(&mut self) -> Result<Wifi2MeshCommonStatus, TinkerforgeError> {
3364 let payload = [0; 0];
3365
3366 #[allow(unused_variables)]
3367 let result = self.device.get(u8::from(MasterBrickFunction::GetWifi2MeshCommonStatus), &payload).await?;
3368 Ok(Wifi2MeshCommonStatus::from_le_byte_slice(result.body()))
3369 }
3370
3371 pub async fn get_wifi2_mesh_client_status(&mut self) -> Result<Wifi2MeshClientStatus, TinkerforgeError> {
3378 let payload = [0; 0];
3379
3380 #[allow(unused_variables)]
3381 let result = self.device.get(u8::from(MasterBrickFunction::GetWifi2MeshClientStatus), &payload).await?;
3382 Ok(Wifi2MeshClientStatus::from_le_byte_slice(result.body()))
3383 }
3384
3385 pub async fn get_wifi2_mesh_ap_status(&mut self) -> Result<Wifi2MeshApStatus, TinkerforgeError> {
3392 let payload = [0; 0];
3393
3394 #[allow(unused_variables)]
3395 let result = self.device.get(u8::from(MasterBrickFunction::GetWifi2MeshApStatus), &payload).await?;
3396 Ok(Wifi2MeshApStatus::from_le_byte_slice(result.body()))
3397 }
3398
3399 pub async fn set_bricklet_xmc_flash_config(
3412 &mut self,
3413 config: u32,
3414 parameter1: u32,
3415 parameter2: u32,
3416 data: &[u8; 52],
3417 ) -> Result<SetBrickletXmcFlashConfig, TinkerforgeError> {
3418 let mut payload = [0; 64];
3419 config.write_to_slice(&mut payload[0..4]);
3420 parameter1.write_to_slice(&mut payload[4..8]);
3421 parameter2.write_to_slice(&mut payload[8..12]);
3422 data.write_to_slice(&mut payload[12..64]);
3423
3424 #[allow(unused_variables)]
3425 let result = self.device.get(u8::from(MasterBrickFunction::SetBrickletXmcFlashConfig), &payload).await?;
3426 Ok(SetBrickletXmcFlashConfig::from_le_byte_slice(result.body()))
3427 }
3428
3429 pub async fn set_bricklet_xmc_flash_data(&mut self, data: &[u8; 64]) -> Result<u32, TinkerforgeError> {
3442 let mut payload = [0; 64];
3443 data.write_to_slice(&mut payload[0..64]);
3444
3445 #[allow(unused_variables)]
3446 let result = self.device.get(u8::from(MasterBrickFunction::SetBrickletXmcFlashData), &payload).await?;
3447 Ok(u32::from_le_byte_slice(result.body()))
3448 }
3449
3450 pub async fn set_bricklets_enabled(&mut self, bricklets_enabled: bool) -> Result<(), TinkerforgeError> {
3460 let mut payload = [0; 1];
3461 bricklets_enabled.write_to_slice(&mut payload[0..1]);
3462
3463 #[allow(unused_variables)]
3464 let result = self.device.set(u8::from(MasterBrickFunction::SetBrickletsEnabled), &payload).await?;
3465 Ok(())
3466 }
3467
3468 pub async fn get_bricklets_enabled(&mut self) -> Result<bool, TinkerforgeError> {
3473 let payload = [0; 0];
3474
3475 #[allow(unused_variables)]
3476 let result = self.device.get(u8::from(MasterBrickFunction::GetBrickletsEnabled), &payload).await?;
3477 Ok(bool::from_le_byte_slice(result.body()))
3478 }
3479
3480 pub async fn set_spitfp_baudrate_config(
3502 &mut self,
3503 enable_dynamic_baudrate: bool,
3504 minimum_dynamic_baudrate: u32,
3505 ) -> Result<(), TinkerforgeError> {
3506 let mut payload = [0; 5];
3507 enable_dynamic_baudrate.write_to_slice(&mut payload[0..1]);
3508 minimum_dynamic_baudrate.write_to_slice(&mut payload[1..5]);
3509
3510 #[allow(unused_variables)]
3511 let result = self.device.set(u8::from(MasterBrickFunction::SetSpitfpBaudrateConfig), &payload).await?;
3512 Ok(())
3513 }
3514
3515 pub async fn get_spitfp_baudrate_config(&mut self) -> Result<SpitfpBaudrateConfig, TinkerforgeError> {
3520 let payload = [0; 0];
3521
3522 #[allow(unused_variables)]
3523 let result = self.device.get(u8::from(MasterBrickFunction::GetSpitfpBaudrateConfig), &payload).await?;
3524 Ok(SpitfpBaudrateConfig::from_le_byte_slice(result.body()))
3525 }
3526
3527 pub async fn get_send_timeout_count(&mut self, communication_method: u8) -> Result<u32, TinkerforgeError> {
3547 let mut payload = [0; 1];
3548 communication_method.write_to_slice(&mut payload[0..1]);
3549
3550 #[allow(unused_variables)]
3551 let result = self.device.get(u8::from(MasterBrickFunction::GetSendTimeoutCount), &payload).await?;
3552 Ok(u32::from_le_byte_slice(result.body()))
3553 }
3554
3555 pub async fn set_spitfp_baudrate(&mut self, bricklet_port: char, baudrate: u32) -> Result<(), TinkerforgeError> {
3572 let mut payload = [0; 5];
3573 bricklet_port.write_to_slice(&mut payload[0..1]);
3574 baudrate.write_to_slice(&mut payload[1..5]);
3575
3576 #[allow(unused_variables)]
3577 let result = self.device.set(u8::from(MasterBrickFunction::SetSpitfpBaudrate), &payload).await?;
3578 Ok(())
3579 }
3580
3581 pub async fn get_spitfp_baudrate(&mut self, bricklet_port: char) -> Result<u32, TinkerforgeError> {
3586 let mut payload = [0; 1];
3587 bricklet_port.write_to_slice(&mut payload[0..1]);
3588
3589 #[allow(unused_variables)]
3590 let result = self.device.get(u8::from(MasterBrickFunction::GetSpitfpBaudrate), &payload).await?;
3591 Ok(u32::from_le_byte_slice(result.body()))
3592 }
3593
3594 pub async fn get_spitfp_error_count(&mut self, bricklet_port: char) -> Result<SpitfpErrorCount, TinkerforgeError> {
3609 let mut payload = [0; 1];
3610 bricklet_port.write_to_slice(&mut payload[0..1]);
3611
3612 #[allow(unused_variables)]
3613 let result = self.device.get(u8::from(MasterBrickFunction::GetSpitfpErrorCount), &payload).await?;
3614 Ok(SpitfpErrorCount::from_le_byte_slice(result.body()))
3615 }
3616
3617 pub async fn enable_status_led(&mut self) -> Result<(), TinkerforgeError> {
3627 let payload = [0; 0];
3628
3629 #[allow(unused_variables)]
3630 let result = self.device.set(u8::from(MasterBrickFunction::EnableStatusLed), &payload).await?;
3631 Ok(())
3632 }
3633
3634 pub async fn disable_status_led(&mut self) -> Result<(), TinkerforgeError> {
3644 let payload = [0; 0];
3645
3646 #[allow(unused_variables)]
3647 let result = self.device.set(u8::from(MasterBrickFunction::DisableStatusLed), &payload).await?;
3648 Ok(())
3649 }
3650
3651 pub async fn is_status_led_enabled(&mut self) -> Result<bool, TinkerforgeError> {
3656 let payload = [0; 0];
3657
3658 #[allow(unused_variables)]
3659 let result = self.device.get(u8::from(MasterBrickFunction::IsStatusLedEnabled), &payload).await?;
3660 Ok(bool::from_le_byte_slice(result.body()))
3661 }
3662
3663 pub async fn get_protocol1_bricklet_name(&mut self, port: char) -> Result<Protocol1BrickletName, TinkerforgeError> {
3669 let mut payload = [0; 1];
3670 port.write_to_slice(&mut payload[0..1]);
3671
3672 #[allow(unused_variables)]
3673 let result = self.device.get(u8::from(MasterBrickFunction::GetProtocol1BrickletName), &payload).await?;
3674 Ok(Protocol1BrickletName::from_le_byte_slice(result.body()))
3675 }
3676
3677 pub async fn get_chip_temperature(&mut self) -> Result<i16, TinkerforgeError> {
3684 let payload = [0; 0];
3685
3686 #[allow(unused_variables)]
3687 let result = self.device.get(u8::from(MasterBrickFunction::GetChipTemperature), &payload).await?;
3688 Ok(i16::from_le_byte_slice(result.body()))
3689 }
3690
3691 pub async fn reset(&mut self) -> Result<(), TinkerforgeError> {
3698 let payload = [0; 0];
3699
3700 #[allow(unused_variables)]
3701 let result = self.device.set(u8::from(MasterBrickFunction::Reset), &payload).await?;
3702 Ok(())
3703 }
3704
3705 pub async fn write_bricklet_plugin(&mut self, port: char, offset: u8, chunk: &[u8; 32]) -> Result<(), TinkerforgeError> {
3711 let mut payload = [0; 34];
3712 port.write_to_slice(&mut payload[0..1]);
3713 offset.write_to_slice(&mut payload[1..2]);
3714 chunk.write_to_slice(&mut payload[2..34]);
3715
3716 #[allow(unused_variables)]
3717 let result = self.device.set(u8::from(MasterBrickFunction::WriteBrickletPlugin), &payload).await?;
3718 Ok(())
3719 }
3720
3721 pub async fn read_bricklet_plugin(&mut self, port: char, offset: u8) -> Result<Box<[u8; 32]>, TinkerforgeError> {
3727 let mut payload = [0; 2];
3728 port.write_to_slice(&mut payload[0..1]);
3729 offset.write_to_slice(&mut payload[1..2]);
3730
3731 #[allow(unused_variables)]
3732 let result = self.device.get(u8::from(MasterBrickFunction::ReadBrickletPlugin), &payload).await?;
3733 Ok(Box::<[u8; 32]>::from_le_byte_slice(result.body()))
3734 }
3735
3736 pub async fn get_identity(&mut self) -> Result<Identity, TinkerforgeError> {
3745 let payload = [0; 0];
3746
3747 #[allow(unused_variables)]
3748 let result = self.device.get(u8::from(MasterBrickFunction::GetIdentity), &payload).await?;
3749 Ok(Identity::from_le_byte_slice(result.body()))
3750 }
3751}