CC2640端如何设置配对绑定密码?
CC2640端如何设置配对绑定密码?
我在CC2640端设置了配对绑定,例如配对密码是123456
但是android获取到的密码类型是PAIRING_VARIANT_PASSKEY = 1,因此adroid的APP就无法用android的API反射方法配对成功。
CC2640端如何设置,才能让android的配对类型是PAIRING_VARIANT_PIN = 0?
以simpleBLEPeripheral工程为例,配对的设置在函数 SimpleBLEPeripheral_init()里面。你可以相应修改一下,看看能不能达到你的要求。
// Setup the GAP Bond Manager
{
uint32_t passkey = 0; // passkey "000000"
uint8_t pairMode = GAPBOND_PAIRING_MODE_WAIT_FOR_REQ;
uint8_t mitm = TRUE;
uint8_t ioCap = GAPBOND_IO_CAP_DISPLAY_ONLY;
uint8_t bonding = TRUE;
GAPBondMgr_SetParameter(GAPBOND_DEFAULT_PASSCODE, sizeof(uint32_t),
&passkey);
GAPBondMgr_SetParameter(GAPBOND_PAIRING_MODE, sizeof(uint8_t), &pairMode);
GAPBondMgr_SetParameter(GAPBOND_MITM_PROTECTION, sizeof(uint8_t), &mitm);
GAPBondMgr_SetParameter(GAPBOND_IO_CAPABILITIES, sizeof(uint8_t), &ioCap);
GAPBondMgr_SetParameter(GAPBOND_BONDING_ENABLED, sizeof(uint8_t), &bonding);
}
提供CC2541 CC2640R2 CC1310等CC系列免费样片 Q.Q 122982582