Difference between revisions of "Serialport"
Barrymavin (Talk | contribs) (→Methods) |
Barrymavin (Talk | contribs) (→Properties) |
||
Line 78: | Line 78: | ||
|valign="top"|R | |valign="top"|R | ||
|valign="top"|Numeric | |valign="top"|Numeric | ||
− | |valign="top"|The pinoutsignals. | + | |valign="top"|The pinoutsignals.<br> |
+ | 0x00 No line active.<br> | ||
+ | 0x01 TxD (Transmitted Data). This value is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.<br> | ||
+ | 0x02 RxD (Received Data). This value is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.<br> | ||
+ | 0x04 DTR (Data Terminal Ready).<br> | ||
+ | 0x08 DCD (Data Carrier Detect).<br> | ||
+ | 0x10 DSR (Data Set Ready).<br> | ||
+ | 0x20 RNG (Ring Indicator).<br> | ||
+ | 0x40 RTS (Request To Send). | ||
+ | 0x80 CTS (Clear To Send).<br> | ||
+ | 0x100 STD (Secondary Transmitted Data).<br> | ||
+ | 0x200 SRD (Secondary Received Data).<br> | ||
+ | |||
+ | |- | ||
+ | |valign="top"|error | ||
+ | |valign="top"|R | ||
+ | |valign="top"|Numeric | ||
+ | |valign="top"|The last error.<br> | ||
+ | |||
+ | 0 No error occurred.<br> | ||
+ | 1 An error occurred while attempting to open an non-existing device.<br> | ||
+ | 2 An error occurred while attempting to open an already opened device by another process or a user not having enough permission and credentials to open.<br> | ||
+ | 3 An error occurred while attempting to open an already opened device in this object.<br> | ||
+ | 13 This error occurs when an operation is executed that can only be successfully performed if the device is open. <br> | ||
+ | 4 Parity error detected by the hardware while reading data.<br> | ||
+ | 5 Framing error detected by the hardware while reading data.<br> | ||
+ | 6 Break condition detected by the hardware on the input line.<br> | ||
+ | 7 An I/O error occurred while writing the data.<br> | ||
+ | 8 An I/O error occurred while reading the data.<br> | ||
+ | 9 An I/O error occurred when a resource becomes unavailable, e.g. when the device is unexpectedly removed from the system.<br> | ||
+ | 10 The requested device operation is not supported or prohibited by the running operating system.<br> | ||
+ | 12 A timeout error occurred. <br> | ||
+ | 11 An unidentified error occurred.<br> | ||
|- | |- |
Revision as of 22:29, 13 May 2024
Under development
Note: property, method and event names should be referred to in lowercase in case-sensitive scripting languages.
Available in Lianja 9.7.
Properties
This class supports the following properties:
Property | Access (R/RW) | Value | Description |
---|---|---|---|
baudrate | RW | Numeric | The baudrate |
breakenabled | RW | Logical | The breakenabled state. |
databits | RW | Numeric | The number of databits. Valid values; 5, 6, 7 or 8 |
stopbits | RW | Numeric | The number of stopbits. Valid values; 1, 2 or 3 (1.5 on windows) |
parity | RW | Numeric | The parity bits.
0 No parity bit it sent. This is the most common parity setting. Error detection is handled by the communication protocol. |
flowcontrol | RW | Numeric | The flowcontrol. 0 No flow control. |
portname | RW | character | The portname e.g com3 |
dataterminalready | RW | Logical | The DTR state. |
requesttosend | RW | Logical | The RTS state |
pinoutsignals | R | Numeric | The pinoutsignals. 0x00 No line active. |
error | R | Numeric | The last error. 0 No error occurred. |
Methods
This class supports the following methods:
Method | Args | Description |
---|---|---|
availablePorts | extended as logical (optional) | Returns a comma separated list of ports available |
readData | length as numeric. (optional) | Reads data. Returns as a character string. |
writeData | Character | Writes the specified character string |
flush | None | Writes as much as possible from the internal write buffer to the underlying serial port without blocking. If any data was written, this function returns true; otherwise returns false. |
writeData | Character | Writes the specified character string |
open | None | Open the serial port specified in portname. NOTE: set all port settings AFTER opening the port. |
close | None | Closes the serial port |
clear | None | Discards all characters from the output or input buffe. This includes clearing the internal class buffers and the UART (driver) buffers. Also terminate pending read or write operations. If successful, returns true; otherwise returns false. |
clearError | None | Clears the internal error indicator. |
Events
This class supports the the following events:
Event | Args | Description |
---|---|---|
readyRead | bytesavailable as numeric | Occurs when data is available to read |
writeComplete | Byteswritten as numeric | Occurs write has completed |