Lely core libraries  2.2.5
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 #ifdef _WIN32
29 union __io_attr {
30  char __size[48];
31  int __align;
32 };
33 #else
34 union __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 
48 enum {
55 };
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
67 int io_attr_get_speed(const io_attr_t *attr);
68 
82 int io_attr_set_speed(io_attr_t *attr, int speed);
83 
92 int io_attr_get_flow_control(const io_attr_t *attr);
93 
104 int io_attr_set_flow_control(io_attr_t *attr, int flow_control);
105 
114 int io_attr_get_parity(const io_attr_t *attr);
115 
129 int io_attr_set_parity(io_attr_t *attr, int parity);
130 
141 int io_attr_get_stop_bits(const io_attr_t *attr);
142 
153 int io_attr_set_stop_bits(io_attr_t *attr, int stop_bits);
154 
164 int io_attr_get_char_size(const io_attr_t *attr);
165 
175 int 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_
IO_PARITY_ODD
@ IO_PARITY_ODD
Odd parity.
Definition: attr.h:52
IO_PARITY_NONE
@ IO_PARITY_NONE
No parity.
Definition: attr.h:50
IO_PARITY_EVEN
@ IO_PARITY_EVEN
Even parity.
Definition: attr.h:54
io_attr_set_flow_control
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:206
io.h
io_attr_get_speed
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:33
io_attr_get_parity
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:237
io_attr_set_stop_bits
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:313
io_attr_set_speed
int io_attr_set_speed(io_attr_t *attr, int speed)
Sets the baud rate of a serial I/O device.
Definition: attr.c:108
io_attr_get_flow_control
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:193
io_attr_set_parity
int io_attr_set_parity(io_attr_t *attr, int parity)
Sets the parity scheme of a serial I/O device.
Definition: attr.c:256
io_attr_get_char_size
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:337
io_attr_set_char_size
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:355
__io_attr
An opaque serial I/O device attributes type.
Definition: attr.h:34
io_attr_get_stop_bits
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:301