Class: QgsSerialPortSensor

class qgis.core.QgsSerialPortSensor

Bases: QgsIODeviceSensor

A serial port sensor class

Added in version 3.32.

QgsSerialPortSensor(parent: Optional[QObject] = None) Constructor for a serial port sensor, bound to the specified parent.

Methods

baudRate

Returns the baudrate of the serial port the sensor connects to.

childEvent

connectNotify

create

Returns a new serial port sensor.

customEvent

disconnectNotify

handleConnect

handleDisconnect

initIODevice

Initiates the I/O device.

isSignalConnected

parseData

Parses the data read from the device when available.

portName

Returns the serial port the sensor connects to.

readPropertiesFromElement

param element:

receivers

sender

senderSignalIndex

setBaudRate

Sets the baudrate of the serial port the sensor connects to.

setPortName

Sets the serial port the sensor connects to.

timerEvent

type

rtype:

str

writePropertiesToElement

param element:

baudRate(self) QSerialPort.BaudRate

Returns the baudrate of the serial port the sensor connects to.

Added in version 3.36.

Return type:

QSerialPort.BaudRate

childEvent(self, a0: QChildEvent | None)
connectNotify(self, signal: QMetaMethod)
create(parent: QObject | None) QgsSerialPortSensor | None

Returns a new serial port sensor.

The caller takes responsibility for deleting the returned object.

Parameters:

parent (Optional[QObject])

Return type:

Optional[QgsSerialPortSensor]

customEvent(self, a0: QEvent | None)
disconnectNotify(self, signal: QMetaMethod)
handleConnect(self)
handleDisconnect(self)
initIODevice(self, device: QIODevice | None)

Initiates the I/O device.

Note

Takes ownership of the device.

isSignalConnected(self, signal: QMetaMethod) bool
parseData(self)

Parses the data read from the device when available.

portName(self) str

Returns the serial port the sensor connects to.

Return type:

str

readPropertiesFromElement(self, element: QDomElement, document: QDomDocument) bool
Parameters:
  • element (QDomElement)

  • document (QDomDocument)

Return type:

bool

receivers(self, signal: PYQT_SIGNAL) int
sender(self) QObject | None
senderSignalIndex(self) int
setBaudRate(self, baudRate: QSerialPort.BaudRate)

Sets the baudrate of the serial port the sensor connects to.

Parameters:

baudRate (QSerialPort.BaudRate) – the baudrate (e.g. 9600)

Added in version 3.36.

setPortName(self, portName: str | None)

Sets the serial port the sensor connects to.

Parameters:

portName (Optional[str]) – the port name (e.g. COM4)

timerEvent(self, a0: QTimerEvent | None)
type(self) str
Return type:

str

writePropertiesToElement(self, element: QDomElement, document: QDomDocument) bool
Parameters:
  • element (QDomElement)

  • document (QDomDocument)

Return type:

bool