Skip to content

rss2i.py: record: Exit when OTA timeout

The record subcommand should quit execution when an Over The Air (OTA) timeout occurs.

Reproduce

Make sure device x is not available OTA e.g. by turning it off. Suppose that you have a device y connected to the PC. Then

rss2i -a record -d x -o my_

Actual Behaviour

rss2i: Detecting connected devices... [y]
rss2i: Device y --over-the-air--> device x
rss2i: _query@2125: WARN_OVERTHEAIR_TIMEOUT: timeout ocurred when trying to send data to device x
rss2i: Disconnecting devices...ok

The user now expects to have a my_rec_x.json file that contains the session data of device x. However, due to the OTA timeout, this file does not exist. The session data is not available and the user wasn't informed about this explicitly. The return code

echo $?

is fine so far:

0

Desired Behaviour

rss2i: Detecting connected devices... [y]
rss2i: Device y --over-the-air--> device x
rss2i: _query@2125: WARN_OVERTHEAIR_TIMEOUT: timeout ocurred when trying to send data to device x
rss2i: record@....: ERR_RECORD_FAILED: Record session data of device x has not been successful
rss2i: Disconnecting devices...ok

The user gets an explicit information about the failure. Furthermore, the return code

echo $?
1

points towards this failure, too.

Edited by Gerrit