Merge pull request #14239 from paul-szczepanek-arm/passkey-fix

BLE: fix passkey for display being returned reversed
pull/14269/head
Martin Kojtal 2021-02-11 08:04:57 +00:00 committed by GitHub
commit 8284807a00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 0 deletions

View File

@ -324,6 +324,9 @@ public:
* @param[in] connectionHandle connection connectionHandle
* @param[in] passkey 6 digit passkey to be displayed
*/
#if BLE_PASSKEY_DISPLAY_REVERSED_DIGITS_DEPRECATION
MBED_DEPRECATED_SINCE("mbed-os-6.8.0", "This returns the passkey in reverse order. Please set the config option ble.ble-passkey-display-reversed-digits-deprecation in your mbed_app.json override section to false. This will then return the passkey in the correct order.")
#endif // BLE_PASSKEY_DISPLAY_REVERSED_DIGITS_DEPRECATION
virtual void passkeyDisplay(ble::connection_handle_t connectionHandle, const Passkey_t passkey) {
(void)connectionHandle;
(void)passkey;

View File

@ -272,7 +272,11 @@ public:
* @param[in] passkey value of the data.
*/
PasskeyAscii(passkey_num_t passkey) {
#if BLE_PASSKEY_DISPLAY_REVERSED_DIGITS_DEPRECATION
for (int i = 5, m = 100000; i >= 0; --i, m /= 10) {
#else
for (int i = 0, m = 100000; i < PASSKEY_LEN; ++i, m /= 10) {
#endif //BLE_PASSKEY_DISPLAY_REVERSED_DIGITS_DEPRECATION
uint32_t result = passkey / m;
ascii[i] = NUMBER_OFFSET + result;
passkey -= result * m;

View File

@ -107,6 +107,11 @@
"help": "Used for host privacy. How many last resolved addresses to store to speed up resolution. This is especially valuable for resolving advertising which creates repeated queries for the same address.",
"value": 16,
"macro_name": "BLE_GAP_HOST_PRIVACY_RESOLVED_CACHE_SIZE"
},
"ble-passkey-display-reversed-digits-deprecation": {
"help": "This option is part of the deprecation process. Set this to false to remove the deprecation notice. When set to true, the digits in the SecurityManager passkeyDiplay event are reversed. When set to false the digits are in the correct order.",
"value": true,
"macro_name": "BLE_PASSKEY_DISPLAY_REVERSED_DIGITS_DEPRECATION"
}
},
"target_overrides": {