denpamusic/PyPlumIO

Regdata becomes permanently unavailable if schema is corrupted during startup

denpamusic opened this issue · 2 comments

Hi,

Sometimes on start app i got message like:

Can't process received frame: Incorrect frame checksum (1)
Can't process received frame: Incorrect frame checksum (22)

and when i try get regdata (or subscribe regdata),
i got nothing. ( connection can be open next 10, 20 min or more and still regdata (subscribe) will be not available)

I must restart app (reconnect) and try again get regdata (with timeout=15), when i got regdata message, then i know, that will be ok.

Originally posted by @entmor in #8 (comment)

If regdata schema response gets corrupted during transmission, PyPlumIO doesn't know what to do with regdata. Required request must be retried if failed during the startup.

@entmor
This should now be fixed with introduction of Device.wait_for_data(). This method is based on your idea, but instead of reconnecting it just retries schema request before trying to decode regdata.

edit.
This solution however should be treated as temporary one, until more general alternative is released, that ensures all requests get answered.