Source code for netdef.Sources.HoldingRegisterSource

import logging

from ..Interfaces.IntegerInterface import IntegerInterface
from . import IntegerSource, Sources


[docs]@Sources.register("HoldingRegisterSource") class HoldingRegisterSource(IntegerSource.IntegerSource):
[docs] def unpack_unit_and_address(self): return map(int, self.key.split(":"))
[docs] @staticmethod def pack_unit_and_address(unit, address): return "{}:{}".format(unit, address)