BLECC2540中advertData这个数组可以动态修改么,能用SIMPLEPROFILE_CHAR1来实现动态修改advertData的某个元素
请问cc2540simpleBLEPeripheral工程中的advertData这个数组可以动态修改么,用lightblue写characteristics 1来实现动态修改advertData[]的某个元素
static uint8 advertData[] =
{
0x02, 0x01, 0x1A,0x1A, 0xFF,0x4C, 0x00,0x02,0x15,
0xB9, 0x40 ,0x7F, 0x30, 0xF5, 0xF8, 0x46, 0x6E, 0xAF, 0xF9, 0x25, 0x55, 0x6B, 0x57, 0xFE, 0x6D,// # iBeacon proximity uuid
0x00, 0x01,//# major 主要是利用characteristics 1实现动态修改这个值
0x00, 0x01,// # minor 主要是利用characteristics 1实现动态修改这个值
0xc5
};
下面这个函数是特征值的调用返回,在这里该作何处理呢?
static void simpleProfileChangeCB( uint8 paramID )
{
uint8 newValue;
switch( paramID )
{
case SIMPLEPROFILE_CHAR1:
SimpleProfile_GetParameter( SIMPLEPROFILE_CHAR1, &newValue );
#if (defined HAL_LCD) && (HAL_LCD == TRUE)
HalLcdWriteStringValue( "Char 1:", (uint16)(newValue), 10, HAL_LCD_LINE_3 );
#endif // (defined HAL_LCD) && (HAL_LCD == TRUE)
我在这里直接修改advertData的值,但是没用,app上接收到的值还是原先默认的值
break;
用GAP_UpdateAdvertisingData()函数
http://www.deyisupport.com/question_answer/wireless_connectivity/bluetooth/f/103/t/84500/reply.aspx
请问这个GAP_UpdateAdvertisingData()函数在哪个文件?找不到这个函数的定义啊
已经解决,谢谢
请问怎么解决的、、、我在定时事件中实时更新广播数据,结果手机端搜到的还是之前的名称,只有连接上一次之后才能显示新名称,为什么?
if ( events & SBP_START_DEVICE_EVT )
{
DMS_SNV_DEV_Name(DMS_SNV_NAME_READ, attDeviceName, sizeof(attDeviceName));
DMS_SNV_ADV_Name(DMS_SNV_NAME_READ, scanRspData, sizeof(scanRspData));
uint8 advertData[] =
{
// Flags; this sets the device to use limited discoverable
// mode (advertises for 30 seconds at a time) instead of general
// discoverable mode (advertises indefinitely)
0x02, // length of this data
GAP_ADTYPE_FLAGS,
GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,
// service UUID, to notify central devices what services are included
// in this peripheral
0x0b, // length of this data
GAP_ADTYPE_MANUFACTURER_SPECIFIC, // some of the UUID's, but not all
attDeviceName[0],
attDeviceName[1],
attDeviceName[2],
attDeviceName[3],
attDeviceName[4],
attDeviceName[5],
attDeviceName[6],
attDeviceName[7],
attDeviceName[8],
attDeviceName[9],
};
GAP_UpdateAdvertisingData(simpleBLEPeripheral_TaskID, TRUE, sizeof(advertData), advertData);
osal_start_timerEx( simpleBLEPeripheral_TaskID, SBP_PERIODIC_EVT, SBP_PERIODIC_EVT_PERIOD );
return ( events ^ SBP_START_DEVICE_EVT );
}
是手机那边的问题,手机连接后,对广播数据不会马上刷新。