|
【转】BLE固件开发--更新连接参数
发表于 2015-6-25 11:28:46
浏览:7339
|
回复:1
打印
只看该作者
[复制链接]
楼主
低功耗蓝牙里重要的三个连接参数:Connection Interval,Slave Latency,Supervision Timeout.这三个参数决定了BLE的功耗。
更新连接参数的相关api:
- // Update cnx parameters
- if (((struct gap_le_create_conn_req_cmp_evt *)param)->conn_info.con_interval < GAP_PPCP_CONN_INTV_MIN)
- {
- // Update connection parameters here
- struct gap_conn_param_update conn_par;
- /// Connection interval minimum
- conn_par.intv_min = GAP_PPCP_CONN_INTV_MIN;
- /// Connection interval maximum
- conn_par.intv_max = GAP_PPCP_CONN_INTV_MAX;
- /// Latency
- conn_par.latency = GAP_PPCP_SLAVE_LATENCY;
- /// Supervision timeout, Time = N * 10 msec
- conn_par.time_out = GAP_PPCP_STO_MULT;
- app_gap_param_update_req(((struct gap_le_create_conn_req_cmp_evt *)param)->conn_info.conhdl, &conn_par);
- }
复制代码
ios app连接时,apple公司有自己的规范,这三个参数的设置必须在其规范内才可生效:
● Interval Max * (Slave Latency + 1) ≤ 2 seconds
● Interval Min ≥ 20 ms
● Interval Min + 20 ms ≤ Interval Max Slave Latency ≤ 4
● connSupervisionTimeout ≤ 6 seconds
● Interval Max * (Slave Latency + 1) * 3 < connSupervisionTimeout |
|