LitDev Extension API

GW LD3DView LDArray LDBits LDBlueTooth
LDCall LDChart LDClient LDClipboard LDColours
LDCommPort LDController LDControls LDCursors LDDataBase
LDDateTime LDDebug LDDialogs LDDictionary LDEffect
LDEmail LDEncryption LDEvents LDFastArray LDFastShapes
LDFigures LDFile LDFinances LDFocus LDftp
LDGeography LDGraph LDGraphicsWindow LDHashTable LDHID
LDIcon LDImage LDInline LDIOWarrior LDList
LDLogic LDMath LDMathX LDMatrix LDMusic
LDNetwork LDPhysics LDProcess LDQueue LDRegex
LDResources LDScrollBars LDSearch LDServer LDSettings
LDShapes LDShell LDSort LDSound LDSpeech
LDStatistics LDStopwatch LDText LDTextWindow LDTimer
LDTranslate LDUnits LDUtilities LDVector LDWaveForm
LDWebCam LDWindows LDxml LDZip TW

LDCommPort
Sends and receives data over the serial port
Original Code by Nino Carrillo


AvailablePorts ClosePort DataReceived
ErrorReceived LastError LastPort
OpenPort RXAll RXByte
RXChar SetDataBits SetEncoding
SetHandshake SetParity SetStopBits
SwapPort TXByte TXString

AvailablePorts()
Returns a list of available serial ports.
returns An array containing the names of available serial ports.

ClosePort()
Closes the open serial port.
returns "SUCCESS", "NOCONNECTION" or "FAILED".

DataReceived
Event when the serial port receives data.

ErrorReceived
Event when the serial port receives an error.

LastError
The last error for which an error event was raised.

LastPort
The last port name for which an event was raised.

OpenPort(portName,baudRate)
Opens a serial port for use. Assumes 8 databits, no parity.
portName String identifying which port to open in the form of "COM8".
baudRate Integer baud rate, for example 9600.
returns Error message, "SUCCESS", "NOSERIALPORTS", "PORTNOTFOUND" or "CONNECTIONFAILED".

RXAll()
Reads all available bytes in the open comm port input buffer.
returns Returns a string of bytes ("NOCONNECTION" or "FAILED" on failure).

RXByte()
Reads one byte from the open serial port and returns that byte as an integer.
returns One integer value between 0 and 255 ("NOCONNECTION" or "FAILED" on failure).

RXChar()
Reads one byte from the open serial port and returns that byte as a unicode character.
returns One unicode character ("NOCONNECTION" or "FAILED" on failure).

SetDataBits(dataBits)
Sets current port data bits.
5 to 8 (default).

dataBits The data bits:
5 to 8 (default).

returns "SUCCESS", "NOCONNECTION" or "FAILED".

SetEncoding(encoding)
Sets current port encoding for send and receive text conversion.
encoding The encoding:
"Ascii" (default), "Unicode", "UTF7", "UTF8", "UTF32" or "BigEndianUnicode".

returns "SUCCESS", "NOCONNECTION" or "FAILED".

SetHandshake(handshake)
Sets or clears hardware flow control for the current port.
handshake "H" to select hardware flow control, "HX" for hardware and software flow control, "X" for software fow control, any other character to clear.
returns "SUCCESS", "NOCONNECTION" or "FAILED".

SetParity(parity)
Sets current port parity.
parity The parity:
"None" (default), "Even", "Mark", "Odd" or "Space".

returns "SUCCESS", "NOCONNECTION" or "FAILED".

SetStopBits(stopBits)
Current port stop bits.
stopBits The stop bits:
"One" (default), "None", "OnePointFive" or "Two".

returns "SUCCESS", "NOCONNECTION" or "FAILED".

SwapPort(portName)
Switch the current active port to a previously opened port.
portName String identifying a port that is already opened.
returns Error message, "SUCCESS" or "PORTNOTFOUND".

TXByte(dataByte)
Sends one byte to the serial port.
dataByte The byte to be written to the port.
returns "SUCCESS", "NOCONNECTION" or "FAILED".

TXString(dataString)
Sends a string to the serial port.
dataString String value to be sent.
returns "SUCCESS", "NOCONNECTION" or "FAILED".