![]() |
![]() |
![]() |
ntdisp reference manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
struct NtdSerial; struct NtdSerialClass; NtdSerial * ntd_serial_new (const gchar *file
); void ntd_serial_set (NtdSerial *serial
,NtdBaud baud
,NtdParity parity
,NtdDataBits data_bits
,NtdStopBits stop_bits
); void ntd_serial_set_exclusive (NtdSerial *serial
,gboolean exclusive
); gboolean ntd_serial_get_exclusive (NtdSerial *serial
); void ntd_serial_set_baud (NtdSerial *serial
,NtdBaud baud
); NtdBaud ntd_serial_get_baud (NtdSerial *serial
); void ntd_serial_set_parity (NtdSerial *serial
,NtdParity parity
); NtdParity ntd_serial_get_parity (NtdSerial *serial
); void ntd_serial_set_data_bits (NtdSerial *serial
,NtdDataBits data_bits
); NtdDataBits ntd_serial_get_data_bits (NtdSerial *serial
); void ntd_serial_set_stop_bits (NtdSerial *serial
,NtdStopBits stop_bits
); NtdStopBits ntd_serial_get_stop_bits (NtdSerial *serial
); void ntd_serial_set_software_flow (NtdSerial *serial
,NtdSoftwareFlow software_flow
); NtdSoftwareFlow ntd_serial_get_software_flow (NtdSerial *serial
); void ntd_serial_set_hardware_flow (NtdSerial *serial
,NtdHardwareFlow hardware_flow
); NtdHardwareFlow ntd_serial_get_hardware_flow (NtdSerial *serial
); void ntd_serial_set_timeout (NtdSerial *serial
,gdouble timeout
); gdouble ntd_serial_get_timeout (NtdSerial *serial
);
"baud" NtdBaud : Read / Write "data-bits" NtdDataBits : Read / Write "exclusive" gboolean : Read / Write "hardware-flow" NtdHardwareFlow : Read / Write "parity" NtdParity : Read / Write "software-flow" NtdSoftwareFlow : Read / Write "stop-bits" NtdStopBits : Read / Write "timeout" gdouble : Read / Write
struct NtdSerial;
All fields are private and should not be used directly. Use its public methods instead.
NtdSerial * ntd_serial_new (const gchar *file
);
Creates a new NtdSerial instance.
|
device file, such as "/dev/ttyS0" on GNU/Linux |
Returns : |
the newly created object. |
void ntd_serial_set (NtdSerial *serial
,NtdBaud baud
,NtdParity parity
,NtdDataBits data_bits
,NtdStopBits stop_bits
);
Sets in one shot all the most common parameters of serial
.
To enable the new configuration, the serial
device must be closed and
reopened (ntd_device_close()
and ntd_device_open()
).
|
an NtdSerial device |
|
the new speed |
|
the new parity |
|
the new bits of data |
|
the new bits of stop |
void ntd_serial_set_exclusive (NtdSerial *serial
,gboolean exclusive
);
Sets the state of the exclusive flag of serial
to exclusive
.
An exclusive state means the device is opened with flock()
, that
is if enabled only the current process will be able to access
this resource.
|
an NtdSerial device |
|
whether this device will be accessed exclusively |
gboolean ntd_serial_get_exclusive (NtdSerial *serial
);
Gets the exclusive state of serial
.
|
an NtdSerial device |
Returns : |
the value of the exclusive flag. |
void ntd_serial_set_baud (NtdSerial *serial
,NtdBaud baud
);
Sets the baud-rate to be used on serial
.
To enable the new configuration, the serial
device must be closed and
reopened (ntd_device_close()
and ntd_device_open()
).
To configure all the serial parameters in one shot, consider using
ntd_serial_set()
.
|
an NtdSerial device |
|
the new speed |
NtdBaud ntd_serial_get_baud (NtdSerial *serial
);
Gets the serial speed of serial
.
|
an NtdSerial device |
Returns : |
the requested serial speed or NTD_BAUD_UNKNOWN if serial is not
an NtdSerial object. |
void ntd_serial_set_parity (NtdSerial *serial
,NtdParity parity
);
Sets the parity to be used on serial
.
To enable the new configuration, the serial
device must be closed and
reopened (ntd_device_close()
and ntd_device_open()
).
To configure all the serial parameters in one shot, consider using
ntd_serial_set()
.
|
an NtdSerial device |
|
the new parity |
NtdParity ntd_serial_get_parity (NtdSerial *serial
);
Gets the parity used on serial
.
|
an NtdSerial device |
Returns : |
the requested parity or NTD_PARITY_UNKNOWN
if serial is not an NtdSerial object. |
void ntd_serial_set_data_bits (NtdSerial *serial
,NtdDataBits data_bits
);
Sets the number of data bits to be used on serial
.
To enable the new configuration, the serial
device must be closed and
reopened (ntd_device_close()
and ntd_device_open()
).
To configure all the serial parameters in one shot, consider using
ntd_serial_set()
.
|
an NtdSerial device |
|
the new bits of data |
NtdDataBits ntd_serial_get_data_bits (NtdSerial *serial
);
Gets the number of bits used as data on serial
.
|
an NtdSerial device |
Returns : |
the requested data bits value or NTD_DATA_BITS_UNKNOWN
if serial is not an NtdSerial object. |
void ntd_serial_set_stop_bits (NtdSerial *serial
,NtdStopBits stop_bits
);
Sets the number of null bits to use as stop on serial
.
To enable the new configuration, the serial
device must be closed and
reopened (ntd_device_close()
and ntd_device_open()
).
To configure all the serial parameters in one shot, consider using
ntd_serial_set()
.
|
an NtdSerial device |
|
the new bits of stop |
NtdStopBits ntd_serial_get_stop_bits (NtdSerial *serial
);
Gets the number of bits used as stop on serial
.
|
an NtdSerial device |
Returns : |
the requested stop bits value or NTD_STOP_BITS_UNKNOWN
if serial is not an NtdSerial object. |
void ntd_serial_set_software_flow (NtdSerial *serial
,NtdSoftwareFlow software_flow
);
Sets the software flow control on serial
to software_flow
.
To configure all the serial parameters in one shot, consider using
ntd_serial_set()
.
|
an NtdSerial device |
|
the software flow control to use |
NtdSoftwareFlow ntd_serial_get_software_flow (NtdSerial *serial
);
Gets the software flow control used by serial
.
|
an NtdSerial device |
Returns : |
the current software flow control |
void ntd_serial_set_hardware_flow (NtdSerial *serial
,NtdHardwareFlow hardware_flow
);
Sets the hardware flow control on serial
to hardware_flow
.
To configure all the serial parameters in one shot, consider using
ntd_serial_set()
.
|
an NtdSerial device |
|
the hardware flow control to use |
NtdHardwareFlow ntd_serial_get_hardware_flow (NtdSerial *serial
);
Gets the hardware flow control used by serial
.
|
an NtdSerial device |
Returns : |
the current hardware flow control |
void ntd_serial_set_timeout (NtdSerial *serial
,gdouble timeout
);
Sets "timeout" on serial
to timeout
. To enable the new
value, the serial
device must be closed and reopened
(ntd_device_close()
and ntd_device_open()
).
To configure all the serial parameters in one shot, consider using
ntd_serial_set()
instead.
|
an NtdSerial device |
|
the new timeout time (in seconds) |
"baud"
property"baud" NtdBaud : Read / Write
Serial communication speed.
Default value: NTD_BAUD_9600
"data-bits"
property"data-bits" NtdDataBits : Read / Write
Data bits.
Default value: NTD_DATA_BITS_8
"exclusive"
property"exclusive" gboolean : Read / Write
Define whether this process must access the device exclusively.
Default value: FALSE
"hardware-flow"
property"hardware-flow" NtdHardwareFlow : Read / Write
Hardware flow control to use.
Default value: NTD_HARDWARE_FLOW_NONE
"parity"
property"parity" NtdParity : Read / Write
Serial communication parity.
Default value: NTD_PARITY_NONE
"software-flow"
property"software-flow" NtdSoftwareFlow : Read / Write
Software flow control to use.
Default value: NTD_SOFTWARE_FLOW_NONE
"stop-bits"
property"stop-bits" NtdStopBits : Read / Write
Stop bits.
Default value: NTD_STOP_BITS_1
"timeout"
property"timeout" gdouble : Read / Write
Maximum time (in seconds) waiting for a response before generating a timeout. 0 will wait forever.
Allowed values: >= 0
Default value: 2