|
- Miscellaneous
- Opening and initializing an infrared port by specifying its name (syntax 2)
- Using an external library: RXTX
sOpen (Function) In french: sOuvre
// Open IR1 (using the port name) IR1 = sOpen("IR1", 2000, 2000) IF IR1 <> 0 THEN // Configure IR1 sParameter(IR1, 9600, 1, 8, 1) // Rest of process... // Close IR1 sClose(IR1) ELSE Error("Error while opening IR1") END
Syntax
Opening and initializing a port by specifying its name Hide the details
<Result> = sOpen(<Port name> , <Size of input buffer> , <Size of output buffer> [, <Timeout>])
<Result>: Integer This identifier corresponds to:- the number of the relevant serial port: 1, 2, 3, ... 256 for COM1, COM2, COM3, ... COM256.
- the number of the relevant parallel port: -1, -2, -3 or -4 for LPT1, LPT2, LPT3 or LPT4.
- the number of the relevant infrared port: 1, 2, 3, ... 256 for IR1, IR2, IR3, ... IR256.
Versions 16 and later The management of infrared ports is not available in Java. New in version 16 The management of infrared ports is not available in Java. The management of infrared ports is not available in Java.
Versions 25 and later New in version 25 <Port name>: Character string with quotes Name of relevant port: - Name of serial port: COM1, COM2, COM3, ... COM256.
Name of serial port in Java: /dev/ttyS4, /dev/ttyS5, ... /dev/ttyS9.
Serial port number in Linux (for example /dev/ttyS1). - Name of parallel port: LPT1, LPT2, LPT3 or LPT4.
Versions 25 and later Parallel port management is not available. New in version 25 Parallel port management is not available. Parallel port management is not available. - Name of infrared port: IR1, IR2, ... IR256.
Versions 16 and later Infrared ports are not managed. New in version 16 Infrared ports are not managed.  Infrared ports are not managed.
<Size of input buffer>: Integer Size of input buffer in bytes (up to 32768). <Size of output buffer>: Integer Size of output buffer in bytes (up to 32768). <Timeout>: Optional integer Duration (expressed in milliseconds) allocated for reading or writing a character. This parameter is used to avoid a lock when a read or write problem occurs on the print port. - When <Timeout> has expired, the read or write function returns 0.
- The default value of this parameter is defined at system level.
The sDefaultTimeout constant allows you to use the default timeout. This parameter can correspond to: - an integer corresponding to the number of milliseconds,
- a Duration variable,
Versions 23 and laterthe direct indication of duration (1 s or 10 ms for example). New in version 23the direct indication of duration (1 s or 10 ms for example). the direct indication of duration (1 s or 10 ms for example).
Versions 16 and later New in version 16 Remarks Miscellaneous - A port cannot be opened if this port was not closed properly.
- Important: A port must be opened by sOpen before it can be configured by sParameter.
- WLanguage does not allow you to manage the control signals.
- Two computers send each other characters via a port: if the second computer calls sOpen once the characters have been sent by the first computer, these characters are ignored.
Versions 16 and later New in version 16 Business / GUI classification : Business Logic
This page is also available for…
|
|
|
| |
| Click [Add] to post a comment |
|
| |
|
| |
| |
| |
| |
| |
| |
| | |
| |