SECOM
Overview Cluster Class Classes Index          Top Features

secom.posix

Class COM_TERMIOS


Direct ancestors

EWG_STRUCT, KL_SHARED_EXCEPTIONS, COM_ABSTRACT_SETTINGS, COM_ABSTRACT_TIMEOUTS, COM_TERMIOS_CONSTANTS

Creation

Features

Invariants

indexing

description

Terminal I/O settings for a serial communications device.

library

Serial Communications Library

copyright

Copyright (c) 2005, Brian E. Heilig

license

Eiffel Forum License v2 (see license.txt)

class COM_TERMIOS

inherit

EWG_STRUCT
COM_ABSTRACT_SETTINGS
COM_ABSTRACT_TIMEOUTS

create

make_default

-- Create an un-initialized termios structure

ensure

structure_exists: exists
not_shared: not is_shared

make_existing (dev: COM_DEVICE)

-- Fill the structure with the control settings of an extant, open
-- communications resource. Throws an exception if failed.

require

exists: dev /= Void
handle_available: dev.is_open

ensure

structure_exists: exists
memory_not_shared: not is_shared

feature -- Access

baud_rate: INTEGER

-- Device baud rate setting.

control_character (index: INTEGER): CHARACTER

-- The control character associated with index

require

valid_index: is_valid_cc_index (index)

control_modes: INTEGER

-- Describes the hardware control of the terminal

data_bits: INTEGER

-- Number of bits per data word

input_modes: INTEGER

-- Describes the basic terminal input modes

inter_character_timer: INTEGER

-- Inter-character read timer, in milliseconds.

local_modes: INTEGER

-- Controls various terminal functions

output_modes: INTEGER

-- Describes the basic terminal output modes

overall_timer: INTEGER

-- Total read timer, in milliseconds.

parity: INTEGER

-- Parity scheme in use for received and transmitted data

stop_bits: INTEGER

-- Number of stop bits per data word

feature -- Comparison

is_equal (other: like Current): BOOLEAN

-- Is other attached to an object considered equal
-- to current object?

feature -- Status report

is_blocking: BOOLEAN

-- Indicates read operations block until the requested
-- number of bytes have been read.

is_canonical: BOOLEAN

-- Is canonical input mode processing enabled?
-- In canonical mode input processing, terminal input
-- is processed in units of lines.

is_non_blocking: BOOLEAN

-- Indicates read operations return immediately with the number of
-- bytes already received, even if no bytes have been received

is_parity_checked: BOOLEAN

-- Check input data for parity errors?

is_valid_baud (a_baud: INTEGER): BOOLEAN

-- Is a_baud a valid baud rate? True only indicates the
-- operating system supports this rate. The device may not.

is_valid_cc_index (index: INTEGER): BOOLEAN

-- Is index a valid index for the control code array?

is_valid_data_bits (a_data_bits: INTEGER): BOOLEAN

-- Is a_data_bits a valid data bits setting?

is_valid_parity (a_parity: INTEGER): BOOLEAN

-- Is a_parity a valid parity setting?

is_valid_stop_bits (a_stop_bit: INTEGER): BOOLEAN

-- Is a_stop_bit a valid stop bits setting?

feature -- Status setting

set_parity_check (a_value: BOOLEAN)

-- Set is_parity_checked to a_value

feature -- Conversion

to_baud_rate (a_baud_rate: INTEGER): INTEGER

-- Converts a_baud_rate in symbols per second
-- to a baud rate setting

ensure then

valid_result: is_valid_baud (Result) xor Result = Invalid_baud_rate

to_data_bits (a_data_bits: INTEGER): INTEGER

-- Converts a_data_bits in number of data bits to a data bits setting

ensure then

valid_result: is_valid_data_bits (Result) xor Result = -1

to_parity (a_parity_char: CHARACTER): INTEGER

-- Converts a_parity_char to a parity setting

ensure then

valid_result: is_valid_parity (Result) xor Result = -1

to_stop_bits (a_stop_bits: INTEGER): INTEGER

-- Converts a_stop_bits in number of stop bits to a stop bits setting

ensure then

valid_result: is_valid_stop_bits (Result) xor Result = -1

feature -- Element Change

fill_from_device (dev: COM_DEVICE)

-- Fill the structure with the current state of dev.
-- Throws an exception if failed.

set_baud_rate (a_baud_rate: INTEGER)

-- Set baud_rate with a_baud_rate

set_blocking

-- Set the timeout properties to be a pure blocking read.

ensure then

not_canonical: not is_canonical

set_control_character (index: INTEGER; c: CHARACTER)

-- Set control character at index to c

set_control_modes (a_modes: INTEGER)

-- Set control_modes to a_modes

ensure

modes_set: control_modes = a_modes

set_data_bits (a_data_bits: INTEGER)

-- Set data_bits to a_data_bits

set_defaults

-- Change all settings to default values.
-- Default is 9600 8N1 with flow control
-- disabled. Do not disrupt timeouts

ensure then

defaults_set: baud_rate = Baud_9600 and data_bits = Eight_data_bits and parity = No_parity and stop_bits = One_stop_bit
modes_cleared: input_modes = 0 and output_modes = 0 and local_modes = 0

set_input_modes (a_modes: INTEGER)

-- Set input_modes to a_modes

ensure

modes_set: input_modes = a_modes

set_inter_character_timer (time: INTEGER)

-- Set the timeout properties to be an inter-character timed read.
-- The timer is truncated to tenths of a second.
-- Set the timer to 0 to indicate the timer is not used.
-- Setting both timers to 0 defaults to blocking mode.

set_local_modes (a_modes: INTEGER)

-- Set local_modes to a_modes

ensure

modes_set: local_modes = a_modes

set_non_blocking

-- Set the timeout properties to be a non-blocking read.

ensure then

not_canonical: not is_canonical

set_output_modes (a_modes: INTEGER)

-- Set output_modes to a_modes

ensure

modes_set: output_modes = a_modes

set_overall_timer (time: INTEGER)

-- Set the timeout properties to be an overall timed read.
-- Set the timer to 0 to indicate the timer is not used.
-- Setting both timers to 0 defaults to blocking mode.

set_parity (a_parity: INTEGER)

-- Set parity to a_parity

set_stop_bits (a_stop_bits: INTEGER)

-- Set stop_bits to a_stop_bits

invariant

same_speed: cposix_getospeed(item) = cposix_getispeed(item)

Documentation generated by edoc