你好,设置广播的开启与否,可以通过GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &new_adv_enabled_status );这个函数来设置,请问一下,有没有什么函数可以设置蓝牙是否可以被连接,就是设置蓝牙广播但不可以被连接和蓝牙广播可以被连接这两种状态的切换,谢谢!
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
if(current_adv_EVENT_TYPE_status==GAP_ADTYPE_ADV_IND)
{
new_adv_EVENT_TYPE_status=GAP_ADTYPE_ADV_NONCONN_IND ;
SerialPrintString("non connected\r\n");
}
else
{
new_adv_EVENT_TYPE_status=GAP_ADTYPE_ADV_IND ;
SerialPrintString("connect\r\n");
}
GAPRole_SetParameter( GAPROLE_ADV_EVENT_TYPE, sizeof( uint8 ), &new_adv_EVENT_TYPE_status );
我在这里做了一个切换,发现只要一切换本来存在的广播也没有了,只能自己再重启广播,是怎么回事呢?
对的 ,后来我如下处理:
GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &adv_enabled_status_close );//关闭广播
if(current_adv_EVENT_TYPE_status==GAP_ADTYPE_ADV_IND)
{
new_adv_EVENT_TYPE_status=GAP_ADTYPE_ADV_NONCONN_IND ;
SerialPrintString("non connected\r\n");
}
else
{
new_adv_EVENT_TYPE_status=GAP_ADTYPE_ADV_IND ;
SerialPrintString("connect\r\n");
}
GAPRole_SetParameter( GAPROLE_ADV_EVENT_TYPE, sizeof( uint8 ), &new_adv_EVENT_TYPE_status );
GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &adv_enabled_status_open );//打开广播
结果还是一样。