This site's content was compiled from 1993 to 2006. Beyond that, Google is your friend.
Brian Heilig
Secom is a library for portable serial port applications. It ecapsulates the serial port APIs of Posix and Windows into a common interface.
This example shows how you might create a device. The device will be set to 38400 baud, even parity, one stop bit, and 8 data bits. An overall timer is set to 2 seconds, and an inter-character timer is set to 100 milliseconds. These timeout properties would be useful to satisfy the following example requirements:
create_device (a_name: STRING): COM_ABSTRACT_DEVICE is local a_settings: COM_ABSTRACT_SETTINGS a_timeouts: COM_ABSTRACT_TIMEOUTS constants: COM_CONTROL_CONSTANTS do create {COM_DEVICE} Result.make (a_name) if Result.is_open then create constants a_settings := Result.control_settings a_settings.set_defaults a_settings.set_baud_rate (constants.Baud_38400) a_settings.set_parity (constants.Parity_even) Result.set_control_settings (a_settings) a_timeouts := Result.timeouts a_timeouts.set_overall_timer (2000) a_timeouts.set_inter_character_timer (100) Result.set_timeouts (a_settings) end end
Reading from and writing to an open device is then straightforward - see the interface of » COM_ABSTRACT_DEVICE for details