Record Method

@bp.method('device.record')

This method allows you to record data to a file which can possibly later be downloaded via the download endpoint.

In order to make the recording work you will need to enable it in device.json.

Parameters

There is one parameter passed to this function which contains the information of the requested action:

def record(action :str) -> str:

Check the passed parameter with e.g.:

if action == 'start':

The parameter can be one of the following:

start

This action is called then you press recording button in the application.

stop

This action is called when the device currently is recording and you press the stop button in the application.

Note

Make sure to return json.dumps({'status': 'ok'}) at the end of the start and stop action to avoid error messages.

status

This action gets called every time you navigate to a page in the application where a recording button is placed.

The return value of this action must tell the application if the device is currently recording or not.

return json.dumps({'recording': <True | False>})

Note

If the return is not implemented correctly it’s possible that you can never stop the recording from the application again.