SECOM
Overview Cluster Class Classes Index          Top Features

secom.windows

Class COM_DEVICE_CONTROL_BLOCK


Direct ancestors

EWG_STRUCT, COM_ABSTRACT_SETTINGS, COM_DCB_CONSTANTS, KL_SHARED_EXCEPTIONS, EWG_IMPORTED_EXTERNAL_ROUTINES, COM_SHARED_WINDOWS_ERROR

Creation

Features

Invariants

indexing

description

Control 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_DEVICE_CONTROL_BLOCK

inherit

EWG_STRUCT
COM_ABSTRACT_SETTINGS
COM_DCB_CONSTANTS
COM_ABSTRACT_CONTROL_CONSTANTS

create

make_default

-- Fill with default values.
-- Default is 9600 8N1 with flow control
-- disabled

ensure

structure_exists: exists
memory_not_shared: not is_shared

make_from_string (str: STRING)

-- Set defaults, then fill using a device control string.
-- Throws an exception if str is not understood by BuildCommDCB

require

exists: str /= Void

ensure

structure_exists: exists
memory_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
filled_from_device: dev.control_settings.is_equal (Current)

feature -- Access

baud_rate: INTEGER

-- Baud rate at which the communications device operates

data_bits: INTEGER

-- Number of bits in the bytes transmitted and received.

dtr_control: INTEGER

-- DTR (data-terminal-ready) flow control scheme to be used

ensure

valid_result: is_valid_dtr_control (Result)

eof_char: CHARACTER

-- Character used to signal the end of data.

error_char: CHARACTER

-- Character used to replace bytes received with a parity error.

event_char: CHARACTER

-- Character used to signal an event.

parity: INTEGER

-- Parity scheme used for transmit and receive.

rts_control: INTEGER

-- RTS (request-to-send) flow control scheme to be used

ensure

valid_result: is_valid_rts_control (Result)

stop_bits: INTEGER

-- Number of stop bits to be used.

xoff_char: CHARACTER

-- XOFF character for both transmission and reception.

xoff_lim: INTEGER_16

-- Maximum number of bytes allowed in the input buffer before flow
-- control is activated to allow transmission by the sender. The
-- maximum number of bytes allowed is calculated by subtracting this
-- value from the size, in bytes, of the input buffer.

xon_char: CHARACTER

-- XON character for both transmission and reception.

xon_lim: INTEGER_16

-- Minimum number of bytes allowed in the input buffer before flow
-- control is activated to inhibit the sender

feature -- Comparison

is_equal (other: like Current): BOOLEAN

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

feature -- Status report

are_errors_replaced: BOOLEAN

-- Replace errors with error_char?

are_nulls_discarded: BOOLEAN

-- Discard received null characters?

is_abort_on_error: BOOLEAN

-- Terminate all read and write operations when an error occurs?
-- The driver will not accept any further communications operations
-- until the comm error is cleared.

is_binary_mode: BOOLEAN

-- Binary mode enabled?. Windows does not support
-- nonbinary mode transfers, so this member must be TRUE.

ensure

only_binary: Result

is_cts_controlled: BOOLEAN

-- Monitor CTS (clear-to-send) for output flow control? When True
-- and remote CTS is off, output is suspended until CTS is received.

is_dsr_controlled: BOOLEAN

-- Monitor DSR (data-set-ready) for output flow control? When True
-- and remote DSR is off, output is suspended until DSR is received.

is_dsr_sensitive: BOOLEAN

-- Is the communications driver sensitive to the state of the DSR
-- signal? The driver ignores any bytes received, unless the DSR
-- modem input line is high.

is_inx_controlled: BOOLEAN

-- Is input software flow control used? When True the xoff_char
-- is sent when the input buffer comes within xoff_lim bytes of
-- capacity, and the xon_char is sent when the input buffer
-- comes within xon_lim bytes of capacity.

is_outx_controlled: BOOLEAN

-- Is output software flow control used? When True transmission
-- stops when the xoff_char is received and starts again when
-- the xon_char is received.

is_parity_checked: BOOLEAN

-- Check receive parity and report errors?

is_tx_continued_on_xoff: BOOLEAN

-- Continue transmit when xoff_char is sent? When True
-- transmission continues after the input buffer has come within
-- xoff_lim bytes of being full and the driver has transmitted
-- the xoff_char to stop receiving bytes. When False transmission
-- does not continue until the input buffer is within xon_lim
-- bytes of being empty and the driver has transmitted the
-- xon_char to resume reception.

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_data_bits (a_data_bits: INTEGER): BOOLEAN

-- Is a_data_bits a valid data bits setting?

is_valid_dtr_control (dtr: INTEGER): BOOLEAN

-- Is dtr a valid dtr control constant?

ensure

definition: Result implies ( dtr = Dtr_control_disable or dtr = Dtr_control_enable or dtr = Dtr_control_handshake)

is_valid_parity (a_parity: INTEGER): BOOLEAN

-- Is a_parity a valid parity setting?

is_valid_rts_control (rts: INTEGER): BOOLEAN

-- Is rts a valid rts control constant?

ensure

definition: Result implies ( rts = Rts_control_enable or rts = Rts_control_disable or rts = Rts_control_handshake or rts = Rts_control_toggle)

is_valid_stop_bits (a_stop_bit: INTEGER): BOOLEAN

-- Is a_stop_bit a valid stop bits setting?

feature -- Status setting

set_abort_on_error (a_value: BOOLEAN)

-- Set is_abort_on_error to a_value

ensure

abort_on_error_set: is_abort_on_error = a_value

set_cts_control (a_value: BOOLEAN)

-- Set is_cts_controlled to a_value

ensure

cts_control_set: is_cts_controlled = a_value

set_dsr_control (a_value: BOOLEAN)

-- Set is_dsr_controlled to a_value

ensure

dsr_control_set: is_dsr_controlled = a_value

set_dsr_sensitive (a_value: BOOLEAN)

-- Set is_dsr_sensitive to a_value

ensure

dsr_sensitivity_set: is_dsr_sensitive = a_value

set_error_replacement (a_value: BOOLEAN)

-- Set are_errors_replaced to a_value

ensure

replace_errors_set: are_errors_replaced = a_value

set_inx_control (a_value: BOOLEAN)

-- Set is_inx_controlled to a_value

ensure

inx_set: is_inx_controlled = a_value

set_null_discard (a_value: BOOLEAN)

-- Set are_nulls_discarded to a_value

ensure

discard_nulls_set: are_nulls_discarded = a_value

set_outx_control (a_value: BOOLEAN)

-- Set is_outx_controlled to a_value

ensure

outx_set: is_outx_controlled = a_value

set_parity_check (a_value: BOOLEAN)

-- Set is_parity_checked to a_value

set_tx_continue_on_xoff (a_value: BOOLEAN)

-- Set is_tx_continued_on_xoff to a_value

ensure

tx_continue_on_xoff_set: is_tx_continued_on_xoff = a_value

feature -- Element change

build_from_string (str: STRING)

-- Fill the DCB using str which conforms to the mode
-- command line parameter structure.
-- [baud=b] [parity=p] [data=d] [stop=s] [to={on|off}]
-- [xon={on|off}] [odsr={on|off}] [octs={on|off}]
-- [dtr={on|off|hs}] [rts={on|off|hs|tg}] [idsr={on|off}]
-- Obsolete format is still supported. Example, "9600,n,8,1"
-- Throws an exception if BuildCommDCB fails.

require

exists: str /= Void

get_comm_state (comm: COM_DEVICE)

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

set_baud_rate (a_baud_rate: INTEGER)

-- Set baud_rate with a_baud_rate

set_data_bits (a_byte_size: INTEGER)

-- Set byte_size to a_byte_size

set_defaults

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

ensure then

defaults_set: baud_rate = Baud_9600 and data_bits = Eight_data_bits and parity = No_parity and stop_bits = One_stop_bit and xon_char = '%/17/' and xoff_char = '%/19/' and error_char = '%/26/' and eof_char = '%/4/' and event_char = '%/7/'

set_dtr_control (a_dtr_control: INTEGER)

-- Set dtr_control to a_dtr_control

require

valid: is_valid_dtr_control (a_dtr_control)

ensure

dtr_control_set: dtr_control = a_dtr_control

set_eof_char (a_eof_char: CHARACTER)

-- Set eof_char to a_eof_char

ensure

eof_char_set: eof_char = a_eof_char

set_error_char (a_error_char: CHARACTER)

-- Set error_char to a_error_char

ensure

error_char_set: error_char = a_error_char

set_event_char (a_event_char: CHARACTER)

-- Set event_char to a_event_char

ensure

event_char_set: event_char = a_event_char

set_parity (a_parity: INTEGER)

-- Set parity to a_parity

set_rts_control (a_rts_control: INTEGER)

-- Set rts_control to a_rts_control

require

valid: is_valid_rts_control (a_rts_control)

ensure

rts_control_set: rts_control = a_rts_control

set_stop_bits (a_stop_bits: INTEGER)

-- Set stop_bits to a_stop_bits

set_xoff_char (a_xoff_char: CHARACTER)

-- Set xoff_char to a_xoff_char

require

not_same: a_xoff_char /= xon_char

ensure

xoff_char_set: xoff_char = a_xoff_char

set_xoff_lim (a_xoff_lim: INTEGER_16)

-- Set xoff_lim to a_xoff_lim

ensure

xoff_lim_set: xoff_lim = a_xoff_lim

set_xon_char (a_xon_char: CHARACTER)

-- Set xon_char to a_xon_char

require

not_same: a_xon_char /= xoff_char

ensure

xon_char_set: xon_char = a_xon_char

set_xon_lim (a_xon_lim: INTEGER_16)

-- Set xon_lim to a_xon_lim

ensure

xon_lim_set: xon_lim = a_xon_lim

feature -- Conversion

to_baud_rate (a_baud_rate: INTEGER): INTEGER

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

to_data_bits (a_data_bits: INTEGER): INTEGER

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

to_parity (a_parity_char: CHARACTER): INTEGER

-- Converts a_parity_char to a parity setting

to_stop_bits (a_stop_bits: INTEGER): INTEGER

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

invariant


Documentation generated by edoc