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.

关于仿写通知特征值simpleGATTprofile中Characteristic4的问题

求解怎么添加一个带通知的特征值,初始化它是需要做哪些操作

在SimpleBLEPeripheral的simpleGATTprofile中Characteristic4虽然没有读取权限但是在其被修改时会发送通知,使得Central设备能接收到Characteristic4的值。

于是自己仿写,扩展了这个simpleGATTprofile,扩增特征值表的长度,添加了一个新的特征值Characteristic6,UUID为0xfff6,其内容格式模仿Characteristic4,权限全部都是可写+可读。Characteristic4与其他特征值不同之处在于多了一个字段就是Characteristic 4 configuration,所以我的Characteristic6也自己添加了这个字段。其余函数读写函数进行相应的修改,Characteristic6的读写也都没有问题。但是唯独这通知的功能没有实现,即Characteristic6值改变了却不会通知Central,而预置的Characteristic4却没有问题。

我想应该是我的Characteristic 6 configuration的配置有问题请大家看一下问题出在什么地方

static gattCharCfg_t simpleProfileChar6Config[GATT_MAX_NUM_CONN];

// Characteristic 6 configuration
{
{ ATT_BT_UUID_SIZE, clientCharCfgUUID },
GATT_PERMIT_READ | GATT_PERMIT_WRITE,
0,
(uint8 *)simpleProfileChar6Config
},

请问为什么我在SimpleProfile_SetParameter()设置Char6的case:后添加调用

GATTServApp_ProcessCharCfg( simpleProfileChar6Config, &simpleProfileChar6, FALSE,
simpleProfileAttrTbl, GATT_NUM_ATTRS( simpleProfileAttrTbl ),
INVALID_TASK_ID );

而Central端设备却没有收到通知呢?

我个人是认为是自己定义Characteristic 6 configuration的初始化有问题请问这个应该怎么初始化呢?我是不是漏了什么步骤?

我的初始化simpleProfileChar6Config就是在初始化simpleProfileChar4Config的同样位置后添加相同的内容,

在SimpleProfile_AddService()里的改变

// Initialize Client Characteristic Configuration attributes
GATTServApp_InitCharCfg( INVALID_CONNHANDLE, simpleProfileChar4Config );
GATTServApp_InitCharCfg( INVALID_CONNHANDLE, simpleProfileChar6Config );

在simpleProfile_HandleConnStatusCB()里的改变

GATTServApp_InitCharCfg( connHandle, simpleProfileChar4Config );
GATTServApp_InitCharCfg( connHandle, simpleProfileChar6Config );