Hi,
I am trying to define a service at runtime because we want that the Service UUID may be changed according to a configuration variable.
I have set CONFIG_BT_GATT_DYNAMIC_DB=y
And added the code:
static struct bt_uuid_128 uuid;
uuid = (struct bt_uuid_128)BT_UUID_INIT_128(0x53, 0xF5, 0x3C, 0x12, 0xF0, 0xD6, 0x25, 0xAD, 0xD6, 0x4E, 0xA6, 0x48, 0x01, 0x00, 0x54, 0xE7);
static struct bt_gatt_attr attr;
attr = (struct bt_gatt_attr)BT_GATT_PRIMARY_SERVICE(&uuid);
static struct bt_gatt_service service;
service = (struct bt_gatt_service) { .attrs = &attr, .attr_count = 1 };
int result = bt_gatt_service_register(&service);
printk("Bluetooth dynamic service registration (result %d)\n", result);
When I test the code printout is:
Bluetooth dynamic service registration (result 0)
But the service is not available, when I connect to my device with a smartphone using the nRF Connect APP.
Can anyone help me?
Br Mads