[][src]Struct tinkerforge::rs232_bricklet::Rs232Bricklet

pub struct Rs232Bricklet { /* fields omitted */ }

Communicates with RS232 devices

Methods

impl Rs232Bricklet[src]

pub const DEVICE_IDENTIFIER: u16[src]

pub const DEVICE_DISPLAY_NAME: &'static str[src]

pub fn new<T: GetRequestSender>(uid: &str, req_sender: T) -> Rs232Bricklet[src]

Creates an object with the unique device ID uid. This object can then be used after the IP Connection ip_connection is connected.

pub fn get_response_expected(
    &mut self,
    fun: Rs232BrickletFunction
) -> Result<bool, GetResponseExpectedError>
[src]

Returns the response expected flag for the function specified by the function ID parameter. It is true if the function is expected to send a response, false otherwise.

For getter functions this is enabled by default and cannot be disabled, because those functions will always send a response. For callback configuration functions it is enabled by default too, but can be disabled by set_response_expected. For setter functions it is disabled by default and can be enabled.

Enabling the response expected flag for a setter function allows to detect timeouts and other error conditions calls of this setter as well. The device will then send a response for this purpose. If this flag is disabled for a setter function then no response is send and errors are silently ignored, because they cannot be detected.

See set_response_expected for the list of function ID constants available for this function.

pub fn set_response_expected(
    &mut self,
    fun: Rs232BrickletFunction,
    response_expected: bool
) -> Result<(), SetResponseExpectedError>
[src]

Changes the response expected flag of the function specified by the function ID parameter. This flag can only be changed for setter (default value: false) and callback configuration functions (default value: true). For getter functions it is always enabled.

Enabling the response expected flag for a setter function allows to detect timeouts and other error conditions calls of this setter as well. The device will then send a response for this purpose. If this flag is disabled for a setter function then no response is send and errors are silently ignored, because they cannot be detected.

pub fn set_response_expected_all(&mut self, response_expected: bool)[src]

Changes the response expected flag for all setter and callback configuration functions of this device at once.

pub fn get_api_version(&self) -> [u8; 3][src]

Returns the version of the API definition (major, minor, revision) implemented by this API bindings. This is neither the release version of this API bindings nor does it tell you anything about the represented Brick or Bricklet.

pub fn get_read_callback_receiver(
    &self
) -> ConvertingCallbackReceiver<ReadEvent>
[src]

This receiver is called if new data is available. The message has a maximum size of 60 characters. The actual length of the message is given in addition.

To enable this receiver, use enable_read_callback.

pub fn get_error_callback_receiver(&self) -> ConvertingCallbackReceiver<u8>[src]

This receiver is called if an error occurs. Possible errors are overrun, parity or framing error.

.. versionadded:: 2.0.1$nbsp;(Plugin)

pub fn write(&self, message: [char; 60], length: u8) -> ConvertingReceiver<u8>[src]

Writes a string of up to 60 characters to the RS232 interface. The string can be binary data, ASCII or similar is not necessary.

The length of the string has to be given as an additional parameter.

The return value is the number of bytes that could be written.

See set_configuration for configuration possibilities regarding baudrate, parity and so on.

pub fn read(&self) -> ConvertingReceiver<Read>[src]

Returns the currently buffered message. The maximum length of message is 60. If the length is given as 0, there was no new data available.

Instead of polling with this function, you can also use callbacks. See enable_read_callback and get_read_callback_receiver receiver.

pub fn enable_read_callback(&self) -> ConvertingReceiver<()>[src]

Enables the get_read_callback_receiver receiver.

By default the receiver is disabled.

pub fn disable_read_callback(&self) -> ConvertingReceiver<()>[src]

Disables the get_read_callback_receiver receiver.

By default the receiver is disabled.

pub fn is_read_callback_enabled(&self) -> ConvertingReceiver<bool>[src]

Returns true if the get_read_callback_receiver receiver is enabled, false otherwise.

pub fn set_configuration(
    &self,
    baudrate: u8,
    parity: u8,
    stopbits: u8,
    wordlength: u8,
    hardware_flowcontrol: u8,
    software_flowcontrol: u8
) -> ConvertingReceiver<()>
[src]

Sets the configuration for the RS232 communication. Available options:

  • Baudrate between 300 and 230400 baud.
  • Parity of none, odd, even or forced parity.
  • Stopbits can be 1 or 2.
  • Word length of 5 to 8.
  • Hard-/Software flow control can either be on or off but not both simultaneously on.

The default is: 115200 baud, parity none, 1 stop bit, word length 8, hard-/software flow control off.

Associated constants:

  • RS232_BRICKLET_BAUDRATE_300
  • RS232_BRICKLET_BAUDRATE_600
  • RS232_BRICKLET_BAUDRATE_1200
  • RS232_BRICKLET_BAUDRATE_2400
  • RS232_BRICKLET_BAUDRATE_4800
  • RS232_BRICKLET_BAUDRATE_9600
  • RS232_BRICKLET_BAUDRATE_14400
  • RS232_BRICKLET_BAUDRATE_19200
  • RS232_BRICKLET_BAUDRATE_28800
  • RS232_BRICKLET_BAUDRATE_38400
  • RS232_BRICKLET_BAUDRATE_57600
  • RS232_BRICKLET_BAUDRATE_115200
  • RS232_BRICKLET_BAUDRATE_230400
  • RS232_BRICKLET_PARITY_NONE
  • RS232_BRICKLET_PARITY_ODD
  • RS232_BRICKLET_PARITY_EVEN
  • RS232_BRICKLET_PARITY_FORCED_PARITY_1
  • RS232_BRICKLET_PARITY_FORCED_PARITY_0
  • RS232_BRICKLET_STOPBITS_1
  • RS232_BRICKLET_STOPBITS_2
  • RS232_BRICKLET_WORDLENGTH_5
  • RS232_BRICKLET_WORDLENGTH_6
  • RS232_BRICKLET_WORDLENGTH_7
  • RS232_BRICKLET_WORDLENGTH_8
  • RS232_BRICKLET_HARDWARE_FLOWCONTROL_OFF
  • RS232_BRICKLET_HARDWARE_FLOWCONTROL_ON
  • RS232_BRICKLET_SOFTWARE_FLOWCONTROL_OFF
  • RS232_BRICKLET_SOFTWARE_FLOWCONTROL_ON

pub fn get_configuration(&self) -> ConvertingReceiver<Configuration>[src]

Returns the configuration as set by set_configuration.

Associated constants:

  • RS232_BRICKLET_BAUDRATE_300
  • RS232_BRICKLET_BAUDRATE_600
  • RS232_BRICKLET_BAUDRATE_1200
  • RS232_BRICKLET_BAUDRATE_2400
  • RS232_BRICKLET_BAUDRATE_4800
  • RS232_BRICKLET_BAUDRATE_9600
  • RS232_BRICKLET_BAUDRATE_14400
  • RS232_BRICKLET_BAUDRATE_19200
  • RS232_BRICKLET_BAUDRATE_28800
  • RS232_BRICKLET_BAUDRATE_38400
  • RS232_BRICKLET_BAUDRATE_57600
  • RS232_BRICKLET_BAUDRATE_115200
  • RS232_BRICKLET_BAUDRATE_230400
  • RS232_BRICKLET_PARITY_NONE
  • RS232_BRICKLET_PARITY_ODD
  • RS232_BRICKLET_PARITY_EVEN
  • RS232_BRICKLET_PARITY_FORCED_PARITY_1
  • RS232_BRICKLET_PARITY_FORCED_PARITY_0
  • RS232_BRICKLET_STOPBITS_1
  • RS232_BRICKLET_STOPBITS_2
  • RS232_BRICKLET_WORDLENGTH_5
  • RS232_BRICKLET_WORDLENGTH_6
  • RS232_BRICKLET_WORDLENGTH_7
  • RS232_BRICKLET_WORDLENGTH_8
  • RS232_BRICKLET_HARDWARE_FLOWCONTROL_OFF
  • RS232_BRICKLET_HARDWARE_FLOWCONTROL_ON
  • RS232_BRICKLET_SOFTWARE_FLOWCONTROL_OFF
  • RS232_BRICKLET_SOFTWARE_FLOWCONTROL_ON

pub fn set_break_condition(&self, break_time: u16) -> ConvertingReceiver<()>[src]

Sets a break condition (the TX output is forced to a logic 0 state). The parameter sets the hold-time of the break condition (in ms).

.. versionadded:: 2.0.2$nbsp;(Plugin)

pub fn get_identity(&self) -> ConvertingReceiver<Identity>[src]

Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.

The position can be 'a', 'b', 'c' or 'd'.

The device identifier numbers can be found here. |device_identifier_constant|

Trait Implementations

impl Clone for Rs232Bricklet[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self