TI中文支持网
TI专业的中文技术问题搜集分享网站

CC2540 和android BLE 调试助手配对不成功

CC2540做为BLEPeripheral, 配对设置如下:

uint32 passkey = 0; // passkey "000000"
uint8 pairMode = GAPBOND_PAIRING_MODE_INITIATE;
uint8 mitm = TRUE;
uint8 ioCap = GAPBOND_IO_CAP_DISPLAY_ONLY;
uint8 bonding = TRUE;
GAPBondMgr_SetParameter( GAPBOND_DEFAULT_PASSCODE, sizeof ( uint32 ), &passkey );
GAPBondMgr_SetParameter( GAPBOND_PAIRING_MODE, sizeof ( uint8 ), &pairMode );
GAPBondMgr_SetParameter( GAPBOND_MITM_PROTECTION, sizeof ( uint8 ), &mitm );
GAPBondMgr_SetParameter( GAPBOND_IO_CAPABILITIES, sizeof ( uint8 ), &ioCap );
GAPBondMgr_SetParameter( GAPBOND_BONDING_ENABLED, sizeof ( uint8 ), &bonding );

simpleBLEPeripheralPasscodeCB代码如下,密码为0

static void simpleBLEPeripheralPasscodeCB( uint8 *deviceAddr, uint16 connectionHandle,
uint8 uiInputs, uint8 uiOutputs )
{
// Send passcode response
uint32 passcode = 0;

GAPBondMgr_PasscodeRsp( connectionHandle, SUCCESS, passcode );
}

总是配对不成功,android BLE 调试助手要求输入4位密码,BLE可以提供6位密码,请问是4位还是6位?

请配对不成功可能是哪里有问题,多谢!

Winter Du:

问题找到,是添加的程序中,自行关闭了连接。

请问配对密码是4位还是6位?

Barbara Wu:

回复 Winter Du:

配对密码在代码里面可以看到

配对的例程可以参考GlucoseSensor和GlucoseCollector

赞(0)
未经允许不得转载:TI中文支持网 » CC2540 和android BLE 调试助手配对不成功
分享到: 更多 (0)