Hi,
I am using softdevice-7 and SDK 6.1 for our application. I want to implement static key pairing for serial port over ble application "ble_app_uart".
I have implemented following changes for static key implementation.
1)changed I/o capabilities to " BLE_GAP_IO_CAPS_DISPLAY_ONLY"
2)in gap_params_init () , added static pin info
// Add static pin:
uint8_t passkey[] = STATIC_PASSKEY;
m_static_pin_option.gap.passkey.p_passkey = passkey;
err_code = sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &m_static_pin_option);
APP_ERROR_CHECK(err_code);
- in on_ble_evt(), commented /deleted following case statements
BLE_GAP_EVT_SEC_PARAMS_REQUEST:
BLE_GATTS_EVT_SYS_ATTR_MISSING
BLE_GAP_EVT_SEC_INFO_REQUEST
and added new case statement
case BLE_GAP_EVT_PASSKEY_DISPLAY:
#ifdef DEBUG_PRINT
simple_uart_putstring(" in on_ble_evt()##BLE_GAP_EVT_PASSKEY_DISPLAY##\n");
#endif
// Don't send delayed Security Request if security procedure is already in progress.
err_code = app_timer_stop(m_sec_req_timer_id);
APP_ERROR_CHECK(err_code);
p_passkey = (char *)p_ble_evt->evt.gap_evt.params.passkey_display.passkey;
// Using static pin, display is not necessary.
/*if (m_is_display_available)
{
p_passkey = (char *)p_ble_evt->evt.gap_evt.params.passkey_display.passkey;
success = nrf6350_lcd_on();
APP_ERROR_CHECK_BOOL(success);
success = nrf6350_lcd_write_string(PASSKEY_TXT,
PASSKEY_TXT_LENGTH,
LCD_UPPER_LINE,
0);
APP_ERROR_CHECK_BOOL(success);
success = nrf6350_lcd_write_string(p_passkey, PASSKEY_LENGTH,LCD_LOWER_LINE, 0);
APP_ERROR_CHECK_BOOL(success);
} */
break;
-
ble_evt_dispatch() added dm_ble_evt_handler() function
-
added device_manager_init() , device_manager_evt_handler() functions and registered.
6)sec_req_timeout_handler() is added.
even after implementing these following changes also, I am able to connect /bond without authentication. for reference here I am attaching complete source file which can be build in GCC environment.
I will be very much thankful ,if some one share information procedure to implement the static key.
Thanking you very much, Regards, Raju
edit: format edit2: format