Lely core libraries  2.3.4
serial.h File Reference
#include <lely/io/io.h>
Include dependency graph for serial.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  { IO_PURGE_RX = 1 << 0, IO_PURGE_TX = 1 << 1 }
 

Functions

io_handle_t io_open_serial (const char *path, io_attr_t *attr)
 Opens a serial I/O device. More...
 
int io_purge (io_handle_t handle, int flags)
 Purges the receive and/or transmit buffers of a serial I/O device. More...
 
int io_serial_get_attr (io_handle_t handle, io_attr_t *attr)
 Retrieves the current attributes of a serial I/O device and stores them in *attr. More...
 
int io_serial_set_attr (io_handle_t handle, const io_attr_t *attr)
 Sets the attributes of a serial I/O device to those in *attr. More...
 

Detailed Description

This header file is part of the I/O library; it contains the serial I/O declarations.

Author
J. S. Seldenthuis jseld.nosp@m.enth.nosp@m.uis@l.nosp@m.ely..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file serial.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
IO_PURGE_RX 

Purge the receive buffer of a serial I/O device.

IO_PURGE_TX 

Purge the transmit buffer of a serial I/O device.

Definition at line 27 of file serial.h.

Function Documentation

◆ io_open_serial()

io_handle_t io_open_serial ( const char *  path,
io_attr_t attr 
)

Opens a serial I/O device.

Parameters
paththe (platform dependent) path name of the device.
attrthe address at which to store the original device attributes (can be NULL).
Returns
a I/O device handle, or IO_HANDLE_ERROR on error. In the latter case, the error number can be obtained with get_errc().

Definition at line 51 of file serial.c.

◆ io_purge()

int io_purge ( io_handle_t  handle,
int  flags 
)

Purges the receive and/or transmit buffers of a serial I/O device.

Parameters
handlea valid serial device handle.
flagsa flag specifying which of the buffers is to be discarded (any combination of IO_PURGE_RX and IO_PURGE_TX).
Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().
See also
io_serial_flush()

Definition at line 197 of file serial.c.

◆ io_serial_get_attr()

int io_serial_get_attr ( io_handle_t  handle,
io_attr_t attr 
)

Retrieves the current attributes of a serial I/O device and stores them in *attr.

Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().
See also
io_serial_set_attr()

Definition at line 216 of file serial.c.

◆ io_serial_set_attr()

int io_serial_set_attr ( io_handle_t  handle,
const io_attr_t attr 
)

Sets the attributes of a serial I/O device to those in *attr.

Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().
See also
io_serial_get_attr()

Definition at line 242 of file serial.c.