Sandyjia 发表于 2019-10-17 12:36
你好,我就按照这篇博客改的,但是到了最后的 “据说主机对开启notify的操作是基于16bitUUID的,所以要这样改:
关于ATTRTBL_CHAR4_CCC_IDX的定义实际是属性表的特征值char4的config项的偏移位置,我的代码属性表中这项位置为12,
所以定义为
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平台的开发者!