Dokumentaro de Gambaso
Compilation & Installation
Components
gb
gb.crypt
gb.qt4
Documents
Indekso de Lingvo
Language Overviews
LeguMin
Lexicon
Registro

SerialPort.Open (gb.net)

Sub Open ( [ Polling As Integer ] )

Opens the serial port.

The Status property will turn to value Net.Active.

Polling is used to detect changes in the signal values of CTS, DCD, DSR, DTR, RNG, and RTS. If you do not handle any of their respective change events, polling is not used.

The optional Polling parameter is the polling interval in milliseconds. The default is 50 ms.

The Read event does not rely on polling.

If any other application has the serial port open but has not placed an exclusive-mode lock on it, Gambas will open it without raising an error.

However, if the other application implements reading from the port asynchronously (ie. whenever the port signals that data is available for reading), then any attempt to read from the port by your application will quite likely result in unreliable data or an exception.

You can check if the port is already open by shelling out to the lsof command. For example: Shell "lsof /dev/ttyUSB0" to sLsofOutput"

If, after executing the example statement, sLsofOutput is null, the port (ie. the special character device file) is not open.