GEOS SDK TechDocs
|
|
2.1 Initializing a Serial Port
|
2.3 Closing a Serial Port
SerialRead(), SerialReadByte(), SerialWrite(), SerialWriteByte(), SerialQuery(), SerialFlush(), SerialGetError(), SerialSetError(), SerialError
Communicating with a serial port is very much like using any other stream. Special versions of the stream routines are provided, but they function just like their stream counterparts.
To read data from a serial port, call
SerialRead()
or
SerialReadByte()
. These routines take the same arguments as their
Stream...()
counterparts, except that each one must be passed the handle of the Serial Driver, not the Stream Driver, and each routine is passed the
SerialUnit
for the appropriate port, instead of being passed a stream token. These routines behave exactly like their
Stream...()
counterparts.
To write data to a serial port, call
SerialWrite()
or
SerialWriteByte()
. Again, these routines behave like their
Stream...()
counterparts, and take similar arguments.
To find out if you can read or write data to the port, call
SerialQuery()
. Again, this routine behaves like its
Stream...()
equivalent. To flush any data from the input or output stream, call
SerialFlush()
.
To send an error to the other side of a serial connection, call
SerialSetError()
. This routine behaves much like
StreamSetError()
. The only difference is that the error code passed must be a member of the
SerialError
enumerated type. This type has the following members:
To read an error condition passed by the other side of a serial connection, call
SerialGetError()
. This routine behaves just like
StreamGetError()
. The error code returned will be a member of the
SerialError
enumerated type.
GEOS SDK TechDocs
|
|
2.1 Initializing a Serial Port
|
2.3 Closing a Serial Port