Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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