Hello, I have custom BLE service and characteristic as below image.

I wanted to discover them in ble central mode. I have modified ble_hrc_c.c to validate but central not able to discover. Can anyone suggest? Also attaching code.


Hello, I have custom BLE service and characteristic as below image.

I wanted to discover them in ble central mode. I have modified ble_hrc_c.c to validate but central not able to discover. Can anyone suggest? Also attaching code.


Hi,
have custom BLE service and characteristic
I wanted to discover them in ble central mode. I have modified ble_hrc_c.c to validate but central not able to discover.
Since you are using a custom service/characteristic, I recommend taking a look at the central examples that also uses custom/vendor specific service/characteristic, e.g. the ble_app_uart_c and ble_app_blinky_c
Yes, I checked, But I am unable to make it work. I pasted my code too. I am not able to find mistakes in my code.
E.g. the type you passed to ble_db_discovery_evt_register() is wrong, it should be BLE_UUID_TYPE_VENDOR_BEGIN. Again, since you are using a custom service/characteristic, I recommend taking a look at the central examples that also uses custom/vendor specific service/characteristic, e.g. the ble_app_uart_c and ble_app_blinky_c.
I have updated but still not working. Looking into the ble_app_uart_c and ble_app_blinky_c tooo
Did you implement the BLE Peripheral as well?
Do you have a requirement for different base UUIDs in your project?
What is usually recommended is to use a 128-bit vendor specific UUID which will look something like this "4A98xxxx-1CC4-E7C1-C757-F1267DD021E8" as a “base UUID”. The four x’s represent a field where you will insert your own 16-bit IDs for your custom services and characteristics and use them just like a predefined UUID. You will have different customs UUID for each service and characteristic but only one "base UUID".
I know that but BLE Peripheral is already implemented and in production. So we can't change it
I know that but BLE Peripheral is already implemented and in production. So we can't change it
it wouldn't discover with the below code
uint32_t ble_lbs_c_init(ble_lbs_c_t * p_ble_lbs_c, ble_lbs_c_init_t * p_ble_lbs_c_init)
{
uint32_t err_code;
ble_uuid_t lbs_uuid;
ble_uuid128_t service_base_uuid = {0x4b, 0x91, 0x31, 0xc3, 0xc9, 0xc5, 0xcc, 0x8f,
0x9e, 0x45, 0xb5, 0x1f, 0x00, 0x00, 0xaf, 0x4f};
ble_uuid128_t characteristic_base_uuid = {0xa8, 0x26, 0x1b, 0x36, 0x07, 0xea, 0xf5, 0xb7,
0x88, 0x46, 0xe1, 0x36, 0x00, 0x00, 0xb5, 0xbe};
VERIFY_PARAM_NOT_NULL(p_ble_lbs_c);
VERIFY_PARAM_NOT_NULL(p_ble_lbs_c_init);
VERIFY_PARAM_NOT_NULL(p_ble_lbs_c_init->evt_handler);
p_ble_lbs_c->uuid_type = BLE_UUID_TYPE_VENDOR_BEGIN;
//err_code = sd_ble_uuid_vs_add(&lbs_base_uuid, &p_ble_lbs_c->uuid_type);
err_code = sd_ble_uuid_vs_add(&service_base_uuid, &p_ble_lbs_c->uuid_type);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
VERIFY_SUCCESS(err_code);
err_code = sd_ble_uuid_vs_add(&characteristic_base_uuid, &p_ble_lbs_c->uuid_type);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
VERIFY_SUCCESS(err_code);
lbs_uuid.type = p_ble_lbs_c->uuid_type;
lbs_uuid.uuid = LBS_UUID_SERVICE;
p_ble_lbs_c->peer_lbs_db.button_cccd_handle = BLE_GATT_HANDLE_INVALID;
p_ble_lbs_c->peer_lbs_db.button_handle = BLE_GATT_HANDLE_INVALID;
p_ble_lbs_c->peer_lbs_db.led_handle = BLE_GATT_HANDLE_INVALID;
p_ble_lbs_c->conn_handle = BLE_CONN_HANDLE_INVALID;
p_ble_lbs_c->evt_handler = p_ble_lbs_c_init->evt_handler;
return ble_db_discovery_evt_register(&lbs_uuid);
}
but when I change lbs_uuid.type to 0, I am getting NRF_ERROR_INVALID_PARAM at ble_db_discovery_start().
uint32_t ble_lbs_c_init(ble_lbs_c_t * p_ble_lbs_c, ble_lbs_c_init_t * p_ble_lbs_c_init)
{
uint32_t err_code;
ble_uuid_t lbs_uuid;
ble_uuid128_t service_base_uuid = {0x4b, 0x91, 0x31, 0xc3, 0xc9, 0xc5, 0xcc, 0x8f,
0x9e, 0x45, 0xb5, 0x1f, 0x00, 0x00, 0xaf, 0x4f};
ble_uuid128_t characteristic_base_uuid = {0xa8, 0x26, 0x1b, 0x36, 0x07, 0xea, 0xf5, 0xb7,
0x88, 0x46, 0xe1, 0x36, 0x00, 0x00, 0xb5, 0xbe};
VERIFY_PARAM_NOT_NULL(p_ble_lbs_c);
VERIFY_PARAM_NOT_NULL(p_ble_lbs_c_init);
VERIFY_PARAM_NOT_NULL(p_ble_lbs_c_init->evt_handler);
p_ble_lbs_c->uuid_type = BLE_UUID_TYPE_VENDOR_BEGIN;
//err_code = sd_ble_uuid_vs_add(&lbs_base_uuid, &p_ble_lbs_c->uuid_type);
err_code = sd_ble_uuid_vs_add(&service_base_uuid, &p_ble_lbs_c->uuid_type);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
VERIFY_SUCCESS(err_code);
err_code = sd_ble_uuid_vs_add(&characteristic_base_uuid, &p_ble_lbs_c->uuid_type);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
VERIFY_SUCCESS(err_code);
lbs_uuid.type = 0 ; //p_ble_lbs_c->uuid_type;
lbs_uuid.uuid = LBS_UUID_SERVICE;
p_ble_lbs_c->peer_lbs_db.button_cccd_handle = BLE_GATT_HANDLE_INVALID;
p_ble_lbs_c->peer_lbs_db.button_handle = BLE_GATT_HANDLE_INVALID;
p_ble_lbs_c->peer_lbs_db.led_handle = BLE_GATT_HANDLE_INVALID;
p_ble_lbs_c->conn_handle = BLE_CONN_HANDLE_INVALID;
p_ble_lbs_c->evt_handler = p_ble_lbs_c_init->evt_handler;
return ble_db_discovery_evt_register(&lbs_uuid);
}
I have 2 services. One has 3 and another got 1 characteristic. For now I just want to discover only 1 characteristic.