tinkerforge_async/bindings/
thermocouple_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//! Measures temperature with thermocouples.
12//!
13//! See also the documentation [here](https://www.tinkerforge.com/en/doc/Software/Bricklets/Thermocouple_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 ThermocoupleBrickletFunction {
24    GetTemperature,
25    SetTemperatureCallbackPeriod,
26    GetTemperatureCallbackPeriod,
27    SetTemperatureCallbackThreshold,
28    GetTemperatureCallbackThreshold,
29    SetDebouncePeriod,
30    GetDebouncePeriod,
31    SetConfiguration,
32    GetConfiguration,
33    GetErrorState,
34    GetIdentity,
35    CallbackTemperature,
36    CallbackTemperatureReached,
37    CallbackErrorState,
38}
39impl From<ThermocoupleBrickletFunction> for u8 {
40    fn from(fun: ThermocoupleBrickletFunction) -> Self {
41        match fun {
42            ThermocoupleBrickletFunction::GetTemperature => 1,
43            ThermocoupleBrickletFunction::SetTemperatureCallbackPeriod => 2,
44            ThermocoupleBrickletFunction::GetTemperatureCallbackPeriod => 3,
45            ThermocoupleBrickletFunction::SetTemperatureCallbackThreshold => 4,
46            ThermocoupleBrickletFunction::GetTemperatureCallbackThreshold => 5,
47            ThermocoupleBrickletFunction::SetDebouncePeriod => 6,
48            ThermocoupleBrickletFunction::GetDebouncePeriod => 7,
49            ThermocoupleBrickletFunction::SetConfiguration => 10,
50            ThermocoupleBrickletFunction::GetConfiguration => 11,
51            ThermocoupleBrickletFunction::GetErrorState => 12,
52            ThermocoupleBrickletFunction::GetIdentity => 255,
53            ThermocoupleBrickletFunction::CallbackTemperature => 8,
54            ThermocoupleBrickletFunction::CallbackTemperatureReached => 9,
55            ThermocoupleBrickletFunction::CallbackErrorState => 13,
56        }
57    }
58}
59pub const THERMOCOUPLE_BRICKLET_THRESHOLD_OPTION_OFF: char = 'x';
60pub const THERMOCOUPLE_BRICKLET_THRESHOLD_OPTION_OUTSIDE: char = 'o';
61pub const THERMOCOUPLE_BRICKLET_THRESHOLD_OPTION_INSIDE: char = 'i';
62pub const THERMOCOUPLE_BRICKLET_THRESHOLD_OPTION_SMALLER: char = '<';
63pub const THERMOCOUPLE_BRICKLET_THRESHOLD_OPTION_GREATER: char = '>';
64pub const THERMOCOUPLE_BRICKLET_AVERAGING_1: u8 = 1;
65pub const THERMOCOUPLE_BRICKLET_AVERAGING_2: u8 = 2;
66pub const THERMOCOUPLE_BRICKLET_AVERAGING_4: u8 = 4;
67pub const THERMOCOUPLE_BRICKLET_AVERAGING_8: u8 = 8;
68pub const THERMOCOUPLE_BRICKLET_AVERAGING_16: u8 = 16;
69pub const THERMOCOUPLE_BRICKLET_TYPE_B: u8 = 0;
70pub const THERMOCOUPLE_BRICKLET_TYPE_E: u8 = 1;
71pub const THERMOCOUPLE_BRICKLET_TYPE_J: u8 = 2;
72pub const THERMOCOUPLE_BRICKLET_TYPE_K: u8 = 3;
73pub const THERMOCOUPLE_BRICKLET_TYPE_N: u8 = 4;
74pub const THERMOCOUPLE_BRICKLET_TYPE_R: u8 = 5;
75pub const THERMOCOUPLE_BRICKLET_TYPE_S: u8 = 6;
76pub const THERMOCOUPLE_BRICKLET_TYPE_T: u8 = 7;
77pub const THERMOCOUPLE_BRICKLET_TYPE_G8: u8 = 8;
78pub const THERMOCOUPLE_BRICKLET_TYPE_G32: u8 = 9;
79pub const THERMOCOUPLE_BRICKLET_FILTER_OPTION_50HZ: u8 = 0;
80pub const THERMOCOUPLE_BRICKLET_FILTER_OPTION_60HZ: u8 = 1;
81
82#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
83pub struct TemperatureCallbackThreshold {
84    pub option: char,
85    pub min: i32,
86    pub max: i32,
87}
88impl FromByteSlice for TemperatureCallbackThreshold {
89    fn bytes_expected() -> usize {
90        9
91    }
92    fn from_le_byte_slice(bytes: &[u8]) -> TemperatureCallbackThreshold {
93        TemperatureCallbackThreshold {
94            option: <char>::from_le_byte_slice(&bytes[0..1]),
95            min: <i32>::from_le_byte_slice(&bytes[1..5]),
96            max: <i32>::from_le_byte_slice(&bytes[5..9]),
97        }
98    }
99}
100
101#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
102pub struct Configuration {
103    pub averaging: u8,
104    pub thermocouple_type: u8,
105    pub filter: u8,
106}
107impl FromByteSlice for Configuration {
108    fn bytes_expected() -> usize {
109        3
110    }
111    fn from_le_byte_slice(bytes: &[u8]) -> Configuration {
112        Configuration {
113            averaging: <u8>::from_le_byte_slice(&bytes[0..1]),
114            thermocouple_type: <u8>::from_le_byte_slice(&bytes[1..2]),
115            filter: <u8>::from_le_byte_slice(&bytes[2..3]),
116        }
117    }
118}
119
120#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
121pub struct ErrorState {
122    pub over_under: bool,
123    pub open_circuit: bool,
124}
125impl FromByteSlice for ErrorState {
126    fn bytes_expected() -> usize {
127        2
128    }
129    fn from_le_byte_slice(bytes: &[u8]) -> ErrorState {
130        ErrorState { over_under: <bool>::from_le_byte_slice(&bytes[0..1]), open_circuit: <bool>::from_le_byte_slice(&bytes[1..2]) }
131    }
132}
133
134#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
135pub struct ErrorStateEvent {
136    pub over_under: bool,
137    pub open_circuit: bool,
138}
139impl FromByteSlice for ErrorStateEvent {
140    fn bytes_expected() -> usize {
141        2
142    }
143    fn from_le_byte_slice(bytes: &[u8]) -> ErrorStateEvent {
144        ErrorStateEvent { over_under: <bool>::from_le_byte_slice(&bytes[0..1]), open_circuit: <bool>::from_le_byte_slice(&bytes[1..2]) }
145    }
146}
147
148#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
149pub struct Identity {
150    pub uid: String,
151    pub connected_uid: String,
152    pub position: char,
153    pub hardware_version: [u8; 3],
154    pub firmware_version: [u8; 3],
155    pub device_identifier: u16,
156}
157impl FromByteSlice for Identity {
158    fn bytes_expected() -> usize {
159        25
160    }
161    fn from_le_byte_slice(bytes: &[u8]) -> Identity {
162        Identity {
163            uid: <String>::from_le_byte_slice(&bytes[0..8]),
164            connected_uid: <String>::from_le_byte_slice(&bytes[8..16]),
165            position: <char>::from_le_byte_slice(&bytes[16..17]),
166            hardware_version: <[u8; 3]>::from_le_byte_slice(&bytes[17..20]),
167            firmware_version: <[u8; 3]>::from_le_byte_slice(&bytes[20..23]),
168            device_identifier: <u16>::from_le_byte_slice(&bytes[23..25]),
169        }
170    }
171}
172
173/// Measures temperature with thermocouples
174#[derive(Clone)]
175pub struct ThermocoupleBricklet {
176    device: Device,
177}
178impl ThermocoupleBricklet {
179    pub const DEVICE_IDENTIFIER: u16 = 266;
180    pub const DEVICE_DISPLAY_NAME: &'static str = "Thermocouple Bricklet";
181    /// Creates an object with the unique device ID `uid`. This object can then be used after the IP Connection `ip_connection` is connected.
182    pub fn new(uid: Uid, connection: AsyncIpConnection) -> ThermocoupleBricklet {
183        let mut result = ThermocoupleBricklet { device: Device::new([2, 0, 10], uid, connection, Self::DEVICE_DISPLAY_NAME) };
184        result.device.response_expected[u8::from(ThermocoupleBrickletFunction::GetTemperature) as usize] = ResponseExpectedFlag::AlwaysTrue;
185        result.device.response_expected[u8::from(ThermocoupleBrickletFunction::SetTemperatureCallbackPeriod) as usize] =
186            ResponseExpectedFlag::True;
187        result.device.response_expected[u8::from(ThermocoupleBrickletFunction::GetTemperatureCallbackPeriod) as usize] =
188            ResponseExpectedFlag::AlwaysTrue;
189        result.device.response_expected[u8::from(ThermocoupleBrickletFunction::SetTemperatureCallbackThreshold) as usize] =
190            ResponseExpectedFlag::True;
191        result.device.response_expected[u8::from(ThermocoupleBrickletFunction::GetTemperatureCallbackThreshold) as usize] =
192            ResponseExpectedFlag::AlwaysTrue;
193        result.device.response_expected[u8::from(ThermocoupleBrickletFunction::SetDebouncePeriod) as usize] = ResponseExpectedFlag::True;
194        result.device.response_expected[u8::from(ThermocoupleBrickletFunction::GetDebouncePeriod) as usize] =
195            ResponseExpectedFlag::AlwaysTrue;
196        result.device.response_expected[u8::from(ThermocoupleBrickletFunction::SetConfiguration) as usize] = ResponseExpectedFlag::False;
197        result.device.response_expected[u8::from(ThermocoupleBrickletFunction::GetConfiguration) as usize] =
198            ResponseExpectedFlag::AlwaysTrue;
199        result.device.response_expected[u8::from(ThermocoupleBrickletFunction::GetErrorState) as usize] = ResponseExpectedFlag::AlwaysTrue;
200        result.device.response_expected[u8::from(ThermocoupleBrickletFunction::GetIdentity) as usize] = ResponseExpectedFlag::AlwaysTrue;
201        result
202    }
203
204    /// Returns the response expected flag for the function specified by the function ID parameter.
205    /// It is true if the function is expected to send a response, false otherwise.
206    ///
207    /// For getter functions this is enabled by default and cannot be disabled, because those
208    /// functions will always send a response. For callback configuration functions it is enabled
209    /// by default too, but can be disabled by [`set_response_expected`](crate::thermocouple_bricklet::ThermocoupleBricklet::set_response_expected).
210    /// For setter functions it is disabled by default and can be enabled.
211    ///
212    /// Enabling the response expected flag for a setter function allows to detect timeouts
213    /// and other error conditions calls of this setter as well. The device will then send a response
214    /// for this purpose. If this flag is disabled for a setter function then no response is sent
215    /// and errors are silently ignored, because they cannot be detected.
216    ///
217    /// See [`set_response_expected`](crate::thermocouple_bricklet::ThermocoupleBricklet::set_response_expected) for the list of function ID constants available for this function.
218    pub fn get_response_expected(&mut self, fun: ThermocoupleBrickletFunction) -> Result<bool, GetResponseExpectedError> {
219        self.device.get_response_expected(u8::from(fun))
220    }
221
222    /// Changes the response expected flag of the function specified by the function ID parameter.
223    /// This flag can only be changed for setter (default value: false) and callback configuration
224    /// functions (default value: true). For getter functions it is always enabled.
225    ///
226    /// Enabling the response expected flag for a setter function allows to detect timeouts and
227    /// other error conditions calls of this setter as well. The device will then send a response
228    /// for this purpose. If this flag is disabled for a setter function then no response is sent
229    /// and errors are silently ignored, because they cannot be detected.
230    pub fn set_response_expected(
231        &mut self,
232        fun: ThermocoupleBrickletFunction,
233        response_expected: bool,
234    ) -> Result<(), SetResponseExpectedError> {
235        self.device.set_response_expected(u8::from(fun), response_expected)
236    }
237
238    /// Changes the response expected flag for all setter and callback configuration functions of this device at once.
239    pub fn set_response_expected_all(&mut self, response_expected: bool) {
240        self.device.set_response_expected_all(response_expected)
241    }
242
243    /// Returns the version of the API definition (major, minor, revision) implemented by this API bindings.
244    /// This is neither the release version of this API bindings nor does it tell you anything about the represented Brick or Bricklet.
245    pub fn get_api_version(&self) -> [u8; 3] {
246        self.device.api_version
247    }
248
249    /// This receiver is triggered periodically with the period that is set by
250    /// [`set_temperature_callback_period`]. The parameter is the
251    /// temperature of the thermocouple.
252    ///
253    /// The [`get_temperature_callback_receiver`] receiver is only triggered if the temperature has
254    /// changed since the last triggering.
255    ///
256    /// [`set_temperature_callback_period`]: #method.set_temperature_callback_period
257    /// [`get_temperature_callback_receiver`]: #method.get_temperature_callback_receiver
258    pub async fn get_temperature_callback_receiver(&mut self) -> impl Stream<Item = i32> {
259        self.device
260            .get_callback_receiver(u8::from(ThermocoupleBrickletFunction::CallbackTemperature))
261            .await
262            .map(|p| i32::from_le_byte_slice(p.body()))
263    }
264
265    /// This receiver is triggered when the threshold as set by
266    /// [`set_temperature_callback_threshold`] is reached.
267    /// The parameter is the temperature of the thermocouple.
268    ///
269    /// If the threshold keeps being reached, the receiver is triggered periodically
270    /// with the period as set by [`set_debounce_period`].
271    pub async fn get_temperature_reached_callback_receiver(&mut self) -> impl Stream<Item = i32> {
272        self.device
273            .get_callback_receiver(u8::from(ThermocoupleBrickletFunction::CallbackTemperatureReached))
274            .await
275            .map(|p| i32::from_le_byte_slice(p.body()))
276    }
277
278    /// This Receiver is triggered every time the error state changes
279    /// (see [`get_error_state`]).
280    pub async fn get_error_state_callback_receiver(&mut self) -> impl Stream<Item = ErrorStateEvent> {
281        self.device
282            .get_callback_receiver(u8::from(ThermocoupleBrickletFunction::CallbackErrorState))
283            .await
284            .map(|p| ErrorStateEvent::from_le_byte_slice(p.body()))
285    }
286
287    /// Returns the temperature of the thermocouple.
288    ///
289    /// If you want to get the temperature periodically, it is recommended
290    /// to use the [`get_temperature_callback_receiver`] receiver and set the period with
291    /// [`set_temperature_callback_period`].
292    pub async fn get_temperature(&mut self) -> Result<i32, TinkerforgeError> {
293        let payload = [0; 0];
294
295        #[allow(unused_variables)]
296        let result = self.device.get(u8::from(ThermocoupleBrickletFunction::GetTemperature), &payload).await?;
297        Ok(i32::from_le_byte_slice(result.body()))
298    }
299
300    /// Sets the period with which the [`get_temperature_callback_receiver`] receiver is triggered
301    /// periodically. A value of 0 turns the receiver off.
302    ///
303    /// The [`get_temperature_callback_receiver`] receiver is only triggered if the temperature has changed
304    /// since the last triggering.
305    pub async fn set_temperature_callback_period(&mut self, period: u32) -> Result<(), TinkerforgeError> {
306        let mut payload = [0; 4];
307        period.write_to_slice(&mut payload[0..4]);
308
309        #[allow(unused_variables)]
310        let result = self.device.set(u8::from(ThermocoupleBrickletFunction::SetTemperatureCallbackPeriod), &payload).await?;
311        Ok(())
312    }
313
314    /// Returns the period as set by [`set_temperature_callback_period`].
315    pub async fn get_temperature_callback_period(&mut self) -> Result<u32, TinkerforgeError> {
316        let payload = [0; 0];
317
318        #[allow(unused_variables)]
319        let result = self.device.get(u8::from(ThermocoupleBrickletFunction::GetTemperatureCallbackPeriod), &payload).await?;
320        Ok(u32::from_le_byte_slice(result.body()))
321    }
322
323    /// Sets the thresholds for the [`get_temperature_reached_callback_receiver`] receiver.
324    ///
325    /// The following options are possible:
326    ///
327    ///  Option| Description
328    ///  --- | ---
329    ///  'x'|    Receiver is turned off
330    ///  'o'|    Receiver is triggered when the temperature is *outside* the min and max values
331    ///  'i'|    Receiver is triggered when the temperature is *inside* the min and max values
332    ///  '<'|    Receiver is triggered when the temperature is smaller than the min value (max is ignored)
333    ///  '>'|    Receiver is triggered when the temperature is greater than the min value (max is ignored)
334    ///
335    /// Associated constants:
336    /// * THERMOCOUPLE_BRICKLET_THRESHOLD_OPTION_OFF
337    ///	* THERMOCOUPLE_BRICKLET_THRESHOLD_OPTION_OUTSIDE
338    ///	* THERMOCOUPLE_BRICKLET_THRESHOLD_OPTION_INSIDE
339    ///	* THERMOCOUPLE_BRICKLET_THRESHOLD_OPTION_SMALLER
340    ///	* THERMOCOUPLE_BRICKLET_THRESHOLD_OPTION_GREATER
341    pub async fn set_temperature_callback_threshold(&mut self, option: char, min: i32, max: i32) -> Result<(), TinkerforgeError> {
342        let mut payload = [0; 9];
343        option.write_to_slice(&mut payload[0..1]);
344        min.write_to_slice(&mut payload[1..5]);
345        max.write_to_slice(&mut payload[5..9]);
346
347        #[allow(unused_variables)]
348        let result = self.device.set(u8::from(ThermocoupleBrickletFunction::SetTemperatureCallbackThreshold), &payload).await?;
349        Ok(())
350    }
351
352    /// Returns the threshold as set by [`set_temperature_callback_threshold`].
353    ///
354    /// Associated constants:
355    /// * THERMOCOUPLE_BRICKLET_THRESHOLD_OPTION_OFF
356    ///	* THERMOCOUPLE_BRICKLET_THRESHOLD_OPTION_OUTSIDE
357    ///	* THERMOCOUPLE_BRICKLET_THRESHOLD_OPTION_INSIDE
358    ///	* THERMOCOUPLE_BRICKLET_THRESHOLD_OPTION_SMALLER
359    ///	* THERMOCOUPLE_BRICKLET_THRESHOLD_OPTION_GREATER
360    pub async fn get_temperature_callback_threshold(&mut self) -> Result<TemperatureCallbackThreshold, TinkerforgeError> {
361        let payload = [0; 0];
362
363        #[allow(unused_variables)]
364        let result = self.device.get(u8::from(ThermocoupleBrickletFunction::GetTemperatureCallbackThreshold), &payload).await?;
365        Ok(TemperatureCallbackThreshold::from_le_byte_slice(result.body()))
366    }
367
368    /// Sets the period with which the threshold receiver
369    ///
370    /// * [`get_temperature_reached_callback_receiver`]
371    ///
372    /// is triggered, if the threshold
373    ///
374    /// * [`set_temperature_callback_threshold`]
375    ///
376    /// keeps being reached.
377    pub async fn set_debounce_period(&mut self, debounce: u32) -> Result<(), TinkerforgeError> {
378        let mut payload = [0; 4];
379        debounce.write_to_slice(&mut payload[0..4]);
380
381        #[allow(unused_variables)]
382        let result = self.device.set(u8::from(ThermocoupleBrickletFunction::SetDebouncePeriod), &payload).await?;
383        Ok(())
384    }
385
386    /// Returns the debounce period as set by [`set_debounce_period`].
387    pub async fn get_debounce_period(&mut self) -> Result<u32, TinkerforgeError> {
388        let payload = [0; 0];
389
390        #[allow(unused_variables)]
391        let result = self.device.get(u8::from(ThermocoupleBrickletFunction::GetDebouncePeriod), &payload).await?;
392        Ok(u32::from_le_byte_slice(result.body()))
393    }
394
395    /// You can configure averaging size, thermocouple type and frequency
396    /// filtering.
397    ///
398    /// Available averaging sizes are 1, 2, 4, 8 and 16 samples.
399    ///
400    /// As thermocouple type you can use B, E, J, K, N, R, S and T. If you have a
401    /// different thermocouple or a custom thermocouple you can also use
402    /// G8 and G32. With these types the returned value will not be in °C/100,
403    /// it will be calculated by the following formulas:
404    ///
405    /// * G8: ``value = 8 * 1.6 * 2^17 * Vin``
406    /// * G32: ``value = 32 * 1.6 * 2^17 * Vin``
407    ///
408    /// where Vin is the thermocouple input voltage.
409    ///
410    /// The frequency filter can be either configured to 50Hz or to 60Hz. You should
411    /// configure it according to your utility frequency.
412    ///
413    /// The conversion time depends on the averaging and filter configuration, it can
414    /// be calculated as follows:
415    ///
416    /// * 60Hz: ``time = 82 + (samples - 1) * 16.67``
417    /// * 50Hz: ``time = 98 + (samples - 1) * 20``
418    ///
419    /// Associated constants:
420    /// * THERMOCOUPLE_BRICKLET_AVERAGING_1
421    ///	* THERMOCOUPLE_BRICKLET_AVERAGING_2
422    ///	* THERMOCOUPLE_BRICKLET_AVERAGING_4
423    ///	* THERMOCOUPLE_BRICKLET_AVERAGING_8
424    ///	* THERMOCOUPLE_BRICKLET_AVERAGING_16
425    ///	* THERMOCOUPLE_BRICKLET_TYPE_B
426    ///	* THERMOCOUPLE_BRICKLET_TYPE_E
427    ///	* THERMOCOUPLE_BRICKLET_TYPE_J
428    ///	* THERMOCOUPLE_BRICKLET_TYPE_K
429    ///	* THERMOCOUPLE_BRICKLET_TYPE_N
430    ///	* THERMOCOUPLE_BRICKLET_TYPE_R
431    ///	* THERMOCOUPLE_BRICKLET_TYPE_S
432    ///	* THERMOCOUPLE_BRICKLET_TYPE_T
433    ///	* THERMOCOUPLE_BRICKLET_TYPE_G8
434    ///	* THERMOCOUPLE_BRICKLET_TYPE_G32
435    ///	* THERMOCOUPLE_BRICKLET_FILTER_OPTION_50HZ
436    ///	* THERMOCOUPLE_BRICKLET_FILTER_OPTION_60HZ
437    pub async fn set_configuration(&mut self, averaging: u8, thermocouple_type: u8, filter: u8) -> Result<(), TinkerforgeError> {
438        let mut payload = [0; 3];
439        averaging.write_to_slice(&mut payload[0..1]);
440        thermocouple_type.write_to_slice(&mut payload[1..2]);
441        filter.write_to_slice(&mut payload[2..3]);
442
443        #[allow(unused_variables)]
444        let result = self.device.set(u8::from(ThermocoupleBrickletFunction::SetConfiguration), &payload).await?;
445        Ok(())
446    }
447
448    /// Returns the configuration as set by [`set_configuration`].
449    ///
450    /// Associated constants:
451    /// * THERMOCOUPLE_BRICKLET_AVERAGING_1
452    ///	* THERMOCOUPLE_BRICKLET_AVERAGING_2
453    ///	* THERMOCOUPLE_BRICKLET_AVERAGING_4
454    ///	* THERMOCOUPLE_BRICKLET_AVERAGING_8
455    ///	* THERMOCOUPLE_BRICKLET_AVERAGING_16
456    ///	* THERMOCOUPLE_BRICKLET_TYPE_B
457    ///	* THERMOCOUPLE_BRICKLET_TYPE_E
458    ///	* THERMOCOUPLE_BRICKLET_TYPE_J
459    ///	* THERMOCOUPLE_BRICKLET_TYPE_K
460    ///	* THERMOCOUPLE_BRICKLET_TYPE_N
461    ///	* THERMOCOUPLE_BRICKLET_TYPE_R
462    ///	* THERMOCOUPLE_BRICKLET_TYPE_S
463    ///	* THERMOCOUPLE_BRICKLET_TYPE_T
464    ///	* THERMOCOUPLE_BRICKLET_TYPE_G8
465    ///	* THERMOCOUPLE_BRICKLET_TYPE_G32
466    ///	* THERMOCOUPLE_BRICKLET_FILTER_OPTION_50HZ
467    ///	* THERMOCOUPLE_BRICKLET_FILTER_OPTION_60HZ
468    pub async fn get_configuration(&mut self) -> Result<Configuration, TinkerforgeError> {
469        let payload = [0; 0];
470
471        #[allow(unused_variables)]
472        let result = self.device.get(u8::from(ThermocoupleBrickletFunction::GetConfiguration), &payload).await?;
473        Ok(Configuration::from_le_byte_slice(result.body()))
474    }
475
476    /// Returns the current error state. There are two possible errors:
477    ///
478    /// * Over/Under Voltage and
479    /// * Open Circuit.
480    ///
481    /// Over/Under Voltage happens for voltages below 0V or above 3.3V. In this case
482    /// it is very likely that your thermocouple is defective. An Open Circuit error
483    /// indicates that there is no thermocouple connected.
484    ///
485    /// You can use the [`get_error_state_callback_receiver`] receiver to automatically get triggered
486    /// when the error state changes.
487    pub async fn get_error_state(&mut self) -> Result<ErrorState, TinkerforgeError> {
488        let payload = [0; 0];
489
490        #[allow(unused_variables)]
491        let result = self.device.get(u8::from(ThermocoupleBrickletFunction::GetErrorState), &payload).await?;
492        Ok(ErrorState::from_le_byte_slice(result.body()))
493    }
494
495    /// Returns the UID, the UID where the Bricklet is connected to,
496    /// the position, the hardware and firmware version as well as the
497    /// device identifier.
498    ///
499    /// The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
500    /// A Bricklet connected to an [Isolator Bricklet](isolator_bricklet) is always at
501    /// position 'z'.
502    ///
503    /// The device identifier numbers can be found [here](device_identifier).
504    /// |device_identifier_constant|
505    pub async fn get_identity(&mut self) -> Result<Identity, TinkerforgeError> {
506        let payload = [0; 0];
507
508        #[allow(unused_variables)]
509        let result = self.device.get(u8::from(ThermocoupleBrickletFunction::GetIdentity), &payload).await?;
510        Ok(Identity::from_le_byte_slice(result.body()))
511    }
512}