我需要狀態(tài)1的時(shí)候廣播間隔是500ms,狀態(tài)2的時(shí)候廣播間隔是100ms,使用
GAP_SetParamValue(TGAP_DISC_ADV_INT_MIN, MS1_TO_SYSTEM_TIME(500));
GAP_SetParamValue(TGAP_DISC_ADV_INT_MAX, MS1_TO_SYSTEM_TIME(500));
修改不成功,請(qǐng)問(wèn)應(yīng)該怎么辦
我需要狀態(tài)1的時(shí)候廣播間隔是500ms,狀態(tài)2的時(shí)候廣播間隔是100ms,使用
GAP_SetParamValue(TGAP_DISC_ADV_INT_MIN, MS1_TO_SYSTEM_TIME(500));
GAP_SetParamValue(TGAP_DISC_ADV_INT_MAX, MS1_TO_SYSTEM_TIME(500));
修改不成功,請(qǐng)問(wèn)應(yīng)該怎么辦
您好,先關(guān)廣播,修改廣播間隔的配置,再打開(kāi)廣播。
開(kāi)/關(guān)廣播調(diào)用如下兩行接口即可。
uint8_t? initial_advertising_enable = TRUE;? ? ?//FALSE
GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t), &initial_advertising_enable);
void modify_adv_interval(unsigned int ms)
{
uint8_t initial_advertising_enable = TRUE;
initial_advertising_enable = FALSE;
GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t), &initial_advertising_enable);
GAP_SetParamValue(TGAP_DISC_ADV_INT_MIN, MS1_TO_SYSTEM_TIME(ms));
GAP_SetParamValue(TGAP_DISC_ADV_INT_MAX, MS1_TO_SYSTEM_TIME(ms));
?initial_advertising_enable = TRUE;
GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof(uint8_t), &initial_advertising_enable);
}
修改沒(méi)有生效呀
你好,關(guān)閉廣播后再開(kāi)啟廣播的話,需要等到報(bào)等待廣播狀態(tài)后再開(kāi)啟,不可以關(guān)閉后直接再打開(kāi)。
在等待廣播處開(kāi)啟廣播: if(pEvent->gap.opcode?==?GAP_END_DISCOVERABLE_DONE_EVENT) { PRINT("Waiting?for?advertising..\n"); uint8_t?initial_advertising_enable?=?TRUE; GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED,?sizeof(uint8_t),?&initial_advertising_enable);開(kāi)啟廣播 }