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

Bond to iOS

Hi

I've been able to include Device Manager to bond my peripheral to Master Control Panel, but testing with LightBlue runnining on an iOS 8 iPadI'm having several weird issues.

Everything is apparently correct, until I power off my peripheral or disconnect and reconnect the iPad. Looks that the connection context is not found on the table of previously bonded peripherals. In order to debug the problem, I've included several traces in device_manager_peripheral.c. What I'm detecting is these two issues:

  1. The iPad address is changing: When connecting to my peripheral, sometimes the Bluetooth address changes. This could be a problem to look into the table of previously bonded peripheral.

  2. The Bluetooth address I save into the bond table is different to the Bluetooth address. Example: When connecting the iPad to my peripheral, I look into the bond table for address 76 173 40 225 245 77. But when linking (or bonding), the address I save into the bond address is 120 130 205 114 224 60. I made the bond procedure in LightBlue by trying to read or write a encrypted characteristic (BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM).

These two problems don't happen in Android or Master Control Panel. So, what's the problem? What's makes iOS so special? Any suggestion??? :-(

Thanks in advance.

Cheers,

Elena

Update: Tags update

Parents
  • Hi again

    I've been able to fix the problem by using a WhiteList in the advertising as explained in this thread.

    Thanks for your help

    Elena

    UPDATE: Now, I've been able to fix the problem and it is working correctly in iOS and Master Control Panel, but not in Android. In other words: from iOS and Master Control Panel, I'm able to see the device advertising, and I'm able to connect to it. Even more, the connection context is correctly loaded when connecting a previous bonded device (iOS or Master Control Panel). The problem is that now, when using the WhiteList, I can't see the device advertising from Android. Why???

    I've been using the following WhiteList configuration:

        adv_params.fp          = BLE_GAP_ADV_FP_FILTER_SCANREQ;
        adv_params.p_whitelist = &whitelist;
        BLE_APP_AdvertisingInit(BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED);
    

    So, the complete code of AdvertisingStart is:

    void BLE_APP_AdvertisingStart( void )
    {
    uint32_t             err_code;
    ble_gap_adv_params_t adv_params;
    
    ble_gap_whitelist_t  whitelist;
    ble_gap_addr_t       * p_whitelist_addr[BLE_GAP_WHITELIST_ADDR_MAX_COUNT];
    ble_gap_irk_t        * p_whitelist_irk[BLE_GAP_WHITELIST_IRK_MAX_COUNT];
    
    /* Start advertising */
    memset(&adv_params, 0, sizeof(adv_params));
    
    adv_params.type        = BLE_GAP_ADV_TYPE_ADV_IND;
    adv_params.p_peer_addr = NULL;
    adv_params.fp          = BLE_GAP_ADV_FP_ANY;
    adv_params.interval    = BLE_APP_ADV_INTERVAL;
    adv_params.timeout     = BLE_APP_ADV_TIMEOUT_IN_SECONDS;
    
    whitelist.addr_count = BLE_GAP_WHITELIST_ADDR_MAX_COUNT;
    whitelist.irk_count  = BLE_GAP_WHITELIST_IRK_MAX_COUNT;
    whitelist.pp_addrs   = p_whitelist_addr;
    whitelist.pp_irks    = p_whitelist_irk;
    
    
    err_code = dm_whitelist_create(&m_app_handle, &whitelist);
    APP_ERROR_CHECK(err_code);
    
    if ((whitelist.addr_count != 0) || (whitelist.irk_count != 0))
    {
        adv_params.fp          = BLE_GAP_ADV_FP_FILTER_SCANREQ;
        adv_params.p_whitelist = &whitelist;
        BLE_APP_AdvertisingInit(BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED);
    }
    else
    {
        adv_params.fp          = BLE_GAP_ADV_FP_ANY;
        adv_params.p_whitelist = NULL;
        BLE_APP_AdvertisingInit(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
    }
    
    err_code = sd_ble_gap_adv_start(&adv_params);
    APP_ERROR_CHECK(err_code);
    }
    

    Any suggestion??? :-(

    UPDATE: As you can see in the comments below, Nikita mentioned this thread where it is mentioned the iOS bonding problem, and a patched version of device_manager_peripheral.c where the bug is fixed.

  • Sorry. You're right. I will review right now the description of my issue to be more accurate. Thanks for your interest.

Reply Children
No Data
Related