It's necessary to turn on the Bluetooth radio to use the Bluetooth APIs.
The user can turn on the Bluetooth radio from the Settings screen: System Settings > Network Connections > Bluetooth. Your application can use the Bluetooth APIs to check the status of the Bluetooth radio and to turn it on if needed. Changing the Bluetooth settings using the APIs will update the settings on the Bluetooth screen.
if (!bt_ldev_get_power()) {
bt_ldev_set_power(true);
}
if (bt_ldev_get_discoverable() != BT_DISCOVERABLE_GIAC) {
bt_ldev_set_discoverable(BT_DISCOVERABLE_GIAC);
}