Source is https://stackoverflow.com/a/49452683/1504003
with small adaptations (reset delay and retries when we get back a
connection)
Instead of creating the connection in the "main" method, loop and reopen
a new event loop on failures, let the Protocol class handle connections
and retries on failures.
Reduce keepalive interval and store values in attributes. As many
timeouts in systems are 60 seconds, a keepalive of 50 seconds is less
likely to be stopped.
Improve logs: the docstring of connection_lost is:
The argument is either an exception object or None. The latter means a
regular EOF is received, or the connection was aborted or closed by this
side of the connection.
When it receives no exception, it should not raise an error log.
The proxy would not exit properly in case of a lost connection with the JMIF server.
The change allows the proxy to exit, giving a chance to an external monitoring system
to restart the service.
* Rename methods that fetch a tray to prevent confusion
* Add methods to release a tray
* The Kardex method to fetch a tray has to send "0" in the carrier and
carrierNext field
* The pick and inventory screens release the tray only when there is no next
line, because the release is implicit when we fetch the next line,
the put screen releases everytime because the operator may take time
to start the next line and we don't know if they are going to scan a
next line or not.
* Exiting the screen or switching screen between put/pick/put-away has
to release the tray as well.
* Add vertical_lift_shuttle_id field on stock.location, help to find the
shuttle for a location
* Add StockLocation.fetch_vertical_lift_tray(), that needs to be
implemented in addons to send commands to the hardward to fetch a tray,
and if existing show a cell (laser pointer, ...)
* Add helpers on stock.move.line fetch_vertical_lift_tray_source() and
fetch_vertical_lift_tray_dest() that fetch the tray directly from a move
line's source or destination location