我想把配对密码读取出来,可是读出来一直是错误的,请帮我看下:
// Setup the GAP Bond Manager
{
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 );
}
static void ProcessPasscodeCB(uint8 *deviceAddr,uint16 connectionHandle,uint8 uiInputs,uint8 uiOutputs )
{
uint32 passcode = 4444;
// Send passcode response
GAPBondMgr_PasscodeRsp( 0, SUCCESS, passcode );
}
以下是读取:
uint32 passcode;
uint8 str[7];
GAPRole_GetParameter(GAPBOND_DEFAULT_PASSCODE,&passcode);
SerialPrintString("passcode:");
SerialPrintString( (unsigned char *) _ltoa(passcode, str, 10));
读出来的是:12063422,我在 ProcessPasscodeCB()改变值也没反应
jason jason4:
已解决,自己2了。。。
David wei:
回复 jason jason4:
你是如何解决的呢?我也遇到类似的问题了,想用串口或者LCD显示出密码,然后对着密码输入相应的密码来配对,但是输出的密码都是乱码或者和产生的密码不一样的数值。