Hello,
There is an example that comes BBG OS image that implements your requirement. Please refer the same :
Thanks and Warm Regards