Gambas Documentation
Application Repository
Code Snippets
Compilation & Installation
Components
gb
gb.args
gb.cairo
gb.chart
gb.clipper
gb.complex
gb.compress
gb.crypt
gb.data
gb.db
gb.db.form
gb.db.mysql
gb.db.odbc
gb.db.postgresql
gb.db.sqlite2
gb.db.sqlite3
gb.dbus
gb.dbus.trayicon
gb.debug
gb.desktop
gb.desktop.gnome.keyring
gb.desktop.x11
gb.eval
gb.eval.highlight
gb.form
gb.form.dialog
gb.form.editor
gb.form.htmlview
gb.form.mdi
gb.form.print
gb.form.stock
gb.form.terminal
gb.gmp
gb.gsl
gb.gtk
gb.gtk.opengl
gb.gtk3
gb.gtk3.opengl
gb.gtk3.webview
gb.gui
gb.gui.opengl
gb.gui.qt
gb.gui.qt.opengl
gb.gui.qt.webkit
gb.gui.trayicon
gb.gui.webview
gb.hash
gb.highlight
gb.image
gb.image.effect
gb.image.imlib
gb.image.io
gb.inotify
gb.jit
gb.libxml
gb.logging
gb.map
gb.markdown
gb.media
gb.media.form
gb.memcached
gb.mime
gb.mysql
gb.ncurses
gb.net
.UdpSocket.Multicast
DnsClient
Net
SerialPort
_new
Bits1
Bits2
Bits5
Bits6
Bits7
Bits8
Both
Clear
CTS
CTSChange
DataBits
DCD
DCDChange
DSR
DSRChange
DTR
DTRChange
Even
FlowControl
Hardware
InputBufferSize
None
Odd
Open
OutputBufferSize
Parity
PortName
Read
RNG
RNGChange
RTS
RTSChange
Software
Speed
Status
StopBits
ServerSocket
Socket
UdpSocket
gb.net.curl
gb.net.pop3
gb.net.smtp
gb.openal
gb.opengl
gb.opengl.glsl
gb.opengl.glu
gb.opengl.sge
gb.openssl
gb.option
gb.pcre
gb.pdf
gb.poppler
gb.qt4
gb.qt4.ext
gb.qt4.opengl
gb.qt4.webkit
gb.qt4.webview
gb.qt5
gb.qt5.ext
gb.qt5.opengl
gb.qt5.webkit
gb.qt5.webview
gb.report
gb.report2
gb.scanner
gb.sdl
gb.sdl.sound
gb.sdl2
gb.sdl2.audio
gb.settings
gb.signal
gb.term
gb.test
gb.util
gb.util.web
gb.v4l
gb.vb
gb.web
gb.web.feed
gb.web.form
gb.web.gui
gb.xml
gb.xml.html
gb.xml.rpc
gb.xml.xslt
Controls pictures
Deprecated components
Developer Documentation
Development Environment Documentation
Documents
Error Messages
Gambas Playground
How To's
Language Index
Language Overviews
Last Changes
Lexicon
README
Search the wiki
To Do
Topics
Tutorials
Wiki License
Wiki Manual

SerialPort (gb.net)

This class was designed to allow to communicate using a serial interface (usually RS-232 serial port). This class inherits from Stream class, so you can use standard streams methods to send and receive data, and to close the port.

This class inherits Stream in gb.

This class is creatable.

Constants
Bits1   Constant used when the serial port has one stop bit.
Bits2   Constant used when the serial port has two stop bits.
Bits5   Constant used when the serial port has 5 data bits.
Bits6   Constant used when the serial port has 6 data bits.
Bits7   Constant used when the serial port has 7 data bits.
Bits8   Constant used when the serial port has 8 data bits.
Both   Constant used when the serial port has both software and hardware flow control.
Even   This constant represents an even parity for the serial port.
Hardware   Constant used when the serial port has hardware flow control.
None   This constant is used in the following cases:
Odd   This constant represents an odd parity for the serial port.
Software   Constant used when the serial port has software flow control.

Properties
CTS   Returns current status of the "Clear To Send" serial port signal, or FALSE if port is closed.
DCD   Returns current status of the "Data Carrier Detect" serial port signal, or FALSE if port is closed.
DSR   Returns current status of the "Data Set Ready" serial port signal, or FALSE if port is closed.
DTR   Returns or Sets current status of the "Data Terminal Ready" serial port signal. This value cannot be set when serial port is closed. If serial port is closed and you read this property, it returns FALSE.
DataBits   Return or set the number of data bits used by the serial port.
FlowControl   Return or set the serial port flow control.
InputBufferSize   Return the number of bytes of the internal input buffer.
OutputBufferSize   Return the number of bytes of the internal output buffer.
Parity   Returns or sets the serial port parity.
PortName   Returns or sets current serial port device path. This property can be changed only when serial port is closed.
RNG   Returns current status of the "Ring Indicator" serial port signal, or FALSE if port is closed.
RTS   Returns or Sets current status of the "Request To Send" serial port signal. This value cannot be set when serial port is closed. If serial port is closed and you read this property, it returns FALSE.
Speed   Place here communication speed in bauds, speed value must be a valid standard value allowed by the serial port driver (19200, 9600...). Be careful, as some common speed values like 38400 bauds are allowed by modems, but not by all serial port chips.
Status   Reflects the current status of a SerialPort object. It can be:
StopBits   Return or set the serial port stop bits.

Inherited properties
Blocking   Returns or sets if the stream is blocking.
ByteOrder   Returns or sets the byte order used to read or write binary data to the stream.
EndOfFile   This property signals whether the last use of LINE INPUT reached the end of file, instead of reading a full line with an end-of-line character.
EndOfLine   Return or set the newline separator used by this stream.
Eof   Return if a stream reached its end.
Handle   Returns the system file descriptor associated with this Stream.
IsTerm   Return if a stream is associated with a terminal.
Lines   Returns a virtual object that allows you to enumerate a stream line by line.
NoShare  
NullTerminatedString   Return or set if strings are null-terminated when they are serialized.
Tag   Returns or sets the tag associated with the stream.
Term   Return a virtual object that allows to manage the terminal associated with the stream.

Methods
Clear   Clear the input/output buffers.
Open   Opens the serial port.

Inherited methods
Begin   Start to buffer data written to the stream, so that everything will be sent when the Send method is called.
Close   Closes the stream.
Drop   Drop the data that has been buffered since the last call to the Begin method.
ReadLine   Read a line of text from the stream, like the LINE INPUT instruction.
Send   Send all the data, in one shot, since the last call to Begin.
Watch   Start or stop watching the stream file descriptor for reading or writing, after it has been opened.

Events
CTSChange   Raised when CTS signal value changes.
DCDChange   Raised when DCD signal value changes.
DSRChange   Raised when DSR signal value changes.
DTRChange   Raised when DTR signal value changes.
RNGChange   Raised when RNG signal value changes.
RTSChange   Raised when RTS signal value changes.
Read   Raised when there is data to be read from the serial port.