Exemplo n.º 1
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
Exemplo n.º 2
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
Exemplo n.º 3
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)
Exemplo n.º 4
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)
Exemplo n.º 5
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")
Exemplo n.º 6
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")