Exemple #1
0
    def __init__(self, *args):
        BIPSimpleApplication.__init__(Mock())
        self.elementService = Mock()
        #self.ResponseQueue = Mock()
        #self.ResponseQueue.get.return_value = ([21, 'degreesCelcius'], Event())
        iocb = IOCB()
        apdu = ReadPropertyMultipleACK(listOfReadAccessResults=[
            ReadAccessResult(
                objectIdentifier=('analogValue', 1),
                listOfResults=[
                    ReadAccessResultElement(
                        propertyIdentifier='presentValue',
                        readResult=ReadAccessResultElementChoice(
                            propertyValue=Any(Real(21.0)), )),
                    ReadAccessResultElement(
                        propertyIdentifier='units',
                        readResult=ReadAccessResultElementChoice(
                            propertyValue=Any(Enumerated(62)), )),
                ],
            )
        ])

        iocb.complete(apdu)
        self.request = Mock()
        self.request.return_value = iocb
    def __init__(self, *args):
        BIPSimpleApplication.__init__(Mock())
        self.elementService = Mock()
        #self.value = None
        iocb = IOCB()

        # Forging apdu response
        fake_apdu = ReadPropertyACK(
            objectIdentifier=('analogInput', 0),
            propertyIdentifier='presentValue',
            propertyValue=Any(Real(32)),
        )
        iocb.complete(fake_apdu)
        self.request = Mock()
        self.request.return_value = iocb