SECOM
Overview Cluster Class Classes Index          Top Features

secom.abstract

Class COM_ABSTRACT_DEVICE


Direct ancestors

EWG_IMPORTED_EXTERNAL_ROUTINES, STRING_HANDLER, KL_SHARED_PLATFORM

Known direct descendants

COM_DEVICE

Features

Invariants

indexing

description

Objects that perform I/O operations on a communications device.

library

Serial Communications Library

copyright

Copyright (c) 2005, Brian E. Heilig

license

Eiffel Forum License v2 (see license.txt)

deferred class COM_ABSTRACT_DEVICE

feature -- Access

control_settings: COM_ABSTRACT_SETTINGS

-- Current control parameters for this device

require

handle_available: is_open
deferred

ensure

exists: Result /= Void

last_boolean: BOOLEAN

-- Last Boolean read by the device

last_character: CHARACTER

-- Last character read by the device.

last_double: DOUBLE

-- Last double read by the device

last_integer: INTEGER

-- Last integer read by the device

last_read_count: INTEGER

-- Number of bytes actually read during last read operation.

last_real: REAL

-- Last real read by the device

last_string: STRING

-- Last string read by the device.

last_write_count: INTEGER

-- Number of bytes actually written during last write operation.

name: STRING

-- Name of the communications device

timeouts: COM_ABSTRACT_TIMEOUTS

-- Current timeout properties for this device

require

handle_available: is_open
deferred

ensure

exists: Result /= Void

feature -- Status report

is_open: BOOLEAN

-- Is the device open for reading and writing?

deferred

timed_out: BOOLEAN

-- Did the last read/write operation timeout?

feature -- Status setting

close

-- Close the device.

deferred

ensure

closed: not is_open
reset: last_read_count = 0 and last_write_count = 0

open

-- Open the device. If open was successful set is_open.

require

closed: not is_open
deferred

feature -- Element change

set_control_settings (a_settings: like control_settings)

-- Configures the device according to the specifications in a_settings.
-- Settings will be immediately applied; input and output queues will
-- not be emptied.

require

exists: a_settings /= Void
handle_available: is_open
deferred

ensure

is_set: control_settings.is_equal (a_settings)

set_timeouts (a_timeouts: like timeouts)

-- Configures the timeout properties according to a_timeouts

require

exists: a_timeouts /= Void
handle_available: is_open
deferred

ensure

timeouts_set: timeouts.is_equal (a_timeouts)

feature -- Input

read_boolean

-- Read a new Boolean. Make result available in last_boolean

require

open: is_open

ensure

count: last_read_count = Platform.Boolean_bytes xor timed_out

read_character

-- Read a new character. Make result available in last_character.

require

open: is_open

ensure

count: last_read_count = Platform.Character_bytes xor timed_out

read_data (data: POINTER; count: INTEGER)

-- Read count bytes into the data buffer. Set last_read_count
-- to the number of bytes read. Set timed_out if less than count
-- bytes were read. See timeouts to determine when read will
-- be completed.

require

open: is_open
valid_count: count > 0
deferred

ensure

time_out: timed_out = (last_read_count < count)
no_more: last_read_count <= count

read_double

-- Read a new double. Make result available in last_double.

require

open: is_open

ensure

count: last_read_count = Platform.Double_bytes xor timed_out

read_integer

-- Read a new integer. Make result available in last_integer.

require

open: is_open

ensure

count: last_read_count = Platform.Integer_bytes xor timed_out

read_line

-- Read characters until a new line is received or a time
-- out occurs. Make result available in last_string.

require

open: is_open

ensure

new_line_terminated_or_timeout: last_string.index_of ('%N', 1) = last_string.count xor timed_out

read_real

-- Read a new real. Make result available in last_real.

require

open: is_open

ensure

count: last_read_count = Platform.Real_bytes xor timed_out

read_stream (count: INTEGER)

-- Read a string of count characters.
-- Make result available in last_string.

require

open: is_open
valid_count: count > 0

ensure

count: last_read_count = count xor timed_out

read_string

-- Read characters until a Nul character is received or
-- a time out occurs. Make result available in
-- last_string. Do not include the Nul character.

require

open: is_open

ensure

count: last_string.count = last_read_count - 1 xor timed_out
no_null: not last_string.has ('%U')

feature -- Output

put_boolean (b: BOOLEAN)

-- Write b to the device.

require

open: is_open

ensure

count: last_write_count = Platform.Boolean_bytes xor timed_out

put_character (c: CHARACTER)

-- Write c to medium.

require

open: is_open

ensure

count: last_write_count = Platform.Character_bytes xor timed_out

put_data (data: POINTER; count: INTEGER)

-- Write data to the device. Set last_write_count with the
-- number of bytes written. Set timed_out if the write operation
-- timed out.

require

open: is_open
valid_count: count > 0
deferred

ensure

time_out: timed_out = (last_write_count < count)
no_more: last_write_count <= count

put_double (d: DOUBLE)

-- Write d to the device.

require

open: is_open

ensure

count: last_write_count = Platform.Double_bytes xor timed_out

put_integer (i: INTEGER)

-- Write i to the device.

require

open: is_open

ensure

count: last_write_count = Platform.Integer_bytes xor timed_out

put_new_line

-- Write a new line character to medium

require

open: is_open

ensure

count: last_write_count = Platform.Character_bytes xor timed_out

put_real (r: REAL)

-- Write r to the device.

require

open: is_open

ensure

count: last_write_count = Platform.Real_bytes xor timed_out

put_stream (s: STRING; count: INTEGER)

-- Write count bytes of s to medium.

require

open: is_open
safe: count <= s.capacity

ensure

count: last_write_count = count xor timed_out

put_string (s: STRING)

-- Write a null terminated string s to medium. All count
-- characters of s will be written, followed by a null.

require

open: is_open

ensure

count: last_write_count = s.count + Platform.Character_bytes xor timed_out

invariant

last_write_count_not_negative: last_write_count >= 0
last_read_count_not_negative: last_read_count >= 0
last_string_exists: last_string /= Void

Documentation generated by edoc