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.

CC2564MODA: How to enable the limited discoverable advertisement in bluetopia stack?

Part Number: CC2564MODA

Hello,

In my application , i want my BLE device to start advertisement on button press for 20 seconds, and if remote device doesn't connect in that 20 seconds then stops advertisement.

"

As per BLUETOOTH SPECIFICATION Version 4.0 [Vol 3], section 9.3.2.3, i can make this happen by setting "LE Limited Discoverable Mode" in Flags AD type as defined in Section 11.1.3 and with this

Devices shall remain in the limited discoverable mode no longer than TGAP(lim_adv_timeout) which is 

TGAP(lim_adv_timeout) - 30.72 s Maximum time to remain advertising when in the limited discoverable mode - Required value 

As per BLUETOOTH SPECIFICATION Version 4.0 [Vol 3] Table 16.1: Defined GAP timers

"

In order to achieve this, which API i need to use which allows me to 

(1) Set "LE Limited Discoverable Mode" flags and Clear " LE General Discoverable Mode" in advertisement flags

(2) Configure the TGAP(lim_adv_timeout) value as per application requirement.

Also does stacks provide any callback events when TGAP(lim_adv_timeout)  is completed and connection has not happened with remote device.

Regards,

khodidas

  • Khodidas,

    khodidas ghinaiya said:

    In order to achieve this, which API i need to use which allows me to 

    (1) Set "LE Limited Discoverable Mode" flags and Clear " LE General Discoverable Mode" in advertisement flags

    The GAP_LE_Set_Advertising_Data() API of the TI dual-mode Bluetooth stack is used for this. Please refer to the AdvertiseLE command of any of the BLE/dual-mode sample applications in the stack SDK (i.e. SPPLEDemo)

    ...
                else
                {
                   if(LE_Parameters.DiscoverabilityMode == dmLimitedDiscoverableMode)
                      Advertisement_Data_Buffer.AdvertisingData.Advertising_Data[2] = HCI_LE_ADVERTISING_FLAGS_LIMITED_DISCOVERABLE_MODE_FLAGS_BIT_MASK;
                }
    
                /* Write thee advertising data to the chip.                 */
                ret_val = GAP_LE_Set_Advertising_Data(BluetoothStackID, (Advertisement_Data_Buffer.AdvertisingData.Advertising_Data[0] + 1), &(Advertisement_Data_Buffer.AdvertisingData));
    ...

     

    khodidas ghinaiya said:

    (2) Configure the TGAP(lim_adv_timeout) value as per application requirement.

    Also does stacks provide any callback events when TGAP(lim_adv_timeout)  is completed and connection has not happened with remote device.

    The stack does not run a timer for the limited advertising. This is something you need to handle in the application layer. For example, you can set up an application layer timer when starting the limited advertisement and stop the advertisement using the GAP_LE_Advertising_Disable() API when the timer runs out and the LEContextInfo does not indicate any active connection.

    Best regards,

    Vihang