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.

BLE periheral 初始化有个 passkey 参数是



 

uint32 passkey = 132 ; // passkey "000000"
uint8 pairMode =GAPBOND_PAIRING_MODE_NO_PAIRING ;//GAPBOND_PAIRING_MODE_WAIT_FOR_REQ ;
uint8 mitm = TRUE;
// 定义你设备的能力 是否具备显示 输入 能力
uint8 ioCap = GAPBOND_IO_CAP_DISPLAY_ONLY ;
uint8 bonding = TRUE;
GAPBondMgr_SetParameter( GAPBOND_DEFAULT_PASSCODE, sizeof ( uint32 ), &passkey );
 

请问这个passkey 是哪里用到呢? 在配对要求输入密码的请求 是另外一个函数随机成成的密码  和这个密码好像没有关联 ?

  • thinkcore wu,看下这个

    GAP also handles the initiation of security features during a BLE connection. Certain data may be
    readable or writeable only in an authenticated connection. Once a connection is formed, two
    devices can go through a process called pairing. When pairing is performed, keys are established
    which encrypt and authenticate the link. In a typical case, the peripheral device will require that
    the central device provide a passkey in order to complete the pairing process. This could be a
    fixed value, such as “000000”, or could be a randomly generated value that gets provided to the
    user (such as on a display). After the central device sends the correct passkey, the two devices
    exchange security keys to encrypt and authenticate the link.