Lely core libraries 2.3.4
attr.h
Go to the documentation of this file.
1
22#ifndef LELY_IO_ATTR_H_
23#define LELY_IO_ATTR_H_
24
25#include <lely/io/io.h>
26
28#if _WIN32
29union __io_attr {
30 char __size[48];
31 int __align;
32};
33#else
34union __io_attr {
35 char __size[60];
36 int __align;
37};
38#endif
39
41#define IO_ATTR_INIT \
42 { \
43 { \
44 0 \
45 } \
46 }
47
48enum {
55};
56
57#ifdef __cplusplus
58extern "C" {
59#endif
60
67int io_attr_get_speed(const io_attr_t *attr);
68
82int io_attr_set_speed(io_attr_t *attr, int speed);
83
92int io_attr_get_flow_control(const io_attr_t *attr);
93
104int io_attr_set_flow_control(io_attr_t *attr, int flow_control);
105
114int io_attr_get_parity(const io_attr_t *attr);
115
129int io_attr_set_parity(io_attr_t *attr, int parity);
130
141int io_attr_get_stop_bits(const io_attr_t *attr);
142
153int io_attr_set_stop_bits(io_attr_t *attr, int stop_bits);
154
164int io_attr_get_char_size(const io_attr_t *attr);
165
175int io_attr_set_char_size(io_attr_t *attr, int char_size);
176
177#ifdef __cplusplus
178}
179#endif
180
181#endif // !LELY_IO_ATTR_H_
int io_attr_get_char_size(const io_attr_t *attr)
Obtains the character size (in bits) from the attributes of a serial I/O device.
Definition: attr.c:341
int io_attr_get_flow_control(const io_attr_t *attr)
Checks if flow control is enabled in the attributes of a serial I/O device.
Definition: attr.c:197
int io_attr_set_parity(io_attr_t *attr, int parity)
Sets the parity scheme of a serial I/O device.
Definition: attr.c:260
int io_attr_get_speed(const io_attr_t *attr)
Returns the baud rate from the attributes of a serial I/O device, or -1 on error.
Definition: attr.c:37
int io_attr_set_flow_control(io_attr_t *attr, int flow_control)
Disables flow control for a serial I/O device if flow_control is zero, and enables it otherwise.
Definition: attr.c:210
@ IO_PARITY_NONE
No parity.
Definition: attr.h:50
@ IO_PARITY_ODD
Odd parity.
Definition: attr.h:52
@ IO_PARITY_EVEN
Even parity.
Definition: attr.h:54
int io_attr_set_stop_bits(io_attr_t *attr, int stop_bits)
Sets the number of stop bits used in a serial I/O device to one if stop_bits is zero,...
Definition: attr.c:317
int io_attr_set_speed(io_attr_t *attr, int speed)
Sets the baud rate of a serial I/O device.
Definition: attr.c:112
int io_attr_get_parity(const io_attr_t *attr)
Obtains the parity scheme from the attributes of a serial I/O device.
Definition: attr.c:241
int io_attr_get_stop_bits(const io_attr_t *attr)
Obtains the number of stop bits used from the attributes of a serial I/O device.
Definition: attr.c:305
int io_attr_set_char_size(io_attr_t *attr, int char_size)
Sets the character size (in bits) of a serial I/O device.
Definition: attr.c:359
This is the public header file of the I/O library.
An opaque serial I/O device attributes type.
Definition: attr.h:34