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

Peripheral device: Keep advertising during connection

Hi ,

The device required to keep advertising during the connection established.

It is human interface device which mean it is peripheral device as well.

I would like to know whether there is any sample I could take as reference for the structure.

Or it is possible to keep the keyboard_sample for development? If yes, which API or function I should integrate?

In further, I would like to know is it possible to proceed connectable advertisement.

Currently, I just understand that is possible to do non-connectable advertisement.

Thanks.

Parents Reply Children
  • Hi Sigurd, 

    May I know could it support connectable advertisement? I know it might interrupt the connection with first central.

    So the next question is "Is it possible to connect with 2 centrals at the same time?"

    (The development is based on SDK15.2)

    Thanks.

  • CY said:
    May I know could it support connectable advertisement?

     Yes, that is supported. You can have 20 concurrent connections.

    CY said:
    So the next question is "Is it possible to connect with 2 centrals at the same time?"

    Yes, you do connectable advertising and device #1 connects. After device #1 connects, you start connectable advertising again, and device #2 connects.

  • Hi Sigurd,

    I have viewed the sample and found that it doesn't use peer manager.

    However, the peer manager, whitelist and bond are used in keyboard sample.

    Thus, I would like to know if I remove the function will it cause any effect to the HID service?

    Besides that, I also found out the structure of advertising_init (on_adv_evt) and advertising_start is different from keyboard and multi-peripheral sample.

    Could you give me some guide, which parts are necessary to add in the keyboard sample to support multi-peripheral sample?

    Thanks.

  • Is it possible to proceed the different service for each host? 

    For instance, run HID service with host A and run HRS service with host B at the same time?

  • CY said:
    Thus, I would like to know if I remove the function will it cause any effect to the HID service?

     You should keep the Peer Manager if you are developing a HID keyboard.

    CY said:
    Could you give me some guide, which parts are necessary to add in the keyboard sample to support multi-peripheral sample?

    I don't have a guide for this, but start by setting NRF_SDH_BLE_PERIPHERAL_LINK_COUNT and NRF_SDH_BLE_TOTAL_LINK_COUNT in sdk_config.h to 2. You should then replace:

    NRF_BLE_QWR_DEF(m_qwr);                                             /**< Context for the Queued Write module.*/

    with

    NRF_BLE_QWRS_DEF(m_qwr, NRF_SDH_BLE_TOTAL_LINK_COUNT);                          /**< Context for the Queued Write module.*/

     in qwr_init(), replace

    err_code = nrf_ble_qwr_init(&m_qwr, &qwr_init_obj);

    with

        for (uint32_t i = 0; i < NRF_SDH_BLE_TOTAL_LINK_COUNT; i++)
        {
            err_code = nrf_ble_qwr_init(&m_qwr[i], &qwr_init_obj);
            APP_ERROR_CHECK(err_code);
        }

    Add the ble_conn_state Connection state module, and call 

    ble_conn_state_init(); in your service init code.
    Add the on_connected() and on_disconnected() functions found in  ble_app_multiperipheral to your keyboard project.
    CY said:
    For instance, run HID service with host A and run HRS service with host B at the same time?
    Yes, it's possible. But note that the service attribute table is shared, so a master/central has potentially access to both services.
Related