Object Hierarchy

  GObject
   +----NtdDevice
         +----NtdSerial

Properties

  "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

Description

Details

struct NtdSerial

struct NtdSerial;

All fields are private and should not be used directly. Use its public methods instead.


struct NtdSerialClass

struct NtdSerialClass {
};

ntd_serial_get_baud ()

NtdBaud             ntd_serial_get_baud                 (NtdSerial *serial);

Gets the serial speed of serial.

serial :

an NtdSerial device

Returns :

the requested serial speed or NTD_BAUD_UNKNOWN if serial is not an NtdSerial object.

ntd_serial_get_data_bits ()

NtdDataBits         ntd_serial_get_data_bits            (NtdSerial *serial);

Gets the number of bits used as data on serial.

serial :

an NtdSerial device

Returns :

the requested data bits value or NTD_DATA_BITS_UNKNOWN if serial is not an NtdSerial object.

ntd_serial_get_exclusive ()

gboolean            ntd_serial_get_exclusive            (NtdSerial *serial);

Gets the exclusive state of serial.

serial :

an NtdSerial device

Returns :

the value of the exclusive flag.

ntd_serial_get_hardware_flow ()

NtdHardwareFlow     ntd_serial_get_hardware_flow        (NtdSerial *serial);

Gets the hardware flow control used by serial.

serial :

an NtdSerial device

Returns :

the current hardware flow control

ntd_serial_get_parity ()

NtdParity           ntd_serial_get_parity               (NtdSerial *serial);

Gets the parity used on serial.

serial :

an NtdSerial device

Returns :

the requested parity or NTD_PARITY_UNKNOWN if serial is not an NtdSerial object.

ntd_serial_get_software_flow ()

NtdSoftwareFlow     ntd_serial_get_software_flow        (NtdSerial *serial);

Gets the software flow control used by serial.

serial :

an NtdSerial device

Returns :

the current software flow control

ntd_serial_get_stop_bits ()

NtdStopBits         ntd_serial_get_stop_bits            (NtdSerial *serial);

Gets the number of bits used as stop on serial.

serial :

an NtdSerial device

Returns :

the requested stop bits value or NTD_STOP_BITS_UNKNOWN if serial is not an NtdSerial object.

ntd_serial_get_timeout ()

gdouble             ntd_serial_get_timeout              (NtdSerial *serial);

Gets the time (in seconds) to wait before generating a timeout error on serial. A 0 value means no timeout value set, that is wait forever.

serial :

an NtdSerial instance

Returns :

the current timeout value.

ntd_serial_new ()

NtdSerial *         ntd_serial_new                      (const gchar *file);

Creates a new NtdSerial instance.

file :

device file, such as "/dev/ttyS0" on GNU/Linux

Returns :

the newly created object.

ntd_serial_set ()

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()).

serial :

an NtdSerial device

baud :

the new speed

parity :

the new parity

data_bits :

the new bits of data

stop_bits :

the new bits of stop

ntd_serial_set_baud ()

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().

serial :

an NtdSerial device

baud :

the new speed

ntd_serial_set_data_bits ()

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().

serial :

an NtdSerial device

data_bits :

the new bits of data

ntd_serial_set_exclusive ()

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.

serial :

an NtdSerial device

exclusive :

whether this device will be accessed exclusively

ntd_serial_set_hardware_flow ()

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().

serial :

an NtdSerial device

hardware_flow :

the hardware flow control to use

ntd_serial_set_parity ()

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().

serial :

an NtdSerial device

parity :

the new parity

ntd_serial_set_software_flow ()

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().

serial :

an NtdSerial device

software_flow :

the software flow control to use

ntd_serial_set_stop_bits ()

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().

serial :

an NtdSerial device

stop_bits :

the new bits of stop

ntd_serial_set_timeout ()

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.

serial :

an NtdSerial device

timeout :

the new timeout time (in seconds)

Property Details

The "baud" property

  "baud"                     NtdBaud               : Read / Write

Serial communication speed.

Default value: NTD_BAUD_9600


The "data-bits" property

  "data-bits"                NtdDataBits           : Read / Write

Data bits.

Default value: NTD_DATA_BITS_8


The "exclusive" property

  "exclusive"                gboolean              : Read / Write

Define whether this process must access the device exclusively.

Default value: FALSE


The "hardware-flow" property

  "hardware-flow"            NtdHardwareFlow       : Read / Write

Hardware flow control to use.

Default value: NTD_HARDWARE_FLOW_NONE


The "parity" property

  "parity"                   NtdParity             : Read / Write

Serial communication parity.

Default value: NTD_PARITY_NONE


The "software-flow" property

  "software-flow"            NtdSoftwareFlow       : Read / Write

Software flow control to use.

Default value: NTD_SOFTWARE_FLOW_NONE


The "stop-bits" property

  "stop-bits"                NtdStopBits           : Read / Write

Stop bits.

Default value: NTD_STOP_BITS_1


The "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