TMR_SR_SerialTransport Struct Reference

#include <tmr_serial_transport.h>

List of all members.

Public Attributes

void * cookie
TMR_Status(* open )(TMR_SR_SerialTransport *)
TMR_Status(* sendBytes )(TMR_SR_SerialTransport *, uint32_t length, uint8_t *message, const uint32_t timeoutMs)
TMR_Status(* receiveBytes )(TMR_SR_SerialTransport *, uint32_t length, uint32_t *messageLength, uint8_t *message, const uint32_t timeoutMs)
TMR_Status(* setBaudRate )(TMR_SR_SerialTransport *, uint32_t rate)
TMR_Status(* shutdown )(TMR_SR_SerialTransport *)
TMR_Status(* flush )(TMR_SR_SerialTransport *)

Detailed Description

The TMR_SR_SerialTransport structure is the mechanism that the SerialReader layer uses to conduct low-level communications with the device. Users may create their own SerialTransport objects for systems with custom serial communication needs, and then use TMR_SR_SerialReader_init() to complete the construction of the reader object, as an alternative to using TMR_create().

See also:
TMR_SR_SerialPortTransportInit and TMR_SR_LlrpEapiTransportInit for pre-existing TMR_SR_SerialTransport implementations.

Member Data Documentation

Context value made available to callback functions

This callback takes any actions necessary (possibly none) to remove unsent data from the output path.

Parameters:
this The TMR_SR_SerialTransport structure.

This callback causes the communication interface to be opened but does not transmit any serial-layer data. This should perform actions such as opening a serial port device or establishing a network connection within a wrapper protocol.

Parameters:
this The TMR_SR_SerialTransport structure.
TMR_Status(* TMR_SR_SerialTransport::receiveBytes)(TMR_SR_SerialTransport *, uint32_t length, uint32_t *messageLength, uint8_t *message, const uint32_t timeoutMs)

This callback receives bytes message on the serial transport. The length parameter contains the size of the buffer pointed to by message. If the operation takes longer than timeoutMs to receive length bytes, TMR_ERROR_TIMEOUT should be returned.

Parameters:
this The TMR_SR_SerialTransport structure.
length The number of bytes to receive.
[out] messageLength The number of bytes received.
[out] message Pointer to the location to store received bytes.
timeoutMs The duration for the operation to complete.
TMR_Status(* TMR_SR_SerialTransport::sendBytes)(TMR_SR_SerialTransport *, uint32_t length, uint8_t *message, const uint32_t timeoutMs)

This callback transmits the provided bytes on the serial transport. If the operation takes longer than timeoutMs to complete, TMR_ERROR_TIMEOUT should be returned.

Parameters:
this The TMR_SR_SerialTransport structure.
length The number of bytes to send.
message Pointer to the bytes to send.
timeoutMs The duration for the operation to complete.

This callback causes the underlying serial transport connected to the device to the provided baud rate.

Parameters:
this The TMR_SR_SerialTransport structure.
rate The baud rate to set.

This callback releases any resources allocated by the transport layer and informs the other end, if necessary, that the connection is ending.

Parameters:
this The TMR_SR_SerialTransport structure.

The documentation for this struct was generated from the following file:
Generated on Wed Aug 7 04:08:19 2019 for Mercury C API by  doxygen 1.6.3