sgr_commhandler.driver.modbus.modbus_interface_async ==================================================== .. py:module:: sgr_commhandler.driver.modbus.modbus_interface_async .. autoapi-nested-parse:: Provides the Modbus interface implementation. Attributes ---------- .. autoapisummary:: sgr_commhandler.driver.modbus.modbus_interface_async.logger Classes ------- .. autoapisummary:: sgr_commhandler.driver.modbus.modbus_interface_async.ModbusDataPoint sgr_commhandler.driver.modbus.modbus_interface_async.ModbusFunctionalProfile sgr_commhandler.driver.modbus.modbus_interface_async.SGrModbusInterface Functions --------- .. autoapisummary:: sgr_commhandler.driver.modbus.modbus_interface_async.get_rtu_slave_id sgr_commhandler.driver.modbus.modbus_interface_async.get_tcp_slave_id sgr_commhandler.driver.modbus.modbus_interface_async.get_endian sgr_commhandler.driver.modbus.modbus_interface_async.get_address_offset sgr_commhandler.driver.modbus.modbus_interface_async.get_tcp_address sgr_commhandler.driver.modbus.modbus_interface_async.get_tcp_port sgr_commhandler.driver.modbus.modbus_interface_async.get_rtu_serial_port sgr_commhandler.driver.modbus.modbus_interface_async.get_rtu_baudrate sgr_commhandler.driver.modbus.modbus_interface_async.get_rtu_parity sgr_commhandler.driver.modbus.modbus_interface_async.build_modbus_data_point sgr_commhandler.driver.modbus.modbus_interface_async.is_integer_type sgr_commhandler.driver.modbus.modbus_interface_async.is_float_type Module Contents --------------- .. py:data:: logger .. py:function:: get_rtu_slave_id(modbus_rtu) Returns the selected slave address. :returns: the slave ID :rtype: int .. py:function:: get_tcp_slave_id(modbus_tcp) Returns the selected slave address. :returns: the slave ID :rtype: int .. py:function:: get_endian(modbus) Returns the byte order (endianness). :returns: the byte order :rtype: BitOrder .. py:function:: get_address_offset(modbus) returns the address offset. is 0 by default and -1 when first register address is 1. .. py:function:: get_tcp_address(modbus_tcp) returns the selected ip address. .. py:function:: get_tcp_port(modbus_tcp) returns the selected ip port. .. py:function:: get_rtu_serial_port(modbus_rtu) returns the selected serial port. .. py:function:: get_rtu_baudrate(modbus_rtu) returns the selected baudrate. .. py:function:: get_rtu_parity(modbus_rtu) returns the parity. .. py:function:: build_modbus_data_point(data_point, functional_profile, interface) Builds a data point of a Modbus interface. .. py:function:: is_integer_type(data_type) Checks if a data type is an integer. :returns: True if integer, False otherwise :rtype: bool .. py:function:: is_float_type(data_type) Checks if a data type is a floating point value. :returns: True if integer, False otherwise :rtype: bool .. py:class:: ModbusDataPoint(dp_spec, fp_spec, interface) Bases: :py:obj:`sgr_commhandler.api.data_point_api.DataPointProtocol`\ [\ :py:obj:`sgr_specification.v0.product.ModbusFunctionalProfile`\ , :py:obj:`sgr_specification.v0.product.ModbusDataPoint`\ ] Implements a data point of a Modbus interface. .. py:attribute:: _interface .. py:attribute:: _address :type: int :value: -1 .. py:attribute:: _data_type :type: sgr_specification.v0.product.modbus_types.ModbusDataType .. py:attribute:: _size :value: 0 .. py:attribute:: _register_type :type: sgr_specification.v0.product.modbus_types.RegisterType .. py:method:: set_val(value) :async: .. py:method:: get_val(parameters = None, skip_cache = False) :async: .. py:class:: ModbusFunctionalProfile(fp_spec, interface) Bases: :py:obj:`sgr_commhandler.api.functional_profile_api.FunctionalProfile`\ [\ :py:obj:`sgr_specification.v0.product.ModbusFunctionalProfile`\ ] Implements a functional profile of a Modbus interface. .. py:attribute:: _interface .. py:attribute:: _data_points .. py:method:: get_data_points() .. py:class:: SGrModbusInterface(frame, sharedRTU = False) Bases: :py:obj:`sgr_commhandler.api.device_api.SGrBaseInterface` Implements a Modbus device interface. .. py:attribute:: _client_wrapper :type: sgr_commhandler.driver.modbus.shared_client.ModbusClientWrapper :value: None .. py:attribute:: byte_order .. py:attribute:: address_offset :value: -1 .. py:attribute:: functional_profiles .. py:attribute:: _device_id :value: '' .. py:method:: __del__() .. py:method:: is_connected() .. py:method:: connect_async() :async: .. py:method:: disconnect_async() :async: .. py:method:: read_data(reg_type, address, size, data_type) :async: Reads data from the given Modbus address(es). .. py:method:: write_data(reg_type, address, data_type, value) :async: Writes data to the given Modbus address(es). .. py:method:: set_slave_id(slave_id)