In this guide we redirect accelerometer data to a file on disk, but the functionality is general and the procedure can also be used for OBD data, GPS data etc.
- Start by creating a custom code module of type Returner. Go to Advanced > Custom Code:
This default returner implementation will append results to a file on disk located at
/tmp/returner_data.txt. But in reality it possible to integrate with any storage system here.
- For the accelerometer service named ACC_MANAGER register the created custom returner as a hook so it can be used in worker workflows. Go to Advanced > Services > ACC_MANAGER > Hooks > Create:
- Next we have to use the registered hook by editing the workflow for the xyz_logger worker. Go to Advanced > Services > ACC_MANAGER > Workers > xyz_logger. Here we have to change the returner from cloud to my_returner:
When above changes have been successfully synchronised to the device, it will start logging accelerometer data to the specified file.
When logged onto the device using SSH, it is possible to monitor the data in realtime with the command:
tail -f /tmp/returner_data.txt
NOTE: We currently (January 21st 2020) have a minor issue where it’s not possible to assign the custom hook to a default worker. Which the
To get around this issue, you can do the following
xyz_loggerworker to bring up the edit view, and change the name to something else, and then click save. This will create a duplicated version of the logger.
Disable the old
xyz_logger, by clicking the trash icon to the right.
Now you should be able to set the correct returner on the custom worker you created.