连续签到天数:1天 | 签到总天数:765天 | 签到总奖励:7275金币 |
|
发表于 2018-5-31 17:17:39
|
显示全部楼层
请教:是改以下函数中的 ad_data_index = setupLocalNameAdvertisingData(ad_data, ad_data_index, 14, BLE_DEVICE_NAME ); ,对吗?
请详细说明下。十分感谢!
void bleSetupAdvertisingData(uint16 size_local_name, const uint8 *local_name, adv_discoverable_mode_t mode)
{
uint16 ad_data_index = 0;
uint8 *ad_data = malloc( MAX_AD_DATA_SIZE_IN_OCTETS );
if( NULL != ad_data )
{
/* Setup the flags advertising data */
ad_data_index = setupFlagsAdData(ad_data, mode);
/* Setup the services advertising data */
ad_data_index = setupServicesAdData(ad_data, ad_data_index);
/* Setup the local name advertising data */
#if 1
ad_data_index = setupLocalNameAdvertisingData(ad_data, ad_data_index, size_local_name, local_name );
#else
ad_data_index = setupLocalNameAdvertisingData(ad_data, ad_data_index, 14, BLE_DEVICE_NAME );
#endif
/* Register AD data with the Connection library & Tidy up allocated memory*/
ConnectionDmBleSetAdvertisingDataReq(ad_data_index, ad_data);
/* free the buffer after use */
free (ad_data);
}
else
{
/* Panic, not enough room to BLE Advertise */
}
} |
|