蓝牙从机事件处理函数 SimpleBLEPeripheral_ProcessEvent的疑问
蓝牙从机事件处理函数 SimpleBLEPeripheral_ProcessEvent以下程序
if ( events & SBP_PERIODIC_EVT )
{
// Restart timer
if ( SBP_PERIODIC_EVT_PERIOD )
{
osal_start_timerEx( simpleBLEPeripheral_TaskID, SBP_PERIODIC_EVT, SBP_PERIODIC_EVT_PERIOD );
}
// Perform periodic application task
performPeriodicTask();
delay(10000); //为什么这里给一个比较长的延时函数,蓝牙会自动断开连接(或者在这个事情处理中调用的某个函数,此函数内调用比较长的延时函数,蓝牙都 会断开连接,为什么?)
return (events ^ SBP_PERIODIC_EVT);
}
闹笑话了吧,OS里面能这样加Delay?
Supervision timeout超时了。
可以通过osal_start_timerEx函数在10000后触发一个事件来处理。
请问Supervision timeout在哪里可以设置?
http://www.deyisupport.com/question_answer/wireless_connectivity/bluetooth/f/103/t/59908.aspx
Hi DCG,
Supervision Timeout – This is the maximum amount of time between two successful connection events. If this amount of time passes without a successful connection event, the device is to consider the connection lost, and return to an unconnected state. This parameter value is represented in units of 10ms. The supervision timeout value can range from a minimum of 10 (100ms) to 3200 (32.0s). In addition, the timeout must be larger than the effective connection interval。
可以在peripheral.h中的GAPROLE_TIMEOUT_MULTIPLIER参数上设置。
#define GAPROLE_TIMEOUT_MULTIPLIER 0x314 //!< Update Parameter Timeout Multiplier (n * 10ms). Range: 100ms to 32 seconds (0x000a - 0x0c80). Read/Write. Size is uint16. Default is 1000.