This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Use of the Whitelist

Other Parts Discussed in Thread: CC2650

I posted this before but got no reply. As this is a high profile project for a major car manufacturer and this is the last task to do, I contacted TI support but their reply was to post here again. So I am trying again.

I need to be able to press a button which enables connection to any advertising unit for 30 seconds (ie ignores whitelist) then after the 30 seconds, adds all connected unit addresses to the whitelist so in normal usage only these devices can connect.

I cant find any documentation on how to construct the whitelist. Searching for this term does not appear at all in the software developers guide and the API guide does not help either. How can I add all connected devices to the whitelist and store in NV? I did find gapBondMgr_SyncWhiteList() but this does not seem to work. This calls HCI_LE_AddWhiteListCmd which there is no documentation or source I can find.

Where can I find out how to do this?

  • Hi Andy,

    The easiest for you, I think, would be to look at the HIDAdvRemote project to see how the whitelist is modified and/or synced.

    For example in hiddev.c, hidDevLowAdvertising(), hidDevInitialAdvertising()

    You will find that after a bond has happened, and if autosync_wl is enabled, the whitelist is updated using the bonded device addresses.

    GAPBondMgr_SetParameter( GAPBOND_AUTO_SYNC_WL, sizeof( uint8 ), &syncWL );

    Best regards,
    Aslak 

  • Thanks.

    This example does not appear to use the whitelist as far as I can tell although the parameter you mentioned above is set. But I might be able to use the method it uses if I can expand it to allow 2 slaves rather than one.

    When the "clear" button is pressed all bonding info is cleared. When the "initial scan" button is pressed, a scan is done in the usual way using GAPCentralRole_StartDiscovery. This results in a bond being stored. So far so good.

    Then, according to the documentation, "If a HID Dongle and Advanced Remote previously paired and stored bonding data, then the HID Dongle will continuously scan for this specific Advanced Remote".

    I dont understand from the code, how it does this. What causes it to scan for only the previously bonded device?

  • The HIDAdvRemote project was a great help in the end.

    It seems to be the case (correct me if I am wrong) that once an EstablishLink request is issued, if the peer device is not advertising, the request will wait for ever until it starts to advertise, then it will connect. At least thats the way it seems to work once the peer device has at some previous time been discovered and bonded.

    I need to expand this to be able to connect to 2 devices but this should be possible.

  • See also the RunningSensor example project
  • The whitelist is no longer supported by iOS and Android 5.0 (Lollipop). Reference this thread: e2e.ti.com/.../1428335
  • Hello Guys,

    Sorry i'm asking u a question after a long time but i need to know that
    By following HID Dev method i am able to Auto Sync the white list.
    Firstly it advertise to all the devices and if get connected to one device then after disconnecting from that devices its not even getting scanned by that device also.
    Can u help me out in this???

    Thanks
  • Hi Pradeep,

    You don't mention what device you are connecting to, but it seems probable that you are connecting to a device that uses Private Resolvable Address.

    Before what's called Privacy 1.2 (BLE SDK 2.2) such a Central device can't successfully re-connect to a device that uses the hardware whitelist feature, because that WL-address is static/constant but the Central address changes every X minutes.

    However, you can avoid this by *not* using autosync-WL, but instead implement the WL-feature in software.

    case GAPROLE_CONNECTED: 
    {         
      //.... 
    
      //resolve address 
      uint8  resolv_addr[B_ADDR_LEN]; 
      uint16 conn_handle; 
      uint8  bond_count; 
    
      // check for an existing bond, value of zero indicates no stored bonds in NV 
      GAPBondMgr_GetParameter(GAPBOND_BOND_COUNT, &bond_count); 
      if (bond_count && g_ShouldOnlyAllowKnownDevices) 
      { 
        // we have at least one stored bond. resolve the address before proceeding with the connection 
        GAPRole_GetParameter(GAPROLE_CONNHANDLE, &conn_handle);  //get connection handle 
        linkDBItem_t *link = linkDB_Find( conn_handle );  //find link database entry 
        if (link) 
        { 
          uint8 idx = GAPBondMgr_ResolveAddr( link->addrType, link->addr, resolv_addr );  //find bond mgr index 
          if (idx != GAP_BONDINGS_MAX) //if address found in bond manager 
          { 
            asm("NOP");  //continue with connection, schedule connection param update request if needed 
          } 
          } 
          else 
          { 
            GAPRole_TerminateConnection();//disconnect, does not match any bonded address in NV 
          } 
        } 
      } 
    } 
    break; 
    

    The above is a sort of recipe for how to make a software whitelist, based on the bonding table. This event will occur before the first connection event, and so you will not allow an unauthorized Central device to connect. Except if you set the global variable g_ShouldOnlyAllowKnownDevices to TRUE because you have decided to allow some new device to connect by some means like a button press.

    Best regards,
    Aslak

  • Hey Aslak,

    Thank you very much for the reply.
    Actually i am using cc2650 Devices only which have a Fix Address.
    So the case is that when i first connect the two devices its happening perfectly but after that devices doesn't get searched.
    I tried with android f[phone same case was there also.
    In case of I-phone which use PRA its getting connected first time and after disconnection it is discover able but not connectable.

    Thanks
  • That sounds strange. It should at the very least be discoverable, even with whitelist. What type of advertisement do you send out after the first connection? Directed? Un-directed? You could use a sniffer to verify.
    BR,
    Aslak
  • static void HidDev_highAdvertising(void)
    {
      uint8_t param;
    
    
      VOID GAP_SetParamValue(TGAP_LIM_DISC_ADV_INT_MIN, HID_HIGH_ADV_INT_MIN);
        VOID GAP_SetParamValue(TGAP_LIM_DISC_ADV_INT_MAX, HID_HIGH_ADV_INT_MAX);
        VOID GAP_SetParamValue(TGAP_LIM_ADV_TIMEOUT, HID_HIGH_ADV_TIMEOUT);
    
    
    
      // Setup advertising filter policy first.
        param = GAP_FILTER_POLICY_WHITE;
      VOID GAPRole_SetParameter(GAPROLE_ADV_FILTER_POLICY, sizeof(uint8_t), &param);
    
      param = TRUE;
      VOID GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t), &param);
    }
    
    
    

    and Using this when adversting:

     case GAPROLE_ADVERTISING:
          Display_print0(dispHandle, 2, 0, "Advertising");
          if (HidDev_bondCount() > 0)
              {
                // Start high duty cycle advertising.
                HidDev_highAdvertising();
              }
              // Else not bonded.
              else
              {
                // Start initial advertising.
                HidDev_initialAdvertising();
              }
    
          break;

    Hey Aslak,

    I am using the method of HID Dev

  • Hey Aslak,

    The Method you had suggested i tried using that but its showing an error.
    linkDB_Find Undefined Symbol.

    Can u please guide me how to remove this error.
    I found it in linkdb.h file but this error is getting over.

    Thanks
  • Hi Pradeep,

    Sorry for the long delay, I have been away. You don't need to use the LinkDB api, you can also use GAPRole_GetParameter(..) to get these values. The code snippet was made for BLE 1.4.x where the linkdb api was available to the application. Sorry for any inconvenience.

    Best regards,
    Aslak

  • Hey Aslak,

    Thanks for the Update.
    i had already solved that error. i used PRA method to read the Bluetooth address and save it in white list.
    Now i need to save multiple address How to do that?
    Using Multirole code and need to add three devices in white list?
    Method i used:
    Scan for all the devices and connect to available device. Now i need to connect to second device how to do so?
    is bonding work? As i can see bonding is not there in multi role.
  • Hi,

    I'm not sure what you mean - but if you add the PRA to the whitelist it will stop working after ~15 min when the device with the random address changes this address.

    If you want to connect to more devices, as a central, you can simply scan and connect as usual. When scanning/establishing, one of the parameters is wheter to use WL for scan/establish. You should be able to connect to several as a slave as well, but you must then disable whitelist or use the software whitelist outlined in the previous post.

    You are right that for master+slave there are some issues that makes the bond manager not work correctly in the current version.

    Best regards,
    Aslak
  • Hey Aslak,

    this is what i had done.

     uint8 idx;
              GAPRole_GetParameter(GAPROLE_CONN_BD_ADDR,&resolv_addr1,NULL);
               idx = GAPBondMgr_ResolveAddr( pEvent->deviceInfo.addrType, pEvent->linkCmpl.devAddr, resolv_addr1 );
             if(resolv_addr1[0]!=0x00 && resolv_addr1[1]!=0x00 && resolv_addr1[2]!=0x00 && resolv_addr1[3]!=0x00 && resolv_addr1[4]!=0x00 && resolv_addr1[5]!=0x00)
             {
            GAPRole_GetParameter(GAPROLE_CONN_BD_ADDR,&resolv_addr2,NULL);
            idx = GAPBondMgr_ResolveAddr( pEvent->deviceInfo.addrType, pEvent->linkCmpl.devAddr, resolv_addr2 );
    }


    Here the problem is both the resolved address are showing same data.
    Can u guide me how to clear the data of previous address and add the second one. or i need to change the approach for second device address??

    Thanks and Reagrds

  • Hi Pradeep,

    It looks like you moved the code to peripheral.c where the pEvent gives you the necessary information.

    You don't need to get the address - there is no point in this. What you achieve by calling

    uint8  resolv_addr[B_ADDR_LEN];
    uint8 idx = GAPBondMgr_ResolveAddr( addrType, addr, resolv_addr );
    if (idx != GAP_BONDINGS_MAX) { Ok } else { not known }

    is simply that the resolveAddr will find out for you if it can resolve the connected address. If it can, then this device is known to you, that is, you are bonded already. You do not need to use resolv_addr for anything, it's just a byproduct in this case.

    Best regards,
    Aslak

  • Hi Aslak,

    What i am trying to do here is after getting the bluetooth address i am saving that address into the whitelist as autosync whitelist function is not working in the multiRole code.
    By resolve addr i am able to read the connected address properly and can store it into whitelist.
    Any suggestion from ypur side to improve this concept will be appricaited.
    Thanks and Regards