Ejemplo n.º 1
0
    def indication(self, apdu):
        """Given an I-Am request, cache it.
        Indication will treat unconfirmed messages on the stack
        
        :param apdu: apdu
        """
        if _debug: ScriptApplication._debug("do_IAmRequest %r", apdu)
        if isinstance(apdu, IAmRequest):
            # build a key from the source, just use the instance number
            key = (str(apdu.pduSource),
                   apdu.iAmDeviceIdentifier[1],
            )
            # count the times this has been received
            self.i_am_counter[key] += 1
        
        if isinstance(apdu, WhoIsRequest):        
        # build a key from the source and parameters
            key = (str(apdu.pduSource),
                apdu.deviceInstanceRangeLowLimit,
                apdu.deviceInstanceRangeHighLimit,
                )

        # count the times this has been received
            self.who_is_counter[key] += 1
            BIPSimpleApplication.do_WhoIsRequest(self, apdu)
        # pass back to the default implementation
        BIPSimpleApplication.indication(self, apdu)
Ejemplo n.º 2
0
    def indication(self, apdu):
        """Given an I-Am request, cache it.
        Indication will treat unconfirmed messages on the stack
        
        :param apdu: apdu
        """
        if _debug: ScriptApplication._debug("do_IAmRequest %r", apdu)
        if isinstance(apdu, IAmRequest):
            # build a key from the source, just use the instance number
            key = (
                str(apdu.pduSource),
                apdu.iAmDeviceIdentifier[1],
            )
            # count the times this has been received
            self.i_am_counter[key] += 1

        if isinstance(apdu, WhoIsRequest):
            # build a key from the source and parameters
            key = (
                str(apdu.pduSource),
                apdu.deviceInstanceRangeLowLimit,
                apdu.deviceInstanceRangeHighLimit,
            )

            # count the times this has been received
            self.who_is_counter[key] += 1
            BIPSimpleApplication.do_WhoIsRequest(self, apdu)
        # pass back to the default implementation
        BIPSimpleApplication.indication(self, apdu)
Ejemplo n.º 3
0
    def do_WhoIsRequest(self, apdu):
        """Respond to a Who-Is request."""
        self.log(("do_WhoIsRequest {!r}".format(apdu)))

        # build a key from the source and parameters
        key = (str(apdu.pduSource), apdu.deviceInstanceRangeLowLimit,
               apdu.deviceInstanceRangeHighLimit)

        # count the times this has been received
        self.who_is_counter[key] += 1

        # continue with the default implementation
        BIPSimpleApplication.do_WhoIsRequest(self, apdu)
    def do_WhoIsRequest(self, apdu):
        """Respond to a Who-Is request."""
        if _debug:
            WhoIsIAmApplication._debug("do_WhoIsRequest %r", apdu)

        # build a key from the source and parameters
        key = (str(apdu.pduSource), apdu.deviceInstanceRangeLowLimit, apdu.deviceInstanceRangeHighLimit)

        # count the times this has been received
        who_is_counter[key] += 1

        # continue with the default implementation
        BIPSimpleApplication.do_WhoIsRequest(self, apdu)
    def do_WhoIsRequest(self, apdu):
        """Respond to a Who-Is request."""
        if _debug: WhoIsIAmApplication._debug("do_WhoIsRequest %r", apdu)

        # build a key from the source and parameters
        key = (str(apdu.pduSource),
            apdu.deviceInstanceRangeLowLimit,
            apdu.deviceInstanceRangeHighLimit,
            )

        # count the times this has been received
        who_is_counter[key] += 1

        # continue with the default implementation
        BIPSimpleApplication.do_WhoIsRequest(self, apdu)
Ejemplo n.º 6
0
    def do_WhoIsRequest(self, apdu):
        """Respond to a Who-Is request."""
        self.log(("do_WhoIsRequest {!r}".format(apdu)))

        # build a key from the source and parameters
        key = (
            str(apdu.pduSource),
            apdu.deviceInstanceRangeLowLimit,
            apdu.deviceInstanceRangeHighLimit,
        )

        # count the times this has been received
        self.who_is_counter[key] += 1

        # continue with the default implementation
        BIPSimpleApplication.do_WhoIsRequest(self, apdu)