cancel
Showing results for 
Search instead for 
Did you mean: 

Smart Bluetooth

Anonymous
Not applicable

Hi,

Is it possible to set passKey lenght to 4 digits? I have checked example where passkey=123456 and tried to modify it to passkey=1234.

To do so I have changed passKey to:

//passkey=1234(dec)->  HEX 0x000004D2 -> 0x00 0x00 0x04 0xD2 -> (little endian) 0xD2 0x04 0x00 0x00

const UINT8 passKey[LESMP_MAX_KEY_SIZE] = {0xD2, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

And i  tried to modify: lesmp_setSMPassKey((UINT8*)passKey, LESMP_MAX_KEY_SIZE); to lesmp_setSMPassKey((UINT8*)passKey, 4);

That didn't work. Any help would be usefull.

Best Regards

0 Likes
1 Solution
BoonT_56
Employee

You may refer to the BT Spec 4.x for more details on this. If you really want to implement a 4-digit passkey, you may automatically append two zeros to it to make it a 6-digit.

luktym

View solution in original post

0 Likes
2 Replies
BoonT_56
Employee

I believe the 6-digit length is a requirement for secure simple pairing in ble. Not sure it can be changed out in the code...

0 Likes
BoonT_56
Employee

You may refer to the BT Spec 4.x for more details on this. If you really want to implement a 4-digit passkey, you may automatically append two zeros to it to make it a 6-digit.

luktym

View solution in original post

0 Likes