.redir Method

Function:

For the selected serial port (selection is made through ser.num), redirects the data being RXed to the TX buffer of the same serial port, a different serial port, or another object that supports compatible buffers.

Syntax:

ser.redir(redir as pl_redir) as pl_redir

Returns:

Returns 0 — PL_REDIR_NONE if redirection failed or the same value as was passed in the redir argument.

See Also:

Redirecting Buffers


Part

Description

redir

Platform-specific. See the list of pl_redir constants in the platform specifications.


Details

Data redirection (sometimes referred to as "buffer shorting") allows for efficient data exchange between ports, sockets, etc. in cases where no data alteration or parsing is necessary, while achieving maximum possible throughput is important.

The redir argument, as well as the value returned by this method, are of "enum pl_redir" type. The pl_redir enum defines a set of platform inter-object constants that include all possible redirections for this platform. Specifying a redir value of 0 — PL_REDIR_NONE cancels redirection. When the redirection is enabled for a particular serial port, the on_ser_data_arrival event is not generated for this port.

Once the RX buffer is redirected, certain properties and methods related to the RX buffer will actually return the data for the TX buffer to which this RX buffer was redirected:

A warning note icon.If the redirection is being done on a serial port that is currently opened (ser.enabled = 1 — YES), then this port will be closed automatically.


.redir Method

Details