tinkerforge_async/bindings/
linear_poti_bricklet.rs

1/* ***********************************************************
2 * This file was automatically generated on 2024-02-16.      *
3 *                                                           *
4 * Rust Bindings Version 2.0.20                              *
5 *                                                           *
6 * If you have a bugfix for this file and want to commit it, *
7 * please fix the bug in the generator. You can find a link  *
8 * to the generators git repository on tinkerforge.com       *
9 *************************************************************/
10
11//! 59mm linear potentiometer.
12//!
13//! See also the documentation [here](https://www.tinkerforge.com/en/doc/Software/Bricklets/LinearPoti_Bricklet_Rust.html).
14#[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 LinearPotiBrickletFunction {
24    GetPosition,
25    GetAnalogValue,
26    SetPositionCallbackPeriod,
27    GetPositionCallbackPeriod,
28    SetAnalogValueCallbackPeriod,
29    GetAnalogValueCallbackPeriod,
30    SetPositionCallbackThreshold,
31    GetPositionCallbackThreshold,
32    SetAnalogValueCallbackThreshold,
33    GetAnalogValueCallbackThreshold,
34    SetDebouncePeriod,
35    GetDebouncePeriod,
36    GetIdentity,
37    CallbackPosition,
38    CallbackAnalogValue,
39    CallbackPositionReached,
40    CallbackAnalogValueReached,
41}
42impl From<LinearPotiBrickletFunction> for u8 {
43    fn from(fun: LinearPotiBrickletFunction) -> Self {
44        match fun {
45            LinearPotiBrickletFunction::GetPosition => 1,
46            LinearPotiBrickletFunction::GetAnalogValue => 2,
47            LinearPotiBrickletFunction::SetPositionCallbackPeriod => 3,
48            LinearPotiBrickletFunction::GetPositionCallbackPeriod => 4,
49            LinearPotiBrickletFunction::SetAnalogValueCallbackPeriod => 5,
50            LinearPotiBrickletFunction::GetAnalogValueCallbackPeriod => 6,
51            LinearPotiBrickletFunction::SetPositionCallbackThreshold => 7,
52            LinearPotiBrickletFunction::GetPositionCallbackThreshold => 8,
53            LinearPotiBrickletFunction::SetAnalogValueCallbackThreshold => 9,
54            LinearPotiBrickletFunction::GetAnalogValueCallbackThreshold => 10,
55            LinearPotiBrickletFunction::SetDebouncePeriod => 11,
56            LinearPotiBrickletFunction::GetDebouncePeriod => 12,
57            LinearPotiBrickletFunction::GetIdentity => 255,
58            LinearPotiBrickletFunction::CallbackPosition => 13,
59            LinearPotiBrickletFunction::CallbackAnalogValue => 14,
60            LinearPotiBrickletFunction::CallbackPositionReached => 15,
61            LinearPotiBrickletFunction::CallbackAnalogValueReached => 16,
62        }
63    }
64}
65pub const LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_OFF: char = 'x';
66pub const LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_OUTSIDE: char = 'o';
67pub const LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_INSIDE: char = 'i';
68pub const LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_SMALLER: char = '<';
69pub const LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_GREATER: char = '>';
70
71#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
72pub struct PositionCallbackThreshold {
73    pub option: char,
74    pub min: u16,
75    pub max: u16,
76}
77impl FromByteSlice for PositionCallbackThreshold {
78    fn bytes_expected() -> usize {
79        5
80    }
81    fn from_le_byte_slice(bytes: &[u8]) -> PositionCallbackThreshold {
82        PositionCallbackThreshold {
83            option: <char>::from_le_byte_slice(&bytes[0..1]),
84            min: <u16>::from_le_byte_slice(&bytes[1..3]),
85            max: <u16>::from_le_byte_slice(&bytes[3..5]),
86        }
87    }
88}
89
90#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
91pub struct AnalogValueCallbackThreshold {
92    pub option: char,
93    pub min: u16,
94    pub max: u16,
95}
96impl FromByteSlice for AnalogValueCallbackThreshold {
97    fn bytes_expected() -> usize {
98        5
99    }
100    fn from_le_byte_slice(bytes: &[u8]) -> AnalogValueCallbackThreshold {
101        AnalogValueCallbackThreshold {
102            option: <char>::from_le_byte_slice(&bytes[0..1]),
103            min: <u16>::from_le_byte_slice(&bytes[1..3]),
104            max: <u16>::from_le_byte_slice(&bytes[3..5]),
105        }
106    }
107}
108
109#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
110pub struct Identity {
111    pub uid: String,
112    pub connected_uid: String,
113    pub position: char,
114    pub hardware_version: [u8; 3],
115    pub firmware_version: [u8; 3],
116    pub device_identifier: u16,
117}
118impl FromByteSlice for Identity {
119    fn bytes_expected() -> usize {
120        25
121    }
122    fn from_le_byte_slice(bytes: &[u8]) -> Identity {
123        Identity {
124            uid: <String>::from_le_byte_slice(&bytes[0..8]),
125            connected_uid: <String>::from_le_byte_slice(&bytes[8..16]),
126            position: <char>::from_le_byte_slice(&bytes[16..17]),
127            hardware_version: <[u8; 3]>::from_le_byte_slice(&bytes[17..20]),
128            firmware_version: <[u8; 3]>::from_le_byte_slice(&bytes[20..23]),
129            device_identifier: <u16>::from_le_byte_slice(&bytes[23..25]),
130        }
131    }
132}
133
134/// 59mm linear potentiometer
135#[derive(Clone)]
136pub struct LinearPotiBricklet {
137    device: Device,
138}
139impl LinearPotiBricklet {
140    pub const DEVICE_IDENTIFIER: u16 = 213;
141    pub const DEVICE_DISPLAY_NAME: &'static str = "Linear Poti Bricklet";
142    /// Creates an object with the unique device ID `uid`. This object can then be used after the IP Connection `ip_connection` is connected.
143    pub fn new(uid: Uid, connection: AsyncIpConnection) -> LinearPotiBricklet {
144        let mut result = LinearPotiBricklet { device: Device::new([2, 0, 10], uid, connection, Self::DEVICE_DISPLAY_NAME) };
145        result.device.response_expected[u8::from(LinearPotiBrickletFunction::GetPosition) as usize] = ResponseExpectedFlag::AlwaysTrue;
146        result.device.response_expected[u8::from(LinearPotiBrickletFunction::GetAnalogValue) as usize] = ResponseExpectedFlag::AlwaysTrue;
147        result.device.response_expected[u8::from(LinearPotiBrickletFunction::SetPositionCallbackPeriod) as usize] =
148            ResponseExpectedFlag::True;
149        result.device.response_expected[u8::from(LinearPotiBrickletFunction::GetPositionCallbackPeriod) as usize] =
150            ResponseExpectedFlag::AlwaysTrue;
151        result.device.response_expected[u8::from(LinearPotiBrickletFunction::SetAnalogValueCallbackPeriod) as usize] =
152            ResponseExpectedFlag::True;
153        result.device.response_expected[u8::from(LinearPotiBrickletFunction::GetAnalogValueCallbackPeriod) as usize] =
154            ResponseExpectedFlag::AlwaysTrue;
155        result.device.response_expected[u8::from(LinearPotiBrickletFunction::SetPositionCallbackThreshold) as usize] =
156            ResponseExpectedFlag::True;
157        result.device.response_expected[u8::from(LinearPotiBrickletFunction::GetPositionCallbackThreshold) as usize] =
158            ResponseExpectedFlag::AlwaysTrue;
159        result.device.response_expected[u8::from(LinearPotiBrickletFunction::SetAnalogValueCallbackThreshold) as usize] =
160            ResponseExpectedFlag::True;
161        result.device.response_expected[u8::from(LinearPotiBrickletFunction::GetAnalogValueCallbackThreshold) as usize] =
162            ResponseExpectedFlag::AlwaysTrue;
163        result.device.response_expected[u8::from(LinearPotiBrickletFunction::SetDebouncePeriod) as usize] = ResponseExpectedFlag::True;
164        result.device.response_expected[u8::from(LinearPotiBrickletFunction::GetDebouncePeriod) as usize] =
165            ResponseExpectedFlag::AlwaysTrue;
166        result.device.response_expected[u8::from(LinearPotiBrickletFunction::GetIdentity) as usize] = ResponseExpectedFlag::AlwaysTrue;
167        result
168    }
169
170    /// Returns the response expected flag for the function specified by the function ID parameter.
171    /// It is true if the function is expected to send a response, false otherwise.
172    ///
173    /// For getter functions this is enabled by default and cannot be disabled, because those
174    /// functions will always send a response. For callback configuration functions it is enabled
175    /// by default too, but can be disabled by [`set_response_expected`](crate::linear_poti_bricklet::LinearPotiBricklet::set_response_expected).
176    /// For setter functions it is disabled by default and can be enabled.
177    ///
178    /// Enabling the response expected flag for a setter function allows to detect timeouts
179    /// and other error conditions calls of this setter as well. The device will then send a response
180    /// for this purpose. If this flag is disabled for a setter function then no response is sent
181    /// and errors are silently ignored, because they cannot be detected.
182    ///
183    /// See [`set_response_expected`](crate::linear_poti_bricklet::LinearPotiBricklet::set_response_expected) for the list of function ID constants available for this function.
184    pub fn get_response_expected(&mut self, fun: LinearPotiBrickletFunction) -> Result<bool, GetResponseExpectedError> {
185        self.device.get_response_expected(u8::from(fun))
186    }
187
188    /// Changes the response expected flag of the function specified by the function ID parameter.
189    /// This flag can only be changed for setter (default value: false) and callback configuration
190    /// functions (default value: true). For getter functions it is always enabled.
191    ///
192    /// Enabling the response expected flag for a setter function allows to detect timeouts and
193    /// other error conditions calls of this setter as well. The device will then send a response
194    /// for this purpose. If this flag is disabled for a setter function then no response is sent
195    /// and errors are silently ignored, because they cannot be detected.
196    pub fn set_response_expected(
197        &mut self,
198        fun: LinearPotiBrickletFunction,
199        response_expected: bool,
200    ) -> Result<(), SetResponseExpectedError> {
201        self.device.set_response_expected(u8::from(fun), response_expected)
202    }
203
204    /// Changes the response expected flag for all setter and callback configuration functions of this device at once.
205    pub fn set_response_expected_all(&mut self, response_expected: bool) {
206        self.device.set_response_expected_all(response_expected)
207    }
208
209    /// Returns the version of the API definition (major, minor, revision) implemented by this API bindings.
210    /// This is neither the release version of this API bindings nor does it tell you anything about the represented Brick or Bricklet.
211    pub fn get_api_version(&self) -> [u8; 3] {
212        self.device.api_version
213    }
214
215    /// This receiver is triggered periodically with the period that is set by
216    /// [`set_position_callback_period`]. The parameter is the position
217    /// of the linear potentiometer.
218    ///
219    /// The [`get_position_callback_receiver`] receiver is only triggered if the position has changed
220    /// since the last triggering.
221    ///
222    /// [`set_position_callback_period`]: #method.set_position_callback_period
223    /// [`get_position_callback_receiver`]: #method.get_position_callback_receiver
224    pub async fn get_position_callback_receiver(&mut self) -> impl Stream<Item = u16> {
225        self.device
226            .get_callback_receiver(u8::from(LinearPotiBrickletFunction::CallbackPosition))
227            .await
228            .map(|p| u16::from_le_byte_slice(p.body()))
229    }
230
231    /// This receiver is triggered periodically with the period that is set by
232    /// [`set_analog_value_callback_period`]. The parameter is the analog value of the
233    /// Linear Potentiometer.
234    ///
235    /// The [`get_analog_value_callback_receiver`] receiver is only triggered if the position has changed
236    /// since the last triggering.
237    pub async fn get_analog_value_callback_receiver(&mut self) -> impl Stream<Item = u16> {
238        self.device
239            .get_callback_receiver(u8::from(LinearPotiBrickletFunction::CallbackAnalogValue))
240            .await
241            .map(|p| u16::from_le_byte_slice(p.body()))
242    }
243
244    /// This receiver is triggered when the threshold as set by
245    /// [`set_position_callback_threshold`] is reached.
246    /// The parameter is the position of the linear potentiometer.
247    ///
248    /// If the threshold keeps being reached, the receiver is triggered periodically
249    /// with the period as set by [`set_debounce_period`].
250    pub async fn get_position_reached_callback_receiver(&mut self) -> impl Stream<Item = u16> {
251        self.device
252            .get_callback_receiver(u8::from(LinearPotiBrickletFunction::CallbackPositionReached))
253            .await
254            .map(|p| u16::from_le_byte_slice(p.body()))
255    }
256
257    /// This receiver is triggered when the threshold as set by
258    /// [`set_analog_value_callback_threshold`] is reached.
259    /// The parameter is the analog value of the linear potentiometer.
260    ///
261    /// If the threshold keeps being reached, the receiver is triggered periodically
262    /// with the period as set by [`set_debounce_period`].
263    pub async fn get_analog_value_reached_callback_receiver(&mut self) -> impl Stream<Item = u16> {
264        self.device
265            .get_callback_receiver(u8::from(LinearPotiBrickletFunction::CallbackAnalogValueReached))
266            .await
267            .map(|p| u16::from_le_byte_slice(p.body()))
268    }
269
270    /// Returns the position of the linear potentiometer. The value is
271    /// between 0% (slider down) and 100% (slider up).
272    ///
273    /// If you want to get the position periodically, it is recommended to use the
274    /// [`get_position_callback_receiver`] receiver and set the period with
275    /// [`set_position_callback_period`].
276    pub async fn get_position(&mut self) -> Result<u16, TinkerforgeError> {
277        let payload = [0; 0];
278
279        #[allow(unused_variables)]
280        let result = self.device.get(u8::from(LinearPotiBrickletFunction::GetPosition), &payload).await?;
281        Ok(u16::from_le_byte_slice(result.body()))
282    }
283
284    /// Returns the value as read by a 12-bit analog-to-digital converter.
285    ///
286    /// # Note
287    ///  The value returned by [`get_position`] is averaged over several samples
288    ///  to yield less noise, while [`get_analog_value`] gives back raw
289    ///  unfiltered analog values. The only reason to use [`get_analog_value`] is,
290    ///  if you need the full resolution of the analog-to-digital converter.
291    ///
292    /// If you want the analog value periodically, it is recommended to use the
293    /// [`get_analog_value_callback_receiver`] receiver and set the period with
294    /// [`set_analog_value_callback_period`].
295    pub async fn get_analog_value(&mut self) -> Result<u16, TinkerforgeError> {
296        let payload = [0; 0];
297
298        #[allow(unused_variables)]
299        let result = self.device.get(u8::from(LinearPotiBrickletFunction::GetAnalogValue), &payload).await?;
300        Ok(u16::from_le_byte_slice(result.body()))
301    }
302
303    /// Sets the period with which the [`get_position_callback_receiver`] receiver is triggered
304    /// periodically. A value of 0 turns the receiver off.
305    ///
306    /// The [`get_position_callback_receiver`] receiver is only triggered if the position has changed
307    /// since the last triggering.
308    pub async fn set_position_callback_period(&mut self, period: u32) -> Result<(), TinkerforgeError> {
309        let mut payload = [0; 4];
310        period.write_to_slice(&mut payload[0..4]);
311
312        #[allow(unused_variables)]
313        let result = self.device.set(u8::from(LinearPotiBrickletFunction::SetPositionCallbackPeriod), &payload).await?;
314        Ok(())
315    }
316
317    /// Returns the period as set by [`set_position_callback_period`].
318    pub async fn get_position_callback_period(&mut self) -> Result<u32, TinkerforgeError> {
319        let payload = [0; 0];
320
321        #[allow(unused_variables)]
322        let result = self.device.get(u8::from(LinearPotiBrickletFunction::GetPositionCallbackPeriod), &payload).await?;
323        Ok(u32::from_le_byte_slice(result.body()))
324    }
325
326    /// Sets the period with which the [`get_analog_value_callback_receiver`] receiver is triggered
327    /// periodically. A value of 0 turns the receiver off.
328    ///
329    /// The [`get_analog_value_callback_receiver`] receiver is only triggered if the analog value has
330    /// changed since the last triggering.
331    pub async fn set_analog_value_callback_period(&mut self, period: u32) -> Result<(), TinkerforgeError> {
332        let mut payload = [0; 4];
333        period.write_to_slice(&mut payload[0..4]);
334
335        #[allow(unused_variables)]
336        let result = self.device.set(u8::from(LinearPotiBrickletFunction::SetAnalogValueCallbackPeriod), &payload).await?;
337        Ok(())
338    }
339
340    /// Returns the period as set by [`set_analog_value_callback_period`].
341    pub async fn get_analog_value_callback_period(&mut self) -> Result<u32, TinkerforgeError> {
342        let payload = [0; 0];
343
344        #[allow(unused_variables)]
345        let result = self.device.get(u8::from(LinearPotiBrickletFunction::GetAnalogValueCallbackPeriod), &payload).await?;
346        Ok(u32::from_le_byte_slice(result.body()))
347    }
348
349    /// Sets the thresholds for the [`get_position_reached_callback_receiver`] receiver.
350    ///
351    /// The following options are possible:
352    ///
353    ///  Option| Description
354    ///  --- | ---
355    ///  'x'|    Receiver is turned off
356    ///  'o'|    Receiver is triggered when the position is *outside* the min and max values
357    ///  'i'|    Receiver is triggered when the position is *inside* the min and max values
358    ///  '<'|    Receiver is triggered when the position is smaller than the min value (max is ignored)
359    ///  '>'|    Receiver is triggered when the position is greater than the min value (max is ignored)
360    ///
361    /// Associated constants:
362    /// * LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_OFF
363    ///	* LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_OUTSIDE
364    ///	* LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_INSIDE
365    ///	* LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_SMALLER
366    ///	* LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_GREATER
367    pub async fn set_position_callback_threshold(&mut self, option: char, min: u16, max: u16) -> Result<(), TinkerforgeError> {
368        let mut payload = [0; 5];
369        option.write_to_slice(&mut payload[0..1]);
370        min.write_to_slice(&mut payload[1..3]);
371        max.write_to_slice(&mut payload[3..5]);
372
373        #[allow(unused_variables)]
374        let result = self.device.set(u8::from(LinearPotiBrickletFunction::SetPositionCallbackThreshold), &payload).await?;
375        Ok(())
376    }
377
378    /// Returns the threshold as set by [`set_position_callback_threshold`].
379    ///
380    /// Associated constants:
381    /// * LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_OFF
382    ///	* LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_OUTSIDE
383    ///	* LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_INSIDE
384    ///	* LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_SMALLER
385    ///	* LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_GREATER
386    pub async fn get_position_callback_threshold(&mut self) -> Result<PositionCallbackThreshold, TinkerforgeError> {
387        let payload = [0; 0];
388
389        #[allow(unused_variables)]
390        let result = self.device.get(u8::from(LinearPotiBrickletFunction::GetPositionCallbackThreshold), &payload).await?;
391        Ok(PositionCallbackThreshold::from_le_byte_slice(result.body()))
392    }
393
394    /// Sets the thresholds for the [`get_analog_value_reached_callback_receiver`] receiver.
395    ///
396    /// The following options are possible:
397    ///
398    ///  Option| Description
399    ///  --- | ---
400    ///  'x'|    Receiver is turned off
401    ///  'o'|    Receiver is triggered when the analog value is *outside* the min and max values
402    ///  'i'|    Receiver is triggered when the analog value is *inside* the min and max values
403    ///  '<'|    Receiver is triggered when the analog value is smaller than the min value (max is ignored)
404    ///  '>'|    Receiver is triggered when the analog value is greater than the min value (max is ignored)
405    ///
406    /// Associated constants:
407    /// * LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_OFF
408    ///	* LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_OUTSIDE
409    ///	* LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_INSIDE
410    ///	* LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_SMALLER
411    ///	* LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_GREATER
412    pub async fn set_analog_value_callback_threshold(&mut self, option: char, min: u16, max: u16) -> Result<(), TinkerforgeError> {
413        let mut payload = [0; 5];
414        option.write_to_slice(&mut payload[0..1]);
415        min.write_to_slice(&mut payload[1..3]);
416        max.write_to_slice(&mut payload[3..5]);
417
418        #[allow(unused_variables)]
419        let result = self.device.set(u8::from(LinearPotiBrickletFunction::SetAnalogValueCallbackThreshold), &payload).await?;
420        Ok(())
421    }
422
423    /// Returns the threshold as set by [`set_analog_value_callback_threshold`].
424    ///
425    /// Associated constants:
426    /// * LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_OFF
427    ///	* LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_OUTSIDE
428    ///	* LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_INSIDE
429    ///	* LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_SMALLER
430    ///	* LINEAR_POTI_BRICKLET_THRESHOLD_OPTION_GREATER
431    pub async fn get_analog_value_callback_threshold(&mut self) -> Result<AnalogValueCallbackThreshold, TinkerforgeError> {
432        let payload = [0; 0];
433
434        #[allow(unused_variables)]
435        let result = self.device.get(u8::from(LinearPotiBrickletFunction::GetAnalogValueCallbackThreshold), &payload).await?;
436        Ok(AnalogValueCallbackThreshold::from_le_byte_slice(result.body()))
437    }
438
439    /// Sets the period with which the threshold receivers
440    ///
441    /// * [`get_position_reached_callback_receiver`],
442    /// * [`get_analog_value_reached_callback_receiver`]
443    ///
444    /// are triggered, if the thresholds
445    ///
446    /// * [`set_position_callback_threshold`],
447    /// * [`set_analog_value_callback_threshold`]
448    ///
449    /// keep being reached.
450    pub async fn set_debounce_period(&mut self, debounce: u32) -> Result<(), TinkerforgeError> {
451        let mut payload = [0; 4];
452        debounce.write_to_slice(&mut payload[0..4]);
453
454        #[allow(unused_variables)]
455        let result = self.device.set(u8::from(LinearPotiBrickletFunction::SetDebouncePeriod), &payload).await?;
456        Ok(())
457    }
458
459    /// Returns the debounce period as set by [`set_debounce_period`].
460    pub async fn get_debounce_period(&mut self) -> Result<u32, TinkerforgeError> {
461        let payload = [0; 0];
462
463        #[allow(unused_variables)]
464        let result = self.device.get(u8::from(LinearPotiBrickletFunction::GetDebouncePeriod), &payload).await?;
465        Ok(u32::from_le_byte_slice(result.body()))
466    }
467
468    /// Returns the UID, the UID where the Bricklet is connected to,
469    /// the position, the hardware and firmware version as well as the
470    /// device identifier.
471    ///
472    /// The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
473    /// A Bricklet connected to an [Isolator Bricklet](isolator_bricklet) is always at
474    /// position 'z'.
475    ///
476    /// The device identifier numbers can be found [here](device_identifier).
477    /// |device_identifier_constant|
478    pub async fn get_identity(&mut self) -> Result<Identity, TinkerforgeError> {
479        let payload = [0; 0];
480
481        #[allow(unused_variables)]
482        let result = self.device.get(u8::from(LinearPotiBrickletFunction::GetIdentity), &payload).await?;
483        Ok(Identity::from_le_byte_slice(result.body()))
484    }
485}