This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Discovering Different UUID base of service and characteristics from BLE Central

Hi, I want to discover Different UUID base of service and characteristics from BLE Central. First I used ble_app_blinky example and it worked fine.  Next, I modified  BUTTON_CHAR and added new base with sd_ble_uuid_vs_add but central is not able to discover peripheral.

Update peripheral characteristics 

Also attaching BLE Central code

drive.google.com/.../view

Parents
  • Hi,

    Did you add this new base UUID with sd_ble_uuid_vs_add() on the GATT client as well? Your attachment only included main.c and your project files, not the service implementation.

  • Yes 

    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 =  {SERVICE_UUID_BASE};
        ble_uuid128_t   char_base_uuid =  {CHAR_UUID_BASE};                      
    
        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(&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(&char_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 = BOLT_UUID_SERVICE;
    
        p_ble_lbs_c->peer_lbs_db.house_keeping_cccd_handle = BLE_GATT_HANDLE_INVALID;
        p_ble_lbs_c->peer_lbs_db.house_keeping_handle      = BLE_GATT_HANDLE_INVALID;
        p_ble_lbs_c->peer_lbs_db.control_commands_handle   = BLE_GATT_HANDLE_INVALID;
        p_ble_lbs_c->peer_lbs_db.firmware_metadata_handle = BLE_GATT_HANDLE_INVALID;
        p_ble_lbs_c->peer_lbs_db.charger_log_cccd_handle   = BLE_GATT_HANDLE_INVALID;
        p_ble_lbs_c->peer_lbs_db.charger_log_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);
    }

  • Note that the 2nd argument to sd_ble_uuid_vs_add() is an in/out argument. So lbs_uuid.type is really referencing the base UUID of your characteristic rather than the base UUID for your 'BOLT_UUID_SERVICE'.

Reply Children
Related