tinkerforge/bindings/
thermocouple_bricklet.rs

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