Skip to content

senxor.interface.serial_port

SerialInterface(device)

Bases: SerialInterfaceBase

is_connected property

data_ready property

(Optional) Whether the data is ready to be read.

OP_TIMEOUT = 3 class-attribute

OP_RETRY_TIMES = 1 class-attribute

OP_RETRY_INTERVAL = 0.1 class-attribute

logger = get_logger().bind(name=(device.name)) instance-attribute

transport = self.TRANSPORT_CLASS(device) instance-attribute

processor = SerialAckProcessor(self.transport, self.logger) instance-attribute

TRANSPORT_CLASS = SerialTransport class-attribute instance-attribute

device property

open()

close()

bind_state(state)

Receive the latest device state snapshot from Senxor.

read(timeout=None)

read_reg(reg)

read_regs(regs)

write_reg(reg, value)

write_regs(regs)

hard_reset()

(Optional) Hard reset the device.

This operation is optional and may not be supported by all devices.

This method should not automatically re-open the connection to the device.

Returns:

Type Description
None

Raises:

Type Description
NotImplementedError

If the device does not support hard reset.

list_devices() classmethod

SerialPort(port)

Bases: IDevice

INTERFACE_TYPE = 'serial' class-attribute instance-attribute

port = port instance-attribute

name property

device property

vid property

pid property

is_serial_port_senxor(port)

Check if the serial port is a senxor device.

list_senxor_serial_ports(exclude_open_ports=True)

List all the senxor serial ports.

Parameters:

Name Type Description Default

exclude_open_ports

bool

If True, exclude the ports that are currently open (in use). Default is True.

True