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

adding buttonless DFU service to my app changes the base UUID of my service in the advertisement packet

I'm advertising a custom 128bit UUID for my service.

when I added the buttonless DFU service, the UUID in the advertisement packet got mixed, I ended up with the base uuid of the buttonless dfu service and the 16bit uuid of my service.

initializing my service first in services_init() fixes the issue.

how to fix this?

Thanks.

Parents
  • Hi,

    Please post how you initialize your advertising packet. 

    I think you should check which service got the call sd_ble_uuid_vs_add() first. In particular check if your service or the buttonless service get the uuid_type = BLE_UUID_TYPE_VENDOR_BEGIN (which is the first vendor specific base UUID in the data base) after the call sd_ble_uuid_vs_add. 

  • if I initialize my service first then it works fine. doing the opposite mixes things up. my initialization is as follows.

    static ble_uuid_t m_adv_uuids[] =   /**< Universally unique service identifiers. */
    {
        {BLE_UUID_SLOG_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN},
    };
    
    
    
    static void advertising_init(void)
    {
        ret_code_t             err_code;
        ble_advertising_init_t init;
    
        memset(&init, 0, sizeof(init));
    
        init.advdata.name_type               = BLE_ADVDATA_FULL_NAME;
        init.advdata.include_appearance      = false;
        init.advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
        init.srdata.uuids_more_available.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
        init.srdata.uuids_more_available.p_uuids  = m_adv_uuids;
    
        init.config.ble_adv_fast_enabled  = true;
        init.config.ble_adv_fast_interval = APP_FAST_ADV_INTERVAL;
        init.config.ble_adv_fast_timeout  = APP_FAST_ADV_DURATION;
    
        init.config.ble_adv_slow_enabled  = true;
        init.config.ble_adv_slow_interval = APP_SLOW_ADV_INTERVAL;
        init.config.ble_adv_slow_timeout  = APP_SLOW_ADV_DURATION;
    
        init.evt_handler = on_adv_evt;
    
        err_code = ble_advertising_init(&m_advertising, &init);
        APP_ERROR_CHECK(err_code);
    
        ble_advertising_conn_cfg_tag_set(&m_advertising, APP_BLE_CONN_CFG_TAG);
    }
    

  • You may want to find out what is inside m_adv_uuids, how it's initialized. 

  • this is the definition of m_adv_uuids.

    static ble_uuid_t m_adv_uuids[] =   /**< Universally unique service identifiers. */
    {
        {BLE_UUID_SLOG_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN},
    };

    and that's the uuid for my service and it is a #define

    #define BLE_UUID_SLOG_SERVICE         0x45FB

    the issue is I'm getting the base uuid of the buttonless dfu service and my service's uuid

  • Yes, because BLE_UUID_TYPE_VENDOR_BEGIN point to the first base UUID in the database. if you initialize the DFU service first, then the first base UUID will be the DFU service . You can try 

    static ble_uuid_t m_adv_uuids[] = /**< Universally unique service identifiers. */
    {
    {BLE_UUID_SLOG_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN+1},
    };

    Then you will see your service base UUID. Just need to match the uuid_type value you get when you call sd_ble_uuid_vs_add() for your service. 

Reply
  • Yes, because BLE_UUID_TYPE_VENDOR_BEGIN point to the first base UUID in the database. if you initialize the DFU service first, then the first base UUID will be the DFU service . You can try 

    static ble_uuid_t m_adv_uuids[] = /**< Universally unique service identifiers. */
    {
    {BLE_UUID_SLOG_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN+1},
    };

    Then you will see your service base UUID. Just need to match the uuid_type value you get when you call sd_ble_uuid_vs_add() for your service. 

Children
No Data
Related