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

Broadcaster mode

Hello,

I want to use broadcaster mode for nrf51822, could you tell me please what I must to do to use this mode?

I suppose I must to set BLE_GAP_ADV_TYPE_ADV_NONCONN_IND mode, configure 'interval'(as I read in specification it must be greater than 100ms), to set only 'BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED' flag, setup advertise data and call sd_ble_gap_adv_start(). Is it true?

And may be you have any demo project?

Best Regards, Artem Zemlyanukhin

  • Actually, it is per the Bluetooth spec not legal to advertise so called service data with a custom UUID, so creating a custom service and advertise like that wouldn't work.

    I have however extended my answer above a little, so that you can see how you can use the manufacturer specific data field.

  • why not use this method sd_ble_gap_adv_data_set(uint8_t const * const p_data, uint8_t dlen, uint8_t const * const p_sr_data, uint8_t srdlen)? /**@brief Set, clear or update advertisement and scan response data. *

    • @note The format of the advertisement data will be checked by this call to ensure interoperability.
    •   Limitations imposed by this API call to the data provided include having a flags data type in the scan response data and
      
    •   duplicating the local name in the advertisement data and scan response data. 
      
    • @note: To clear the advertisement data and set it to a 0-length packet, simply provide a valid pointer (p_data/p_sr_data) with its corresponding
    •    length (dlen/srdlen) set to 0.
      
    • @note: The call will fail if p_data and p_sr_data are both NULL since this would have no effect.
    • @param[in] p_data Raw data to be placed in advertisement packet. If NULL, no changes are made to the current advertisement packet data.
    • @param[in] dlen Data length for p_data. Max size: @ref BLE_GAP_ADV_MAX_SIZE octets. Should be 0 if p_data is NULL, can be 0 if p_data is not NULL.
    • @param[in] p_sr_data Raw data to be placed in scan response packet. If NULL, no changes are made to the current scan response packet data.
    • @param[in] srdlen Data length for p_sr_data. Max size: @ref BLE_GAP_ADV_MAX_SIZE octets. Should be 0 if p_sr_data is NULL, can be 0 if p_data is not NULL.
    • @return @ref NRF_SUCCESS Advertisement data successfully updated or cleared.
    • @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
    • @return @ref NRF_ERROR_INVALID_FLAGS Invalid combination of advertising flags supplied.
    • @return @ref NRF_ERROR_INVALID_DATA Invalid data type(s) supplied, check the advertising data format specification.
    • @return @ref NRF_ERROR_INVALID_LENGTH Invalid data length(s) supplied.
    • @return @ref BLE_ERROR_GAP_UUID_LIST_MISMATCH Invalid UUID list supplied.
    • @return @ref NRF_ERROR_BUSY The stack is busy, process pending events and retry. */ SVCALL(SD_BLE_GAP_ADV_DATA_SET, uint32_t, sd_ble_gap_adv_data_set(uint8_t const * const p_data, uint8_t dlen, uint8_t const * const p_sr_data, uint8_t srdlen));
  • As you can see by looking at the code in ble_advdata.c, the function you've found is the one that will eventually be called, but only after all the data has been encoded appropriately. If you want to use sd_ble_gap_adv_data_set() directly, you'll have to do this encoding yourself, which is quite cumbersome and not something I'd recommend.

  • Would it be possible to renew the link to the example zip file. I am really interested in developing a similar application. Since I am a total beginner it would be very useful for me to start with something working.

    Thank you.

Related