Serial |
The SerialPort type exposes the following members.
Name | Description | |
---|---|---|
AutoReceive | Set this property to true, if you want to receive the incoming data automatically in the Received event. Otherwise you have to use ReadBuffer method to get the received data. The default value is true. | |
AutoReconnect | Set this property to true, if you want to automatically reconnect to the serial port after a Faulted event, when the port is available again. Set AutoReconnect to true, before the port is faulted, otherwise it will have no effect. The default value is false. | |
AutoReconnectCheckInterval | The time interval in milliseconds the serial port is trying to periodically reconnect, after a Faulted event occur, if AutoReconnect is set to true. It must be a positive value. The default value is 4000. | |
BaudRate | Baud rate at which the communications device operates. | |
CanRaiseEvents | Gets a value indicating whether the component can raise an event. (Inherited from Component) | |
CloseWhenLineStatusIsZero | When this property is true and LineStatus becomes 0 (supposing that it was non 0 after the port has been opened), the port will be closed automatically. Set it to true, for improved fault detection. If you have problems with the port closing itself automatically immediately after open, set this property to false. The default value is true. | |
ConnectedTo | Returns the port where the component is connected to. | |
ConnectionTime | Indicates when the last connection was established. | |
Container | Gets the IContainer that contains the Component. (Inherited from Component) | |
CustomBaudRate | Custom baud rate value, used when BaudRate is set to Custom. | |
CustomPortName | Custom port name can be used when Port is set to Custom. You can use any name, different from COMMxx. | |
DataWidth | Number of bits in the bytes transmitted and received. | |
Delay | Obsolete. Time interval between two receivings in milliseconds (frequency). Same as Interval. | |
DesignMode | Gets a value that indicates whether the Component is currently in design mode. (Inherited from Component) | |
DiscardNulls | Specifies whether null bytes are discarded. If this member is true, null bytes are discarded when received. The default value is false. | |
DsrSensitivity | Specifies whether the communications driver is sensitive to the state of the DSR signal. If this member is true, the driver ignores any bytes received, unless the DSR modem input line is high. The default value is false. | |
EnableDtrOnOpen | Enable DTR when the port is opening. The default value is true. | |
EnableRtsOnOpen | Enable RTS when the port is opening. The default value is true. | |
EofChar | Value of the character used to signal the end of data (ANSI: 0 - 255). The default value is (char)26. | |
ErrorChar | Value of the character used to replace bytes received with a parity error (ANSI: 0 - 255). The default value is (char)0. | |
Events | Gets the list of event handlers that are attached to this Component. (Inherited from Component) | |
EvtChar | Value of the character used to signal an event (ANSI: 0 - 255). The default value is (char)26. | |
Handle | The Windows handle of the serial port. You can use it in some Windows API methods. | |
HardwareFlowControl | Hardware flow control of the serial port. | |
IdleInterval | Idle time interval in milliseconds. If the elapsed time from the last receive is higher than IdleInterval, Idle event occurs. If IdleInterval is 0, Idle event never occurs. It works only for AutoReceive = true. | |
IdleTimeoutInterval | You can set a time-out value to automatically close the connection and fire the IdleTimeout event, if there is no data received in several milliseconds. A value of zero indicates that time-out is not used. | |
InputBuffer | Recommended size of the device's internal input buffer, in bytes. The device driver receives the recommended buffer sizes, but is free to use any input and output (I/O) buffering scheme, as long as it provides reasonable performance and data is not lost due to overrun (except under extreme circumstances). | |
Interval | Time interval between two receivings in milliseconds (frequency). It must be a positive value. The default value is 100. | |
IsFaulted | Indicates that the last connection was faulted. | |
IsIdle | True if Idle occurred, until Resumed. It works only for AutoReceive = true. | |
IsReceiving | This property is false when the component is receiving data from the port, otherwise is false. Use this property to check if the component is inside a receiving process. | |
IsSending | This property is true when the component is sending data to the port, otherwise is false. Use this property to check if the component is inside a sending process. | |
LastDataReceived | Last data received from the serial port. | |
LastTimeReceived | Last date-time when data received from the serial port. | |
LineStatus | Line status of the serial port. The first 4 bits (LSB) of the result contains CTS, DSR, RING and DCD (RLSD or CD) signals status. | |
LogDateTime | When this property is true, a date-time stamp will be added before the logged data. | |
LogFile | Name and path of the log file. | |
LogInput | Enables or disables input logging. If you enable it, all the incoming data will be logged to the LogFile. | |
MaxLineLength | The maximum length of a line, when ReadStringLine or ReadStringUpToEndChars methods are used in synchronous mode (AutoReceive = false). If maximum length is reached, the methods return with empty string. If this value is 0, there is no maximum length. The default value is 0. | |
MinCheckDisconnectedInterval | The minimum time interval in milliseconds, for which the port availability is checked. For time critical usage it's recommended to set it to a higher value. The default value is 25. | |
NeedSynchronization | Set this property to true for thread safety. The default value is false. Note: if you set it to true, you may experiment thread interblocking and lower speed. | |
NewLine | Gets or sets the value used to interpret the end of line in the ReadLine or SendAsciiStringLine methods. Default value is Environment.NewLine, a string containing "\r\n" for non-Unix platforms, or a string containing "\n" for Unix platforms. | |
OutputBuffer | Recommended size of the device's internal output buffer, in bytes. The device driver receives the recommended buffer sizes, but is free to use any input and output (I/O) buffering scheme, as long as it provides reasonable performance and data is not lost due to overrun (except under extreme circumstances). | |
PacketSize | The size of the packets in bytes you want to receive automatically in the Received event. Use this property, if you want to receive packets of equal size in the Received event. If the value is 0, this property will be ignored. It works only for AutoReceive = true. Default value is 0. | |
ParityBits | Parity scheme to be used. | |
ParityCheck | If this property is true, parity checking is performed and parity errors are reported. This should not be confused with the Parity member, which controls the type of parity used in communications. The default value is false. | |
Port | Physical name of the serial port. | |
Priority | Priority of the receiver thread. | |
ReadIntervalTimeout | Maximum time allowed to elapse between the arrival of two characters on the communications line, in milliseconds. During a ReadFile operation, the time period begins when the first character is received. If the interval between the arrival of any two characters exceeds this amount, the ReadFile operation is completed and any buffered data is returned. A value of zero indicates that interval time-outs are not used. A value of MAXDWORD, combined with zero values for both the ReadTotalTimeoutConstant and ReadTotalTimeoutMultiplier members, specifies that the read operation is to return immediately with the characters that have already been received, even if no characters have been received. | |
ReadTotalTimeoutConstant | Constant used to calculate the total time-out period for read operations, in milliseconds. For each read operation, this value is added to the product of the ReadTotalTimeoutMultiplier member and the requested number of bytes. A value of zero for both the ReadTotalTimeoutMultiplier and ReadTotalTimeoutConstant members indicates that total time-outs are not used for read operations. | |
ReadTotalTimeoutMultiplier | Multiplier used to calculate the total time-out period for read operations, in milliseconds. For each read operation, this value is multiplied by the requested number of bytes to be read. | |
ReplaceParityErrors | Specifies whether bytes received with parity errors are replaced with the character specified by the ErrorChar member. If this member is true and the ParityCheck member is true, replacement occurs. The default value is false. | |
Site | Gets or sets the ISite of the Component. (Inherited from Component) | |
SkipSetupFailed | When this property is true, if setting serial parameters like DCB in the Open method fails, will ignore this. Otherwise method Open will return false and the port will not be opened. The default value is false. | |
SoftwareFlowControl | Software flow control of the serial port. | |
StopBits | Number of stop bits to be used. | |
TxContinueOnXoff | Specifies whether transmission stops when the input buffer is full and the driver has transmitted the Xoff character. If this member is true, transmission continues after the Xoff character has been sent. If this member is false, transmission does not continue until the input buffer is within XonLim bytes of being empty and the driver has transmitted the Xon character. The default value is false. | |
UnlockKey | Unlock key. | |
WriteTotalTimeoutConstant | Constant used to calculate the total time-out period for write operations, in milliseconds. For each write operation, this value is added to the product of the WriteTotalTimeoutMultiplier member and the number of bytes to be written. A value of zero for both the WriteTotalTimeoutMultiplier and WriteTotalTimeoutConstant members indicates that total time-outs are not used for write operations. | |
WriteTotalTimeoutMultiplier | Multiplier used to calculate the total time-out period for write operations, in milliseconds. For each write operation, this value is multiplied by the number of bytes to be written. | |
XoffChar | Value of the XOFF character for both transmission and reception (ANSI: 0 - 255). The default value is (char)19. | |
XoffLim | Maximum number of bytes allowed in the input buffer before the XOFF character is sent. The maximum number of bytes allowed is calculated by subtracting this value from the size, in bytes, of the input buffer. The default value is 1. | |
XonChar | Value of the XON character for both transmission and reception (ANSI: 0 - 255). The default value is (char)17. | |
XonLim | Minimum number of bytes allowed in the input buffer before the XON character is sent. The default value is 0, which means InputBuffer div 4. |