Ask about time out of advertising duration of slow advertising

Hi Nordic support team

- I am using "nRF5_SDK_17.0.2_d674dde"
- Refer to "ble_app_hids_keyboard" example.

I want to ask about slow advertising time out. I want assign 30 minutes for slow advertising.

Todo that I define:

           #define APP_ADV_SLOW_DURATION 180000ul

And assign in my code: 

          init.config.ble_adv_slow_timeout = APP_ADV_SLOW_DURATION;

          err_code = ble_advertising_init(&m_advertising, &init);

==>>But it seem slow advertising only happen in 65535*10(ms) = 655.35(s) ~ 10 minutes

In the define for "ble_adv_modes_config_t" I see that:

- ble_adv_slow_timeout is uint32_t
- ble_adv_fast_timeoutis is uint32_t

I check and test many time and see that it now access with uint16_t, it's mean value not bigger than 65535.


typedef struct
{
    bool     ble_adv_on_disconnect_disabled;     /**< Enable or disable automatic return to advertising upon disconnecting.*/
    bool     ble_adv_whitelist_enabled;          /**< Enable or disable use of the whitelist. */
    bool     ble_adv_directed_high_duty_enabled; /**< Enable or disable high duty direct advertising mode. Can not be used together with extended advertising. */
    bool     ble_adv_directed_enabled;           /**< Enable or disable direct advertising mode. */
    bool     ble_adv_fast_enabled;               /**< Enable or disable fast advertising mode. */
    bool     ble_adv_slow_enabled;               /**< Enable or disable slow advertising mode. */
    uint32_t ble_adv_directed_interval;          /**< Advertising interval for directed advertising. */
    uint32_t ble_adv_directed_timeout;           /**< Time-out (number of tries) for direct advertising. */
    uint32_t ble_adv_fast_interval;              /**< Advertising interval for fast advertising. */
    uint32_t ble_adv_fast_timeout;               /**< Time-out (in units of 10ms) for fast advertising. */
    uint32_t ble_adv_slow_interval;              /**< Advertising interval for slow advertising. */
    uint32_t ble_adv_slow_timeout;               /**< Time-out (in units of 10ms) for slow advertising. */
    bool     ble_adv_extended_enabled;           /**< Enable or disable extended advertising. */
    uint32_t ble_adv_secondary_phy;              /**< PHY for the secondary (extended) advertising @ref BLE_GAP_PHYS (BLE_GAP_PHY_1MBPS, BLE_GAP_PHY_2MBPS or BLE_GAP_PHY_CODED). */
    uint32_t ble_adv_primary_phy;                /**< PHY for the primary advertising. @ref BLE_GAP_PHYS (BLE_GAP_PHY_1MBPS, BLE_GAP_PHY_2MBPS or BLE_GAP_PHY_CODED). */
} ble_adv_modes_config_t;

Can you explain and suggest me how to assign 30 minutes for slow advertising??
Can I assign uint32_t for "ble_adv_slow_timeout"??


thanks s lot.
Parents
  • Hello,

    Since the timeout value is only a uint16_t, you can't set 30 minutes of timeout directly. I have two suggestions:

    1: Set the timeout to 0 (basically meaning advertise forever). Then you can set an app_timer to expire after 30 minutes. Use the interrupt from this timer to stop the advertising manually using sd_ble_gap_adv_stop().

    2: You can set the timeout to 10 minutes, but you can use the application logic to restart the advertising for another 10 minutes two times, giving you a total of 30 minutes. This will not be noticeable from the scanners. This is probably the easiest option.

    Best regards,

    Edvin

Reply
  • Hello,

    Since the timeout value is only a uint16_t, you can't set 30 minutes of timeout directly. I have two suggestions:

    1: Set the timeout to 0 (basically meaning advertise forever). Then you can set an app_timer to expire after 30 minutes. Use the interrupt from this timer to stop the advertising manually using sd_ble_gap_adv_stop().

    2: You can set the timeout to 10 minutes, but you can use the application logic to restart the advertising for another 10 minutes two times, giving you a total of 30 minutes. This will not be noticeable from the scanners. This is probably the easiest option.

    Best regards,

    Edvin

Children
Related