Example #1
0
 def __init__(self, *args, **kwargs):
     if _debug: MPCI._debug("__init__ %r %r", args, kwargs)
     PCI.__init__(self, *args, **kwargs)
     self.mpduTransactionID = 0
     self.mpduProtocolID = 0
     self.mpduLength = None
     self.mpduUnitID = 0
     self.mpduFunctionCode = None
Example #2
0
 def __init__(self, *args, **kwargs):
     if _debug: MPCI._debug("__init__ %r %r", args, kwargs)
     PCI.__init__(self, *args, **kwargs)
     self.mpduTransactionID = 0
     self.mpduProtocolID = 0
     self.mpduLength = None
     self.mpduUnitID = 0
     self.mpduFunctionCode = None
Example #3
0
    def update(self, mpci):
        if _debug: MPCI._debug("update %r", mpci)

        PCI.update(self, mpci)
        self.mpduTransactionID = mpci.mpduTransactionID
        self.mpduProtocolID = mpci.mpduProtocolID
        self.mpduLength = mpci.mpduLength
        self.mpduUnitID = mpci.mpduUnitID
        self.mpduFunctionCode = mpci.mpduFunctionCode
Example #4
0
    def update(self, mpci):
        if _debug: MPCI._debug("update %r", mpci)

        PCI.update(self, mpci)
        self.mpduTransactionID = mpci.mpduTransactionID
        self.mpduProtocolID = mpci.mpduProtocolID
        self.mpduLength = mpci.mpduLength
        self.mpduUnitID = mpci.mpduUnitID
        self.mpduFunctionCode = mpci.mpduFunctionCode
Example #5
0
    def encode(self, pdu):
        """Encode the contents into the PDU."""
        if _debug: MPCI._debug("encode %r", pdu)

        PCI.update(pdu, self)

        pdu.put_short(self.mpduTransactionID)
        pdu.put_short(self.mpduProtocolID)
        pdu.put_short(self.mpduLength)
        pdu.put(self.mpduUnitID)
        pdu.put(self.mpduFunctionCode)
Example #6
0
    def encode(self, pdu):
        """Encode the contents into the PDU."""
        if _debug: MPCI._debug("encode %r", pdu)

        PCI.update(pdu, self)

        pdu.put_short(self.mpduTransactionID)
        pdu.put_short(self.mpduProtocolID)
        pdu.put_short(self.mpduLength)
        pdu.put(self.mpduUnitID)
        pdu.put(self.mpduFunctionCode)
Example #7
0
    def decode(self, pdu):
        """Decode the contents of the PDU."""
        if _debug: MPCI._debug("decode %r", pdu)

        PCI.update(self, pdu)

        self.mpduTransactionID = pdu.get_short()
        self.mpduProtocolID = pdu.get_short()
        self.mpduLength = pdu.get_short()
        self.mpduUnitID = pdu.get()
        self.mpduFunctionCode = pdu.get()

        # check the length
        if self.mpduLength != len(pdu.pduData) + 2:
            raise DecodingError("invalid length")
Example #8
0
    def decode(self, pdu):
        """Decode the contents of the PDU."""
        if _debug: MPCI._debug("decode %r", pdu)

        PCI.update(self, pdu)

        self.mpduTransactionID = pdu.get_short()
        self.mpduProtocolID = pdu.get_short()
        self.mpduLength = pdu.get_short()
        self.mpduUnitID = pdu.get()
        self.mpduFunctionCode = pdu.get()

        # check the length
        if self.mpduLength != len(pdu.pduData) + 2:
            raise DecodingError("invalid length")