1.连接超时问题。静默状态,设备处于PM3状态。按开关时,设备用配对表地址建立链接(跳过扫描动作),如果外围设备在附近可以建立连接;如果外围设备不在附近则设备一直在init状态,没有返回PM3状态。
2.检查连接加密状态。
建立service
// Register GATT attribute list and CBs with GATT Server App
status = GATTServApp_RegisterService( lockProfileAttrTbl, GATT_NUM_ATTRS( lockProfileAttrTbl ), &lockProfileCBs );
service回调
CONST gattServiceCBs_t lockProfileCBs =
{
lockProfile_ReadAttrCB, // Read callback function pointer
lockProfile_WriteAttrCB, // Write callback function pointer
NULL // Authorization callback function pointer
};
// Characteristic 1 Declaration
{
{ ATT_BT_UUID_SIZE, characterUUID },
GATT_PERMIT_READ,
0,
&lockProfileChar1Props
},
lockProfileAttrTbl
// Characteristic Value 1
{
{ ATT_BT_UUID_SIZE, lockProfilechar1UUID },
GATT_PERMIT_READ | GATT_PERMIT_ENCRYPT_WRITE,
0,
lockProfileChar1
},
// Characteristic 1 User Description
{
{ ATT_BT_UUID_SIZE, charUserDescUUID },
GATT_PERMIT_READ,
0,
lockProfileChar1UserDesp
},
写回调
lockProfile_WriteAttrCB
如何在写回调中判断当前链路是否加密?我发现GATT_PERMIT_ENCRYPT_WRITE这个特性没有生效。或者说我理解这个GATT_PERMIT_ENCRYPT_WRITE特性错误?
3.低功耗配对失败问题。