extends Node ## Constants For Modbus Server/Client ## This is the single location for storing default ## values for the servers and clients. ## A collection of modbus default values[br] class Defaults: ## [param Port] ## The default modbus tcp server port (502)[br] ## ## [param TLSPort] ## The default modbus tcp over tls server port (802)[br] ## ## [param Backoff] ## The default exponential backoff delay (0.3 seconds)[br] ## ## [param Retries] ## The default number of times a client should retry the given ## request before failing (3)[br] ## ## [param RetryOnEmpty] ## A flag indicating if a transaction should be retried in the ## case that an empty response is received. This is useful for ## slow clients that may need more time to process a request.[br] ## ## [param RetryOnInvalid] ## A flag indicating if a transaction should be retried in the ## case that an invalid response is received.[br] ## ## [param Timeout] ## The default amount of time a client should wait for a request ## to be processed (3 seconds)[br] ## ## [param Reconnects] ## The default number of times a client should attempt to reconnect ## before deciding the server is down (0)[br] ## ## [param TransactionId] ## The starting transaction identifier number (0)[br] ## ## [param ProtocolId] ## The modbus protocol id. Currently this is set to 0 in all ## but proprietary implementations.[br] ## ## [param UnitId] ## The modbus slave addrss. Currently this is set to 0x00 which ## means this request should be broadcast to all the slave devices ## (really means that all the devices should respons).[br] ## ## [param Baudrate] ## The speed at which the data is transmitted over the serial line. ## This defaults to 19200.[br] ## ## [param Parity] ## The type of checksum to use to verify data integrity. This can be ## on of the following:[br] ## - (E)ven - 1 0 1 0 | P(0)[br] ## - (O)dd - 1 0 1 0 | P(1)[br] ## - (N)one - 1 0 1 0 | no parity[br] ## This defaults to (N)one.[br] ## ## [param Bytesize] ## The number of bits in a byte of serial data. This can be one of ## 5, 6, 7, or 8. This defaults to 8.[br] ## ## [param Stopbits] ## The number of bits sent after each character in a message to ## indicate the end of the byte. This defaults to 1.[br] ## ## [param ZeroMode] ## Indicates if the slave datastore should use indexing at 0 or 1. ## More about this can be read in section 4.4 of the modbus specification.[br] ## ## [param IgnoreMissingSlaves] ## In case a request is made to a missing slave, this defines if an error ## should be returned or simply ignored. This is useful for the case of a ## serial server emulater where a request to a non-existant slave on a bus ## will never respond. The client in this case will simply timeout.[br] ## ## [param broadcast_enable] ## When False unit_id 0 will be treated as any other unit_id. When True and ## the unit_id is 0 the server will execute all requests on all server ## contexts and not respond and the client will skip trying to receive a ## response. Default value False does not conform to Modbus spec but maintains ## legacy behavior for existing pymodbus users[br] const Port: = 502 const TLSPort: = 802 const Backoff: = 0.3 const Retries: = 3 const RetryOnEmpty: = false const RetryOnInvalid: = false const Timeout: = 3 const Reconnects: = 0 const TransactionId: = 0 const ProtocolId: = 0 const UnitId: = 0x00 const Baudrate: = 19200 const Parity: = 'N' const Bytesize: = 8 const Stopbits: = 1 const ZeroMode: = false const IgnoreMissingSlaves: = false const ReadSize: = 1024 const broadcast_enable: = false ## These represent various status codes in the modbus ## protocol.[br] class ModbusStatus extends Object: ## ## [param Waiting] ## This indicates that a modbus device is currently ## waiting for a given request to finish some running task.[br] ## ## [param Ready] ## This indicates that a modbus device is currently ## free to perform the next request task.[br] ## ## [param On] ## This indicates that the given modbus entity is on[br] ## ## [param Off] ## This indicates that the given modbus entity is off[br] ## ## [param SlaveOn] ## This indicates that the given modbus slave is running[br] ## ## [param SlaveOff] ## This indicates that the given modbus slave is not running[br] const Waiting: = 0xffff const Ready: = 0x0000 const On: = 0xff00 const Off: = 0x0000 const SlaveOn: = 0xff const SlaveOff: = 0x00 class Endian: ## An enumeration representing the various byte endianess. ## [param Auto] ## This indicates that the byte order is chosen by the ## current native environment.[br] ## [param Big] ## This indicates that the bytes are in little endian format.[br] ## [param Little] ## This indicates that the bytes are in big endian format ## [i]I am simply borrowing the format strings from the ## python struct module for my convenience.[/i] const Auto: = '@' const Big: = '>' const Little: = '<' class ModbusPlusOperation: ## Represents the type of modbus plus request ## [param GetStatistics] ## Operation requesting that the current modbus plus statistics ## be returned in the response.[br] ## [param ClearStatistics] ## Operation requesting that the current modbus plus statistics ## be cleared and not returned in the response.[br] const GetStatistics: = 0x0003 const ClearStatistics: = 0x0004 class DeviceInformation: ## Represents what type of device information to read ## ## [param Basic] ## This is the basic (required) device information to be returned. ## This includes VendorName, ProductCode, and MajorMinorRevision ## code.[br] ## ## [param Regular] ## In addition to basic data objects, the device provides additional ## and optional identification and description data objects. All of ## the objects of this category are defined in the standard but their ## implementation is optional.[br] ## ## [param Extended ## In addition to regular data objects, the device provides additional ## and optional identification and description private data about the ## physical device itself. All of these data are device dependent.[br] ## ## [param Specific] ## Request to return a single data object.[br] const Basic: = 0x01 const Regular: = 0x02 const Extended: = 0x03 const Specific: = 0x04 class MoreData: ## Represents the more follows condition ## [param Nothing] ## This indiates that no more objects are going to be returned.[br] ## ## [param KeepReading] ## This indicates that there are more objects to be returned.[br] const Nothing: = 0x00 const KeepReading: = 0xFF