CC2541 128bit UUID的修改
CC2541这块,从16bit 的UUID修改为128bit的UUID出现了notify属性与APP传输数据不成功,读写属性是正常的,以上现象都是用苹果手机上安装的lightblue测试的。各位大神,有遇到过这个问题吗?
请您参考下 TI CC2541 使用自定义的128bit UUID
http://blog.csdn.net/springcyh/article/details/53308449
你好,我就按照这篇博客改的,但是到了最后的 “据说主机对开启notify的操作是基于16bitUUID的,所以要这样改:
关于ATTRTBL_CHAR4_CCC_IDX的定义实际是属性表的特征值char4的config项的偏移位置,我的代码属性表中这项位置为12,
所以定义为
#define ATTRTBL_CHAR4_CCC_IDX 12//Ccc ADD”
这句不知道该加哪里了。
static gattAttribute_t simpleProfileAttrTbl[SERVAPP_NUM_ATTR_SUPPORTED] = { // Simple Profile Service { { ATT_BT_UUID_SIZE, primaryServiceUUID }, /* type */ GATT_PERMIT_READ, /* permissions */ 0, /* handle */ (uint8 *)&simpleProfileService /* pValue */ }, // Characteristic 1 Declaration { { ATT_BT_UUID_SIZE, characterUUID }, GATT_PERMIT_READ, 0, &simpleProfileChar1Props }, // Characteristic Value 1 { { ATT_BT_UUID_SIZE, simpleProfilechar1UUID }, GATT_PERMIT_READ | GATT_PERMIT_WRITE, 0, &simpleProfileChar1 }, // Characteristic 1 User Description { { ATT_BT_UUID_SIZE, charUserDescUUID }, GATT_PERMIT_READ, 0, simpleProfileChar1UserDesp }, // Characteristic 2 Declaration { { ATT_BT_UUID_SIZE, characterUUID }, GATT_PERMIT_READ, 0, &simpleProfileChar2Props }, // Characteristic Value 2 { { ATT_BT_UUID_SIZE, simpleProfilechar2UUID }, GATT_PERMIT_READ, 0, &simpleProfileChar2 }, // Characteristic 2 User Description { { ATT_BT_UUID_SIZE, charUserDescUUID }, GATT_PERMIT_READ, 0, simpleProfileChar2UserDesp }, // Characteristic 3 Declaration { { ATT_BT_UUID_SIZE, characterUUID }, GATT_PERMIT_READ, 0, &simpleProfileChar3Props }, // Characteristic Value 3 { { ATT_BT_UUID_SIZE, simpleProfilechar3UUID }, GATT_PERMIT_WRITE, 0, &simpleProfileChar3 }, // Characteristic 3 User Description { { ATT_BT_UUID_SIZE, charUserDescUUID }, GATT_PERMIT_READ, 0, simpleProfileChar3UserDesp }, // Characteristic 4 Declaration { { ATT_BT_UUID_SIZE, characterUUID }, GATT_PERMIT_READ, 0, &simpleProfileChar4Props }, // Characteristic Value 4 { { ATT_BT_UUID_SIZE, simpleProfilechar4UUID }, 0, 0, &simpleProfileChar4 }, // Characteristic 4 configuration { { ATT_BT_UUID_SIZE, clientCharCfgUUID }, GATT_PERMIT_READ | GATT_PERMIT_WRITE, 0, (uint8 *)&simpleProfileChar4Config }, // Characteristic 4 User Description { { ATT_BT_UUID_SIZE, charUserDescUUID }, GATT_PERMIT_READ, 0, simpleProfileChar4UserDesp }, // Characteristic 5 Declaration { { ATT_BT_UUID_SIZE, characterUUID }, GATT_PERMIT_READ, 0, &simpleProfileChar5Props }, // Characteristic Value 5 { { ATT_BT_UUID_SIZE, simpleProfilechar5UUID }, GATT_PERMIT_AUTHEN_READ, 0, simpleProfileChar5 }, // Characteristic 5 User Description { { ATT_BT_UUID_SIZE, charUserDescUUID }, GATT_PERMIT_READ, 0, simpleProfileChar5UserDesp }, };
请问你有修改过的TI的官方例程吗?
那这个宏需要在哪里用呢?
不好意思,点错了,能否发一份修改过的代码给我啊?我的邮箱:chenxing@szba-mobile.com
你好,还有个问题想问你,128bit的UUID是如何来确定handle值的。
请把以下几篇博客好好看看,ok?
http://blog.csdn.net/feilusia/article/details/52334125
http://blog.csdn.net/feilusia/article/details/50723016
http://blog.csdn.net/feilusia/article/details/47020073
http://blog.csdn.net/feilusia/article/details/46909847
自己多动手动脑,多查资料。不要有问题就来问,ok?
请把以下几篇博客好好看看,ok?
http://blog.csdn.net/feilusia/article/details/52334125
http://blog.csdn.net/feilusia/article/details/50723016
http://blog.csdn.net/feilusia/article/details/47020073
http://blog.csdn.net/feilusia/article/details/46909847
自己多动手动脑,多查资料。不要有问题就来问,ok?
这几篇我都看过了,就是不理解才来问的,要是能想得到干嘛还在这边问啊!
你好!第一,ATTRTBL_CHAR4_CCC_IDX这个宏定义需要在哪里定义的啊?
第二,这个句柄的值需要怎么计算呢?
现在一直想不明白的就是这两个问题。能请帮忙解答一下吗?
Hi,
Please reference below links.
http://software-dl.ti.com/lprf/simplelink_academy/modules/ble_01_custom_profile/ble_01_custom_profile.html
Client Characteristic Configuration Descriptor
The name of this descriptor type is perhaps not very poetic. Often abbreviated to CCCD
, the descriptor is an attribute with the UUID 0x2902
and is readable and writable.
The value a GATT Client writes to this attribute will determine whether the GATT Server is allowed to send Notifications
(if 0x0001
is written) or Indications
(if 0x0002
is written).
How to get handle:
Several of these attributes are needed to define a Characteristic
. A Characteristic
always consists of a at least Value
attribute, where you in your Profile
have decided what the value means, and a Declaration
. The Declaration
always comes before the value attribute and describes whether the value attribute can be read or written, contains the UUID of the Characteristic and the handle
of the Characteristic Value
's attribute.
Other attributes of a characteristic can give a description of the characteristic in string format, or describe how the Value
should be interpreted, or configure whether the GATT Server
may send Notifications
about value changes. These are called Descriptors
.