Serial port

Method: portName

Returns the name of a serial port if it is real, or a name of a symbolic link to the virtual port’s slave side.

Example:

    evesec call /SEC/__dev__ttyS0/serial connection.serial portName

Returned value:

    "/dev/ttyS0" 

Method: isOpen

Returns information on whether serial port is opened or not.

Serial port can be closed when the connection is started if you use late serial port opening and there are no established TCP connections.

Example:

    evesec call /SEC/__dev__ttyS0/serial connection.serial isOpen 

Method: isVirtual

Returns information on whether serial port is virtual or not.

Example:

    evesec call /SEC/__dev__ttyS0/serial connection.serial isVirtual

Serial port has several initial parameters, which can be set before the port is opened.

Property: initial_baudRate

Type:                      uint32 (u)
Possible values:           50, 75, 110, 134, 150, 200, 300, 600,
                           1200, 1800, 2400, 4800, 9600,
                           19200, 38400, 57600,
                           115200, 230400, 460800,
                           500000, 576000, 921600,
                           1000000, 1152000, 1500000,
                           2000000, 2500000,
                           3000000, 3500000, 4000000
Default value:             9600 baud
Note: Can be changed anytime but the value will be applied only on serial port opening.

 

Property: initial_dataBits

Type:                      uint32 (u)
Value limits:              [5 .. 8] bits
Default value:             8 bits
Note: Can be changed anytime but the value will be applied only on serial port opening.

 

Property: initial_flowControl

Type:                      uint32 (u)
Value limits:              [0 .. 2]
Values:

0 = none
1 = software flow control (XON/XOFF)
2 = hardware flow control

Default value:             0
Note: Can be changed anytime but the value will be applied only on serial port opening.

 

Property: initial_parity

Type:                      uint32 (u)
Value limits:              [0 .. 4]
Values:

0 = none
1 = odd
2 = even
3 = mark
4 = space

Default value:             0
Note: Can be changed anytime but the value will be applied only on serial port opening.

 

Property: initial_stopBits

Type:                      uint32 (u)
Value limits:              [1 .. 2] bits
Default value:             1 bit
Note: Can be changed anytime but the value will be applied only on serial port opening.

 

Property: signalLinesPolling

Type:                      uint32 (u)
Default value:             0 ms
Note: 0 ms polling interval means that polling mode is not used.

Once the port is opened, the following methods become valid and indicate the current state of the serial port:

Method: baudRate

Type:                      uint32 (u)
Note: Valid only when serial port is opened.

Example:

    evesec call /SEC/__dev__ttyS0/serial connection.serial baudRate

Returned value:

    uint32 9600 

Method: dataBits

Type:                      uint32 (u)
Note: Valid only when serial port is opened.

Example:

    evesec call /SEC/__dev__ttyS0/serial connection.serial dataBits

Returned value:

    uint32 8 

Method: flowControl

Type:                      uint32 (u)
Note: Valid only when serial port is opened.

Example:

    evesec call /SEC/__dev__ttyS0/serial connection.serial flowControl

Returned value:

    uint32 0 

Method: parity

Type:                      uint32 (u)
Note: Valid only when serial port is opened.

Example:

    evesec call /SEC/__dev__ttyS0/serial connection.serial parity

Returned value:

    uint32 0 

Method: stopBits

Type:                      uint32 (u)
Note: Valid only when serial port is opened.

Example:

    evesec call /SEC/__dev__ttyS0/serial connection.serial stopBits

Returned value:

    uint32 1 

Method: signalLinesSupported

Returns information on whether signal lines are supported or not.

Note: In native Linux virtual ports signal lines are not supported.

Example:

    evesec call /SEC/__dev__ttyS0/serial connection.serial signalLinesSupported

Returned value:

    boolean true 

Method: signalLines

Returns signal lines’ states for the serial port.

Signal lines values in decimal numeral system are the following:

DTR – 2
RTS – 4
CTS – 32
CAR – 64
RNG – 128
DSR – 256

Returned value is the sum of those signal lines, which are currently on.

For example, if DTR and DSR are on, while other signal lines are off, the method will return 258 (= 256 + 2):

    evesec call /SEC/__dev__ttyS0/serial connection.serial signalLines

Returned value:

    uint32 258

Method: setSignalLines

Allows setting signal lines values when serial port is open.

The following parameters are used:

  • mask – indicates signal lines to be changed
  • value – indicates new values of signal lines selected by mask

Returns no value.

Examples:

In this example we turn DTR on (DTR’s value is 2):

    evesec call /SEC/__dev__ttyS0/serial connection.serial setSignalLines \
      uint32:2 \
      uint32:2

In this example, DTR is switched on and RTS – off (DTR’s value is 2, DTR and RTS sum is 6):

    evesec call /SEC/__dev__ttyS0/serial connection.serial setSignalLines \
      uint32:6 \
      uint32:2 

Property: signalLinesOffline

Type:                      uint32 (u)
Default value:             0
Note: Can be changed anytime but the value will be applied only when the last TCP connection is lost.

 

Property: signalLinesOnline

Type:                      uint32 (u)
Default value:             6 (DTR + RTS )
Note: Can be changed anytime but the value will be applied only when the first TCP connection is established.

 

Property: signalLinesTelnetMask

Using this property you can disable changing of some signal lines’ values through Telnet connection.

Type:                      uint32 (u)
Default value:             198 (DTR + RTS + CAR + RNG) 

Property: dataReadRight

Together with dataWriteRight, controls serial port’s traffic.

Type:                      boolean (b)
Default value:             true 

Property: dataWriteRight

Together with dataReadRight, controls serial port’s traffic.

Type:                      boolean (b)
Default value:             true 

Method: bytesRead

Returns the amount of bytes read from the serial port.

Example:

    evesec call /SEC/__dev__ttyS0/serial connection.serial bytesRead

Returned value:

    uint64 39 

Method: bytesWritten

Returns the amount of bytes written to the serial port.

Example:

    evesec call /SEC/__dev__ttyS0/serial connection.serial bytesWritten

Returned value:

    uint64 21