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.

connectable and non-connectable advertising

Other Parts Discussed in Thread: CC2640

hi

Does a simple BLE peripheral can be connected and still send a 'non-connectable advertising'?

When the peripheral is not connected, it will send the 'connectable advertising' as before the connectionn started

Thanks

  • Hello Asher,

    Yes, the BLE peripheral can send non-connectable ADV after forming a connection; this is supported with the PLUS_BROADCASTER build option in the simpleBLEPeripheral sample application.

    Best wishes
  • Hi

    Thanks for the quick answer, 

    But, I already defined PLUS_BROADCASTER and nothing changed, it still not sending any thing

    The code added is mainly:

    in  case GAPROLE_CONNECTED:

    #ifdef PLUS_BROADCASTER
    // Only turn advertising on for this state when we first connect
    // otherwise, when we go from connected_advertising back to this state
    // we will be turning advertising back on.
    if (firstConnFlag == false)
    {
    uint8_t advertEnabled = FALSE; // Turn on Advertising

    // Disable connectable advertising.
    GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t),
    &advertEnabled);

    // Set to true for non-connectabel advertising.
    advertEnabled = TRUE;

    // Enable non-connectable advertising.
    GAPRole_SetParameter(GAPROLE_ADV_NONCONN_ENABLED, sizeof(uint8_t),
    &advertEnabled);
    firstConnFlag = true;
    }
    #endif // PLUS_BROADCASTER

    AND

    #ifdef PLUS_BROADCASTER
    /* After a connection is dropped a device in PLUS_BROADCASTER will continue
    * sending non-connectable advertisements and shall sending this change of
    * state to the application. These are then disabled here so that sending
    * connectable advertisements can resume.
    */
    case GAPROLE_ADVERTISING_NONCONN:
    {

    uint8_t advertEnabled = FALSE;

    // Disable non-connectable advertising.
    GAPRole_SetParameter(GAPROLE_ADV_NONCONN_ENABLED, sizeof(uint8_t),
    &advertEnabled);

    advertEnabled = TRUE;

    // Enabled connectable advertising.
    GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t),
    &advertEnabled);

    // Reset flag for next connection.
    firstConnFlag = false;

    SimpleBLEPeripheral_freeAttRsp(bleNotConnected);

    }
    break;
    #endif //PLUS_BROADCASTER

    Although the code set the GAPROLE_ADV_NONCONN_ENABLED to TRUE, the code do advertise anything while connected, and the code never reach the case GAPROLE_ADVERTISING_NONCONN - is something missing?

    BTW - I'm working on CC2640

    Thanks

    Asher

  • Thanks

    I already added the following code:

    #ifdef PLUS_BROADCASTER
    /* After a connection is dropped a device in PLUS_BROADCASTER will continue
    * sending non-connectable advertisements and shall sending this change of
    * state to the application. These are then disabled here so that sending
    * connectable advertisements can resume.
    */
    case GAPROLE_ADVERTISING_NONCONN:
    {

    uint8_t advertEnabled = FALSE;

    // Disable non-connectable advertising.
    GAPRole_SetParameter(GAPROLE_ADV_NONCONN_ENABLED, sizeof(uint8_t),
    &advertEnabled);

    advertEnabled = TRUE;

    // Enabled connectable advertising.
    GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t),
    &advertEnabled);

    // Reset flag for next connection.
    firstConnFlag = false;

    SimpleBLEPeripheral_freeAttRsp(bleNotConnected);

    }
    break;
    #endif //PLUS_BROADCASTER
    AND

    in the case GAPROLE_CONNECTED: also :

    #ifdef PLUS_BROADCASTER
    // Only turn advertising on for this state when we first connect
    // otherwise, when we go from connected_advertising back to this state
    // we will be turning advertising back on.
    if (firstConnFlag == false)
    {
    uint8_t advertEnabled = FALSE; // Turn on Advertising

    // Disable connectable advertising.
    GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t),
    &advertEnabled);

    // Set to true for non-connectabel advertising.
    advertEnabled = TRUE;

    // Enable non-connectable advertising.
    GAPRole_SetParameter(GAPROLE_ADV_NONCONN_ENABLED, sizeof(uint8_t),
    &advertEnabled);
    firstConnFlag = true;
    }
    #endif // PLUS_BROADCASTER

    - still not advertising in non-connactable

    Any suggestions?

    Thanks
  • Are you using simpleBLEPeripheral? Or are you just adding the code into a different project?
  • Hi

    Yes, I'm using simpleBLEPeripheral.

    The code above is from this project, the PLUS_BROADCASTER didn't solve me the problem,  GAPROLE_ADV_NONCONN_ENABLED=true OR GAPROLE_ADVERT_ENABLED = true , didn't help me to advertise while the peripheral is connected

    Thanks

    Asher

  • Did you check it with packet sniffer? If yes, can you post the log?
  • Hi

    Yes I'm working with packet sniffer,

    I found the problem

    I was filtering only with AA1= field, when I added the AA3= field - I saw the non-connectable messages

    Thank you all, for helping

    Asher