This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how to discover 16bit uuid?

Hi. i'm using nRF52832, SDK13.0.0. I'm developing Central, Peripheral both.

If peripheral just has 16bit UUID. It doesn't contain base UUID. Or if i don't know what peripheral's UUID is, how can I discover it?

My central source code has to know 128bit UUID as below.

{ ...... ble_uuid128_t lbs_base_uuid = {??????? --> how can I define????};

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->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;

err_code = sd_ble_uuid_vs_add(&lbs_base_uuid, &p_ble_lbs_c->uuid_type);
if (err_code != NRF_SUCCESS)
{
    return err_code;
}
VERIFY_SUCCESS(err_code);

......

}

How can I discover UUID which i don't know or just 16bits?

I need your help.

  • Values are as below.

    GATT Primary service : 59fe Characteristics 1 : 50eada308883b89f604f15f30200c98e Characteristics 2 : 50eada308883b89f604f15f30100c98e

  • Well see components\softdevice\s132\headers\ble_types.h file:

    /** @brief Set .type and .uuid fields of ble_uuid_struct to specified UUID value. */
    #define BLE_UUID_BLE_ASSIGN(instance, value) do {\
                instance.type = BLE_UUID_TYPE_BLE; \
                instance.uuid = value;} while(0)
    

    As I've tried to explain: Nordic stack internally always represents UUID as pair of 16-bit short string + reference to one of provisioned 128-bit UUID bases. In BLE if there is only 16-bit BLE transferred it means that it sits on BT SIG default UUID base. What is the problem now? If you don't like it an you want to change the base to some proprietary then simply use sd_ble_uuid_vs_add function first and then use returned index to new base in ble_uuid_struct.

  • Thank you very much. I totally understand what you mean.

    The problem is "my central gets error message after discover service". It always returns

    p_evt->evt_type=BLE_DB_DISCOVERY_SRV_NOT_FOUND, p_evt->params.discovered_db.srv_uuid.uuid=0xfe59, p_evt->params.discovered_db.srv_uuid.type=2.

    That's why i'm stuck in there while I make central application for DFU using nRF52832. I need your help.

  • So why you don't look for Service with UUID = 0x59FE and then Characteristics with long UUID under it? Or if you don't like short UUID why you don't change sequence in your code and first provision proprietary base, then use it to build Service UUID and then call sd_ble_gatts_service_add?

  • This p_evt->params.discovered_db.srv_uuid.type=2 is returned by discovery module like real UUID discovered during GATT Service discovery? Or that's what are you looking for (which would explain the error = if you use different type then obviously they don't match)?

Related