|
mbserver 0.5.1
|

Public Member Functions | |
| __init__ (self, value=None, offset=None) | |
| bool | isvalid (self) |
| int | type (self) |
| settype (self, int tp) | |
| int | offset (self) |
| setoffset (self, int offset) | |
| int | number (self) |
| setnumber (self, int number) | |
| fromint (self, int v) | |
| int | toint (self) |
| fromstr (self, str s) | |
| str | tostr (self, int notation=Notation_Default) |
| __int__ (self) | |
| __lt__ (self, other) | |
| __le__ (self, other) | |
| __eq__ (self, other) | |
| __ne__ (self, other) | |
| __gt__ (self, other) | |
| __ge__ (self, other) | |
| __hash__ (self) | |
| __add__ (self, int other) | |
| __sub__ (self, int other) | |
| __iadd__ (self, int other) | |
| __isub__ (self, int other) | |
| __repr__ (self) | |
| __str__ (self) | |
Protected Attributes | |
| _type = Memory_Unknown | |
| int | _offset = 0 |
Modbus Data Address class. Represents Modbus Data Address. `Address` class is used to represent Modbus Data Address. It contains memory type and offset. E.g. `modbus.Address(modbus.Memory_4x, 0)` creates `400001` standard address. E.g. `modbus.Address(400001)` creates `Address` with type `Modbus::Memory_4x` and offset `0`, and `modbus.Address(1)` creates `modbus.Address` with type `modbus.Memory_0x` and offset `0`. Class provides convertions from/to string methods. Class supports next operators and standard functions: +, -, <, <=, >, >=, ==, !=, hash(), str(), int()
| modbus.Address.__init__ | ( | self, | |
| value = None, | |||
| offset = None ) |
Constructor of the class.
Can have next forms:
* `Address()` - creates invalid address class
* `Address(Memory_4x, 0)` - creates address for holding registers with `offset=0`
* `Address("%MW0")` - creates address for holding registers with `offset=0`
* `Address("%Q0000h")` - creates address for coils with `offset=0`
* `Address("100001")` - creates address for input discretes with `offset=0`
* `Address(300001)` - creates address for input registers with `offset=0`
| modbus.Address.__add__ | ( | self, | |
| int | other ) |
Return a new Address object with the offset increased by the given integer.
| modbus.Address.__eq__ | ( | self, | |
| other ) |
Return self.toint() == other.toint()
| modbus.Address.__ge__ | ( | self, | |
| other ) |
Return self.toint() >= other.toint()
| modbus.Address.__gt__ | ( | self, | |
| other ) |
Return self.toint() > other.toint()
| modbus.Address.__hash__ | ( | self | ) |
Return the hash of the object.
| modbus.Address.__iadd__ | ( | self, | |
| int | other ) |
Increase the offset by the given integer.
| modbus.Address.__int__ | ( | self | ) |
Return the integer representation of the object by calling the toint() method.
| modbus.Address.__isub__ | ( | self, | |
| int | other ) |
Decrease the offset by the given integer.
| modbus.Address.__le__ | ( | self, | |
| other ) |
Return self.toint() <= other.toint()
| modbus.Address.__lt__ | ( | self, | |
| other ) |
Return self.toint() < other.toint()
| modbus.Address.__ne__ | ( | self, | |
| other ) |
Return self.toint() != other.toint()
| modbus.Address.__repr__ | ( | self | ) |
Return the string representation of the object.
| modbus.Address.__str__ | ( | self | ) |
Return the string representation of the object.
| modbus.Address.__sub__ | ( | self, | |
| int | other ) |
Return a new Address object with the offset decreased by the given integer.
| modbus.Address.fromint | ( | self, | |
| int | v ) |
Make modbus address from integer representaion
| modbus.Address.fromstr | ( | self, | |
| str | s ) |
Make modbus address from string representaion
| bool modbus.Address.isvalid | ( | self | ) |
Returns `True` if memory type is not `Modbus::Memory_Unknown`, `False` otherwise.
| int modbus.Address.number | ( | self | ) |
Returns memory number (offset+1) of Modbus Data Address.
| int modbus.Address.offset | ( | self | ) |
Returns memory offset of Modbus Data Address.
| modbus.Address.setnumber | ( | self, | |
| int | number ) |
Set memory number (offset+1) of Modbus Data Address.
| modbus.Address.setoffset | ( | self, | |
| int | offset ) |
Sets memory offset of Modbus Data Address.
| modbus.Address.settype | ( | self, | |
| int | tp ) |
Sets memory type of Modbus Data Address.
| int modbus.Address.toint | ( | self | ) |
Converts current Modbus Data Address to `int`, e.g. `Address(Memory_4x, 0)` will be converted to `400001`.
| str modbus.Address.tostr | ( | self, | |
| int | notation = Notation_Default ) |
Returns string repr of Modbus Data Address with specified notation: * `Notation_Modbus` - `Address(Memory_4x, 0)` will be converted to `"400001"`. * `Notation_IEC61131` - `Address(Memory_4x, 0)` will be converted to `"%MW0"`. * `Notation_IEC61131Hex` - `Address(Memory_4x, 0)` will be converted to `"%MW0000h"`.
| int modbus.Address.type | ( | self | ) |
Returns memory type of Modbus Data Address.