TI BLE: Advertisement

 #define GAPROLE_ADVERT_ENABLED 0x305 //!< Enable/Disable Advertising. Read/Write. Size is uint8. Default is TRUE=Enabled.
#define GAPROLE_ADVERT_OFF_TIME 0x306 //!< Advertising Off Time for Limited advertisements (in milliseconds). Read/Write. Size is uint16. Default is 30 seconds.

    GAPROLE_ADVERT_OFF_TIME—表示外设关闭广播持续时间,该值为零表示无限期关闭广播直到下一次广播使能信号到来。

GAPROLE_ADVERT_OFF_TIME – This parameter is used when the device is put into limited discoverable mode. It sets how long the device should wait before becoming discoverable again at the end of the limited discovery period. By setting this value to 0, the device will not become discoverable again until the GAPROLE_ADVERT_ENABLED is set back to TRUE.

上面来自TI论坛

 

#if defined( CC2540_MINIDK )
// For the CC2540DK-MINI keyfob, device doesn't start advertising until button is pressed
uint8 initial_advertising_enable = FALSE;
#else
// For other hardware platforms, device starts advertising upon initialization
uint8 initial_advertising_enable = TRUE;
#endif

// By setting this to zero, the device will go into the waiting state after
// being discoverable for 30.72 second, and will not being advertising again
// until the enabler is set back to TRUE
uint16 gapRole_AdvertOffTime = 0;

 

1   // Set advertising interval
2   {
3     uint16 advInt = DEFAULT_ADVERTISING_INTERVAL;  //100ms
4 
5     GAP_SetParamValue( TGAP_LIM_DISC_ADV_INT_MIN, advInt );
6     GAP_SetParamValue( TGAP_LIM_DISC_ADV_INT_MAX, advInt );
7     GAP_SetParamValue( TGAP_GEN_DISC_ADV_INT_MIN, advInt );
8     GAP_SetParamValue( TGAP_GEN_DISC_ADV_INT_MAX, advInt );
9   }
Set advertising interval

相关文章: