How to use the rak811.rak811.Rak811ResponseError function in rak811

To help you get started, we’ve selected a few rak811 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AmedeeBulle / pyrak811 / rak811 / rak811.py View on Github external
Rak811ResponseError exception is raised if the command returns an
        error.
        This is a "blocking" call: if the module does not respond
        Rack811TimeoutError will be raised.
        """
        self._serial.send_command(command)
        response = self._serial.get_response()

        # Ignore events received while waiting on command feedback
        while response.startswith(RESPONSE_EVENT):
            response = self._serial.get_response()

        if response.startswith(RESPONSE_OK):
            response = response[len(RESPONSE_OK):]
        elif response.startswith(RESPONSE_ERROR):
            raise Rak811ResponseError(response[len(RESPONSE_ERROR):])
        else:
            raise Rak811ResponseError(response)

        return response
github AmedeeBulle / pyrak811 / rak811 / rak811.py View on Github external
This is a "blocking" call: if the module does not respond
        Rack811TimeoutError will be raised.
        """
        self._serial.send_command(command)
        response = self._serial.get_response()

        # Ignore events received while waiting on command feedback
        while response.startswith(RESPONSE_EVENT):
            response = self._serial.get_response()

        if response.startswith(RESPONSE_OK):
            response = response[len(RESPONSE_OK):]
        elif response.startswith(RESPONSE_ERROR):
            raise Rak811ResponseError(response[len(RESPONSE_ERROR):])
        else:
            raise Rak811ResponseError(response)

        return response