1#[allow(unused_imports)]
15use crate::{
16 base58::Uid, byte_converter::*, device::*, error::TinkerforgeError, ip_connection::async_io::AsyncIpConnection,
17 low_level_traits::LowLevelRead,
18};
19#[allow(unused_imports)]
20use futures_core::Stream;
21#[allow(unused_imports)]
22use tokio_stream::StreamExt;
23pub enum IndustrialAnalogOutV2BrickletFunction {
24 SetEnabled,
25 GetEnabled,
26 SetVoltage,
27 GetVoltage,
28 SetCurrent,
29 GetCurrent,
30 SetConfiguration,
31 GetConfiguration,
32 SetOutLedConfig,
33 GetOutLedConfig,
34 SetOutLedStatusConfig,
35 GetOutLedStatusConfig,
36 GetSpitfpErrorCount,
37 SetBootloaderMode,
38 GetBootloaderMode,
39 SetWriteFirmwarePointer,
40 WriteFirmware,
41 SetStatusLedConfig,
42 GetStatusLedConfig,
43 GetChipTemperature,
44 Reset,
45 WriteUid,
46 ReadUid,
47 GetIdentity,
48}
49impl From<IndustrialAnalogOutV2BrickletFunction> for u8 {
50 fn from(fun: IndustrialAnalogOutV2BrickletFunction) -> Self {
51 match fun {
52 IndustrialAnalogOutV2BrickletFunction::SetEnabled => 1,
53 IndustrialAnalogOutV2BrickletFunction::GetEnabled => 2,
54 IndustrialAnalogOutV2BrickletFunction::SetVoltage => 3,
55 IndustrialAnalogOutV2BrickletFunction::GetVoltage => 4,
56 IndustrialAnalogOutV2BrickletFunction::SetCurrent => 5,
57 IndustrialAnalogOutV2BrickletFunction::GetCurrent => 6,
58 IndustrialAnalogOutV2BrickletFunction::SetConfiguration => 7,
59 IndustrialAnalogOutV2BrickletFunction::GetConfiguration => 8,
60 IndustrialAnalogOutV2BrickletFunction::SetOutLedConfig => 9,
61 IndustrialAnalogOutV2BrickletFunction::GetOutLedConfig => 10,
62 IndustrialAnalogOutV2BrickletFunction::SetOutLedStatusConfig => 11,
63 IndustrialAnalogOutV2BrickletFunction::GetOutLedStatusConfig => 12,
64 IndustrialAnalogOutV2BrickletFunction::GetSpitfpErrorCount => 234,
65 IndustrialAnalogOutV2BrickletFunction::SetBootloaderMode => 235,
66 IndustrialAnalogOutV2BrickletFunction::GetBootloaderMode => 236,
67 IndustrialAnalogOutV2BrickletFunction::SetWriteFirmwarePointer => 237,
68 IndustrialAnalogOutV2BrickletFunction::WriteFirmware => 238,
69 IndustrialAnalogOutV2BrickletFunction::SetStatusLedConfig => 239,
70 IndustrialAnalogOutV2BrickletFunction::GetStatusLedConfig => 240,
71 IndustrialAnalogOutV2BrickletFunction::GetChipTemperature => 242,
72 IndustrialAnalogOutV2BrickletFunction::Reset => 243,
73 IndustrialAnalogOutV2BrickletFunction::WriteUid => 248,
74 IndustrialAnalogOutV2BrickletFunction::ReadUid => 249,
75 IndustrialAnalogOutV2BrickletFunction::GetIdentity => 255,
76 }
77 }
78}
79pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_VOLTAGE_RANGE_0_TO_5V: u8 = 0;
80pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_VOLTAGE_RANGE_0_TO_10V: u8 = 1;
81pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_CURRENT_RANGE_4_TO_20MA: u8 = 0;
82pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_CURRENT_RANGE_0_TO_20MA: u8 = 1;
83pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_CURRENT_RANGE_0_TO_24MA: u8 = 2;
84pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_OUT_LED_CONFIG_OFF: u8 = 0;
85pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_OUT_LED_CONFIG_ON: u8 = 1;
86pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_OUT_LED_CONFIG_SHOW_HEARTBEAT: u8 = 2;
87pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_OUT_LED_CONFIG_SHOW_OUT_STATUS: u8 = 3;
88pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_OUT_LED_STATUS_CONFIG_THRESHOLD: u8 = 0;
89pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_OUT_LED_STATUS_CONFIG_INTENSITY: u8 = 1;
90pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_BOOTLOADER_MODE_BOOTLOADER: u8 = 0;
91pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_BOOTLOADER_MODE_FIRMWARE: u8 = 1;
92pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT: u8 = 2;
93pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT: u8 = 3;
94pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT: u8 = 4;
95pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_BOOTLOADER_STATUS_OK: u8 = 0;
96pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_BOOTLOADER_STATUS_INVALID_MODE: u8 = 1;
97pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_BOOTLOADER_STATUS_NO_CHANGE: u8 = 2;
98pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT: u8 = 3;
99pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT: u8 = 4;
100pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_BOOTLOADER_STATUS_CRC_MISMATCH: u8 = 5;
101pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_STATUS_LED_CONFIG_OFF: u8 = 0;
102pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_STATUS_LED_CONFIG_ON: u8 = 1;
103pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_STATUS_LED_CONFIG_SHOW_HEARTBEAT: u8 = 2;
104pub const INDUSTRIAL_ANALOG_OUT_V2_BRICKLET_STATUS_LED_CONFIG_SHOW_STATUS: u8 = 3;
105
106#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
107pub struct Configuration {
108 pub voltage_range: u8,
109 pub current_range: u8,
110}
111impl FromByteSlice for Configuration {
112 fn bytes_expected() -> usize {
113 2
114 }
115 fn from_le_byte_slice(bytes: &[u8]) -> Configuration {
116 Configuration { voltage_range: <u8>::from_le_byte_slice(&bytes[0..1]), current_range: <u8>::from_le_byte_slice(&bytes[1..2]) }
117 }
118}
119
120#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
121pub struct OutLedStatusConfig {
122 pub min: u16,
123 pub max: u16,
124 pub config: u8,
125}
126impl FromByteSlice for OutLedStatusConfig {
127 fn bytes_expected() -> usize {
128 5
129 }
130 fn from_le_byte_slice(bytes: &[u8]) -> OutLedStatusConfig {
131 OutLedStatusConfig {
132 min: <u16>::from_le_byte_slice(&bytes[0..2]),
133 max: <u16>::from_le_byte_slice(&bytes[2..4]),
134 config: <u8>::from_le_byte_slice(&bytes[4..5]),
135 }
136 }
137}
138
139#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
140pub struct SpitfpErrorCount {
141 pub error_count_ack_checksum: u32,
142 pub error_count_message_checksum: u32,
143 pub error_count_frame: u32,
144 pub error_count_overflow: u32,
145}
146impl FromByteSlice for SpitfpErrorCount {
147 fn bytes_expected() -> usize {
148 16
149 }
150 fn from_le_byte_slice(bytes: &[u8]) -> SpitfpErrorCount {
151 SpitfpErrorCount {
152 error_count_ack_checksum: <u32>::from_le_byte_slice(&bytes[0..4]),
153 error_count_message_checksum: <u32>::from_le_byte_slice(&bytes[4..8]),
154 error_count_frame: <u32>::from_le_byte_slice(&bytes[8..12]),
155 error_count_overflow: <u32>::from_le_byte_slice(&bytes[12..16]),
156 }
157 }
158}
159
160#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
161pub struct Identity {
162 pub uid: String,
163 pub connected_uid: String,
164 pub position: char,
165 pub hardware_version: [u8; 3],
166 pub firmware_version: [u8; 3],
167 pub device_identifier: u16,
168}
169impl FromByteSlice for Identity {
170 fn bytes_expected() -> usize {
171 25
172 }
173 fn from_le_byte_slice(bytes: &[u8]) -> Identity {
174 Identity {
175 uid: <String>::from_le_byte_slice(&bytes[0..8]),
176 connected_uid: <String>::from_le_byte_slice(&bytes[8..16]),
177 position: <char>::from_le_byte_slice(&bytes[16..17]),
178 hardware_version: <[u8; 3]>::from_le_byte_slice(&bytes[17..20]),
179 firmware_version: <[u8; 3]>::from_le_byte_slice(&bytes[20..23]),
180 device_identifier: <u16>::from_le_byte_slice(&bytes[23..25]),
181 }
182 }
183}
184
185#[derive(Clone)]
187pub struct IndustrialAnalogOutV2Bricklet {
188 device: Device,
189}
190impl IndustrialAnalogOutV2Bricklet {
191 pub const DEVICE_IDENTIFIER: u16 = 2116;
192 pub const DEVICE_DISPLAY_NAME: &'static str = "Industrial Analog Out Bricklet 2.0";
193 pub fn new(uid: Uid, connection: AsyncIpConnection) -> IndustrialAnalogOutV2Bricklet {
195 let mut result = IndustrialAnalogOutV2Bricklet { device: Device::new([2, 0, 10], uid, connection, Self::DEVICE_DISPLAY_NAME) };
196 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::SetEnabled) as usize] = ResponseExpectedFlag::False;
197 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::GetEnabled) as usize] =
198 ResponseExpectedFlag::AlwaysTrue;
199 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::SetVoltage) as usize] = ResponseExpectedFlag::False;
200 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::GetVoltage) as usize] =
201 ResponseExpectedFlag::AlwaysTrue;
202 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::SetCurrent) as usize] = ResponseExpectedFlag::False;
203 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::GetCurrent) as usize] =
204 ResponseExpectedFlag::AlwaysTrue;
205 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::SetConfiguration) as usize] =
206 ResponseExpectedFlag::False;
207 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::GetConfiguration) as usize] =
208 ResponseExpectedFlag::AlwaysTrue;
209 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::SetOutLedConfig) as usize] =
210 ResponseExpectedFlag::False;
211 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::GetOutLedConfig) as usize] =
212 ResponseExpectedFlag::AlwaysTrue;
213 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::SetOutLedStatusConfig) as usize] =
214 ResponseExpectedFlag::False;
215 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::GetOutLedStatusConfig) as usize] =
216 ResponseExpectedFlag::AlwaysTrue;
217 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::GetSpitfpErrorCount) as usize] =
218 ResponseExpectedFlag::AlwaysTrue;
219 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::SetBootloaderMode) as usize] =
220 ResponseExpectedFlag::AlwaysTrue;
221 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::GetBootloaderMode) as usize] =
222 ResponseExpectedFlag::AlwaysTrue;
223 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::SetWriteFirmwarePointer) as usize] =
224 ResponseExpectedFlag::False;
225 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::WriteFirmware) as usize] =
226 ResponseExpectedFlag::AlwaysTrue;
227 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::SetStatusLedConfig) as usize] =
228 ResponseExpectedFlag::False;
229 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::GetStatusLedConfig) as usize] =
230 ResponseExpectedFlag::AlwaysTrue;
231 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::GetChipTemperature) as usize] =
232 ResponseExpectedFlag::AlwaysTrue;
233 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::Reset) as usize] = ResponseExpectedFlag::False;
234 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::WriteUid) as usize] = ResponseExpectedFlag::False;
235 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::ReadUid) as usize] =
236 ResponseExpectedFlag::AlwaysTrue;
237 result.device.response_expected[u8::from(IndustrialAnalogOutV2BrickletFunction::GetIdentity) as usize] =
238 ResponseExpectedFlag::AlwaysTrue;
239 result
240 }
241
242 pub fn get_response_expected(&mut self, fun: IndustrialAnalogOutV2BrickletFunction) -> Result<bool, GetResponseExpectedError> {
257 self.device.get_response_expected(u8::from(fun))
258 }
259
260 pub fn set_response_expected(
269 &mut self,
270 fun: IndustrialAnalogOutV2BrickletFunction,
271 response_expected: bool,
272 ) -> Result<(), SetResponseExpectedError> {
273 self.device.set_response_expected(u8::from(fun), response_expected)
274 }
275
276 pub fn set_response_expected_all(&mut self, response_expected: bool) {
278 self.device.set_response_expected_all(response_expected)
279 }
280
281 pub fn get_api_version(&self) -> [u8; 3] {
284 self.device.api_version
285 }
286
287 pub async fn set_enabled(&mut self, enabled: bool) -> Result<(), TinkerforgeError> {
289 let mut payload = [0; 1];
290 enabled.write_to_slice(&mut payload[0..1]);
291
292 #[allow(unused_variables)]
293 let result = self.device.set(u8::from(IndustrialAnalogOutV2BrickletFunction::SetEnabled), &payload).await?;
294 Ok(())
295 }
296
297 pub async fn get_enabled(&mut self) -> Result<bool, TinkerforgeError> {
299 let payload = [0; 0];
300
301 #[allow(unused_variables)]
302 let result = self.device.get(u8::from(IndustrialAnalogOutV2BrickletFunction::GetEnabled), &payload).await?;
303 Ok(bool::from_le_byte_slice(result.body()))
304 }
305
306 pub async fn set_voltage(&mut self, voltage: u16) -> Result<(), TinkerforgeError> {
311 let mut payload = [0; 2];
312 voltage.write_to_slice(&mut payload[0..2]);
313
314 #[allow(unused_variables)]
315 let result = self.device.set(u8::from(IndustrialAnalogOutV2BrickletFunction::SetVoltage), &payload).await?;
316 Ok(())
317 }
318
319 pub async fn get_voltage(&mut self) -> Result<u16, TinkerforgeError> {
321 let payload = [0; 0];
322
323 #[allow(unused_variables)]
324 let result = self.device.get(u8::from(IndustrialAnalogOutV2BrickletFunction::GetVoltage), &payload).await?;
325 Ok(u16::from_le_byte_slice(result.body()))
326 }
327
328 pub async fn set_current(&mut self, current: u16) -> Result<(), TinkerforgeError> {
333 let mut payload = [0; 2];
334 current.write_to_slice(&mut payload[0..2]);
335
336 #[allow(unused_variables)]
337 let result = self.device.set(u8::from(IndustrialAnalogOutV2BrickletFunction::SetCurrent), &payload).await?;
338 Ok(())
339 }
340
341 pub async fn get_current(&mut self) -> Result<u16, TinkerforgeError> {
343 let payload = [0; 0];
344
345 #[allow(unused_variables)]
346 let result = self.device.get(u8::from(IndustrialAnalogOutV2BrickletFunction::GetCurrent), &payload).await?;
347 Ok(u16::from_le_byte_slice(result.body()))
348 }
349
350 pub async fn set_configuration(&mut self, voltage_range: u8, current_range: u8) -> Result<(), TinkerforgeError> {
373 let mut payload = [0; 2];
374 voltage_range.write_to_slice(&mut payload[0..1]);
375 current_range.write_to_slice(&mut payload[1..2]);
376
377 #[allow(unused_variables)]
378 let result = self.device.set(u8::from(IndustrialAnalogOutV2BrickletFunction::SetConfiguration), &payload).await?;
379 Ok(())
380 }
381
382 pub async fn get_configuration(&mut self) -> Result<Configuration, TinkerforgeError> {
391 let payload = [0; 0];
392
393 #[allow(unused_variables)]
394 let result = self.device.get(u8::from(IndustrialAnalogOutV2BrickletFunction::GetConfiguration), &payload).await?;
395 Ok(Configuration::from_le_byte_slice(result.body()))
396 }
397
398 pub async fn set_out_led_config(&mut self, config: u8) -> Result<(), TinkerforgeError> {
411 let mut payload = [0; 1];
412 config.write_to_slice(&mut payload[0..1]);
413
414 #[allow(unused_variables)]
415 let result = self.device.set(u8::from(IndustrialAnalogOutV2BrickletFunction::SetOutLedConfig), &payload).await?;
416 Ok(())
417 }
418
419 pub async fn get_out_led_config(&mut self) -> Result<u8, TinkerforgeError> {
427 let payload = [0; 0];
428
429 #[allow(unused_variables)]
430 let result = self.device.get(u8::from(IndustrialAnalogOutV2BrickletFunction::GetOutLedConfig), &payload).await?;
431 Ok(u8::from_le_byte_slice(result.body()))
432 }
433
434 pub async fn set_out_led_status_config(&mut self, min: u16, max: u16, config: u8) -> Result<(), TinkerforgeError> {
460 let mut payload = [0; 5];
461 min.write_to_slice(&mut payload[0..2]);
462 max.write_to_slice(&mut payload[2..4]);
463 config.write_to_slice(&mut payload[4..5]);
464
465 #[allow(unused_variables)]
466 let result = self.device.set(u8::from(IndustrialAnalogOutV2BrickletFunction::SetOutLedStatusConfig), &payload).await?;
467 Ok(())
468 }
469
470 pub async fn get_out_led_status_config(&mut self) -> Result<OutLedStatusConfig, TinkerforgeError> {
476 let payload = [0; 0];
477
478 #[allow(unused_variables)]
479 let result = self.device.get(u8::from(IndustrialAnalogOutV2BrickletFunction::GetOutLedStatusConfig), &payload).await?;
480 Ok(OutLedStatusConfig::from_le_byte_slice(result.body()))
481 }
482
483 pub async fn get_spitfp_error_count(&mut self) -> Result<SpitfpErrorCount, TinkerforgeError> {
495 let payload = [0; 0];
496
497 #[allow(unused_variables)]
498 let result = self.device.get(u8::from(IndustrialAnalogOutV2BrickletFunction::GetSpitfpErrorCount), &payload).await?;
499 Ok(SpitfpErrorCount::from_le_byte_slice(result.body()))
500 }
501
502 pub async fn set_bootloader_mode(&mut self, mode: u8) -> Result<u8, TinkerforgeError> {
525 let mut payload = [0; 1];
526 mode.write_to_slice(&mut payload[0..1]);
527
528 #[allow(unused_variables)]
529 let result = self.device.get(u8::from(IndustrialAnalogOutV2BrickletFunction::SetBootloaderMode), &payload).await?;
530 Ok(u8::from_le_byte_slice(result.body()))
531 }
532
533 pub async fn get_bootloader_mode(&mut self) -> Result<u8, TinkerforgeError> {
542 let payload = [0; 0];
543
544 #[allow(unused_variables)]
545 let result = self.device.get(u8::from(IndustrialAnalogOutV2BrickletFunction::GetBootloaderMode), &payload).await?;
546 Ok(u8::from_le_byte_slice(result.body()))
547 }
548
549 pub async fn set_write_firmware_pointer(&mut self, pointer: u32) -> Result<(), TinkerforgeError> {
556 let mut payload = [0; 4];
557 pointer.write_to_slice(&mut payload[0..4]);
558
559 #[allow(unused_variables)]
560 let result = self.device.set(u8::from(IndustrialAnalogOutV2BrickletFunction::SetWriteFirmwarePointer), &payload).await?;
561 Ok(())
562 }
563
564 pub async fn write_firmware(&mut self, data: &[u8; 64]) -> Result<u8, TinkerforgeError> {
573 let mut payload = [0; 64];
574 data.write_to_slice(&mut payload[0..64]);
575
576 #[allow(unused_variables)]
577 let result = self.device.get(u8::from(IndustrialAnalogOutV2BrickletFunction::WriteFirmware), &payload).await?;
578 Ok(u8::from_le_byte_slice(result.body()))
579 }
580
581 pub async fn set_status_led_config(&mut self, config: u8) -> Result<(), TinkerforgeError> {
595 let mut payload = [0; 1];
596 config.write_to_slice(&mut payload[0..1]);
597
598 #[allow(unused_variables)]
599 let result = self.device.set(u8::from(IndustrialAnalogOutV2BrickletFunction::SetStatusLedConfig), &payload).await?;
600 Ok(())
601 }
602
603 pub async fn get_status_led_config(&mut self) -> Result<u8, TinkerforgeError> {
611 let payload = [0; 0];
612
613 #[allow(unused_variables)]
614 let result = self.device.get(u8::from(IndustrialAnalogOutV2BrickletFunction::GetStatusLedConfig), &payload).await?;
615 Ok(u8::from_le_byte_slice(result.body()))
616 }
617
618 pub async fn get_chip_temperature(&mut self) -> Result<i16, TinkerforgeError> {
625 let payload = [0; 0];
626
627 #[allow(unused_variables)]
628 let result = self.device.get(u8::from(IndustrialAnalogOutV2BrickletFunction::GetChipTemperature), &payload).await?;
629 Ok(i16::from_le_byte_slice(result.body()))
630 }
631
632 pub async fn reset(&mut self) -> Result<(), TinkerforgeError> {
639 let payload = [0; 0];
640
641 #[allow(unused_variables)]
642 let result = self.device.set(u8::from(IndustrialAnalogOutV2BrickletFunction::Reset), &payload).await?;
643 Ok(())
644 }
645
646 pub async fn write_uid(&mut self, uid: u32) -> Result<(), TinkerforgeError> {
652 let mut payload = [0; 4];
653 uid.write_to_slice(&mut payload[0..4]);
654
655 #[allow(unused_variables)]
656 let result = self.device.set(u8::from(IndustrialAnalogOutV2BrickletFunction::WriteUid), &payload).await?;
657 Ok(())
658 }
659
660 pub async fn read_uid(&mut self) -> Result<u32, TinkerforgeError> {
663 let payload = [0; 0];
664
665 #[allow(unused_variables)]
666 let result = self.device.get(u8::from(IndustrialAnalogOutV2BrickletFunction::ReadUid), &payload).await?;
667 Ok(u32::from_le_byte_slice(result.body()))
668 }
669
670 pub async fn get_identity(&mut self) -> Result<Identity, TinkerforgeError> {
681 let payload = [0; 0];
682
683 #[allow(unused_variables)]
684 let result = self.device.get(u8::from(IndustrialAnalogOutV2BrickletFunction::GetIdentity), &payload).await?;
685 Ok(Identity::from_le_byte_slice(result.body()))
686 }
687}