API Reference
ShdlcSerialFrameBuilder
ShdlcPort
- class sensirion_shdlc_driver.port.ShdlcPort[source]
Common interface for all communication ports for transceiving SHDLC frames.
Concrete implementations may use the serial port or another interface for transceiving SHDLC frames. All methods must be implemented thread-safe, i.e. allowing them to be called from multiple threads at the same time.
- class sensirion_shdlc_driver.port.ShdlcSerialPort(port, baudrate, additional_response_time=0.1, do_open=True)[source]
SHDLC transceiver for the serial port (e.g. UART/RS232/RS485).
This class implements the ShdlcPort interface for the serial port.
Note
This class can be used in a “with”-statement, and it’s recommended to do so as it automatically closes the port after using it.
- class sensirion_shdlc_driver.port.ShdlcTcpPort(ip, port, socket_timeout=5.0, do_open=True)[source]
SHDLC transceiver for a TCP/IP port in client connection mode.
This class implements the ShdlcPort interface for a client connection on a TCP/IP port.
Note
This class can be used in a “with”-statement, and it’s recommended to do so as it automatically closes the port after using it.
ShdlcConnection
- class sensirion_shdlc_driver.connection.ShdlcConnection(port)[source]
This class represents the connection to an SHDLC bus. So you need to instantiate one object per bus, no matter how many devices are connected to that bus system.
The basic functionality of the class is to send SHDLC frames to devices and receive their response. Handling of communication errors (e.g. timeout or checksum errors) and device errors is done in this class.
ShdlcDevice
- class sensirion_shdlc_driver.device_base.ShdlcDeviceBase(connection, slave_address)[source]
Base class for all SHDLC devices, providing only the basic functionality without implementing any SHDLC commands. The main purpose of this class is to allow derived classes to register their device-specific errors and to allow executing SHDLC commands.
- class sensirion_shdlc_driver.device.ShdlcDevice(connection, slave_address)[source]
Generic SHDLC device, providing only common SHDLC commands. This class is intended only to communicate with devices which do not provide a corresponding device driver (yet). With this class you can for example read the serial number of a device even if no device specific driver exists. But if there exists a device specific driver, you should always use it instead of this driver.
This is a low-level driver which just provides all SHDLC commands as Python methods. Typically, calling a method sends one SHDLC request to the device and interprets its response. There is no higher level functionality available, please look for other drivers if you need a higher level interface.
There is no (or very few) caching functionality in this driver. For example if you call
get_serial_number()100 times, it will send the command 100 times over the SHDLC interface to the device. This makes the driver (nearly) stateless.
ShdlcFirmwareImage
ShdlcFirmwareUpdate
ShdlcCommand
Types
- class sensirion_shdlc_driver.types.FirmwareVersion(major, minor, debug)[source]
Class representing the firmware version of an SHDLC device.
- class sensirion_shdlc_driver.types.HardwareVersion(major, minor)[source]
Class representing the hardware version of an SHDLC device.