-
Notifications
You must be signed in to change notification settings - Fork 110
Description
Icurrently, when one uses communicator.send() to write a packet, he will soon get a ResponsePacket
The specification (ESP3) states that :
If the answer time between REQUEST/EVENT and RESPONSE exceeds 500ms a timeout is identified as well.
For now, RESPONSE handling and timeout detection is left to the user. Maybe it's by design to stay low level and not handle this logic? Otherwise, I think it would be nice to have some sort of blocking method like (naive implementation) :
def send(packet):
global communicator
communicator.send(packet)
packet = communicator.receive.get(block=True, timeout=0.5) # spec-defined timeout is 500ms
if isinstance(packet, ResponsePacket):
print("got response : ", packet.response)
return
else:
#fixme : queue-back this package?
#throw error
print ("non-response packet in send() : ", packet)
packages received when the communicator has a callback would have to always be queued, and we need something a bit more subtle to be able to re-queue packages that came when we were waiting for the ResponsePacket.
is some (refined & tested) version of this desirable or out of this library's scope?