seems there is already something available, however I am not able to follow it up to the user space https://github.com/espruino/Espruino/blob/55fbab3847975a40341dd2272d4693b341cc0ffe/targetlibs/nrf5x_12/components/softdevice/s130/headers/ble.h#L109
@Jean-Philippe_Rey started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
seems there is already something available, however I am not able to follow it up to the user space
https://github.com/espruino/Espruino/blob/55fbab3847975a40341dd2272d4693b341cc0ffe/targetlibs/nrf5x_12/components/softdevice/s130/headers/ble.h#L109