@@ -121,9 +121,6 @@ COMMENT_OUT(
121121 _auth_type = BLE_GAP_AUTH_KEY_TYPE_NONE;
122122 varclr (_pin);
123123)
124-
125- varclr (&_bond_data);
126- _bond_data.own_enc .master_id .ediv = 0xFFFF ; // invalid value for ediv
127124}
128125
129126void AdafruitBluefruit::configServiceChanged (bool changed)
@@ -930,93 +927,6 @@ void AdafruitBluefruit::_ble_handler(ble_evt_t* evt)
930927 _conn_hdl = BLE_CONN_HANDLE_INVALID;
931928 break ;
932929
933- // case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
934- // // Pairing in progress
935- // varclr(&_bond_data);
936- // _bond_data.own_enc.master_id.ediv = 0xFFFF; // invalid value for ediv
937- //
938- // /* Step 1: Pairing/Bonding
939- // * - Central supplies its parameters
940- // * - We replies with our security parameters
941- // */
942- // // ble_gap_sec_params_t* peer = &evt->evt.gap_evt.params.sec_params_request.peer_params;
943- // COMMENT_OUT(
944- // // Change security parameter according to authentication type
945- // if ( _auth_type == BLE_GAP_AUTH_KEY_TYPE_PASSKEY)
946- // {
947- // sec_para.mitm = 1;
948- // sec_para.io_caps = BLE_GAP_IO_CAPS_DISPLAY_ONLY;
949- // }
950- // )
951- //
952- // ble_gap_sec_keyset_t keyset =
953- // {
954- // .keys_own = {
955- // .p_enc_key = &_bond_data.own_enc,
956- // .p_id_key = NULL,
957- // .p_sign_key = NULL,
958- // .p_pk = NULL
959- // },
960- //
961- // .keys_peer = {
962- // .p_enc_key = &_bond_data.peer_enc,
963- // .p_id_key = &_bond_data.peer_id,
964- // .p_sign_key = NULL,
965- // .p_pk = NULL
966- // }
967- // };
968- //
969- // VERIFY_STATUS(sd_ble_gap_sec_params_reply(evt->evt.gap_evt.conn_handle, BLE_GAP_SEC_STATUS_SUCCESS, &_sec_param, &keyset), RETURN_VOID);
970- // break;
971-
972- // case BLE_GAP_EVT_SEC_INFO_REQUEST:
973- // {
974- // // Reconnection. If bonded previously, Central will ask for stored keys.
975- // // return security information. Otherwise NULL
976- // ble_gap_evt_sec_info_request_t* sec_request = (ble_gap_evt_sec_info_request_t*) &evt->evt.gap_evt.params.sec_info_request;
977- //
978- // if ( bond_load_keys(sec_request->master_id.ediv, &_bond_data) )
979- // {
980- // sd_ble_gap_sec_info_reply(evt->evt.gap_evt.conn_handle, &_bond_data.own_enc.enc_info, &_bond_data.peer_id.id_info, NULL);
981- // } else
982- // {
983- // sd_ble_gap_sec_info_reply(evt->evt.gap_evt.conn_handle, NULL, NULL, NULL);
984- // }
985- // }
986- // break;
987-
988- // case BLE_GAP_EVT_CONN_SEC_UPDATE:
989- // {
990- // // Connection is secured aka Paired
991- // COMMENT_OUT( ble_gap_conn_sec_t* conn_sec = (ble_gap_conn_sec_t*) &evt->evt.gap_evt.params.conn_sec_update.conn_sec; )
992- //
993- // // Previously bonded --> secure by re-connection process
994- // // --> Load & Set Sys Attr (Apply Service Context)
995- // // Else Init Sys Attr
996- // bond_load_cccd(evt_conn_hdl, _bond_data.own_enc.master_id.ediv);
997- //
998- // // Consider Paired as Bonded
999- // _bonded = true;
1000- // }
1001- // break;
1002- //
1003- // case BLE_GAP_EVT_AUTH_STATUS:
1004- // {
1005- // // Bonding process completed
1006- // ble_gap_evt_auth_status_t* status = &evt->evt.gap_evt.params.auth_status;
1007- //
1008- // // Pairing/Bonding succeeded --> save encryption keys
1009- // if (BLE_GAP_SEC_STATUS_SUCCESS == status->auth_status)
1010- // {
1011- // _bonded = true;
1012- // bond_save_keys(evt_conn_hdl, &_bond_data);
1013- // }else
1014- // {
1015- // PRINT_HEX(status->auth_status);
1016- // }
1017- // }
1018- // break;
1019-
1020930 case BLE_GATTS_EVT_SYS_ATTR_MISSING:
1021931 sd_ble_gatts_sys_attr_set (_conn_hdl, NULL , 0 , 0 );
1022932 break ;
@@ -1077,20 +987,3 @@ void AdafruitBluefruit::clearBonds(void)
1077987 bond_clear ();
1078988}
1079989
1080- void AdafruitBluefruit::_bledfu_get_bond_data (ble_gap_addr_t * addr, ble_gap_irk_t * irk, ble_gap_enc_key_t * enc_key)
1081- {
1082- (*addr) = getPeerAddr ();
1083-
1084- if ( connPaired () )
1085- {
1086- bond_data_t bdata;
1087-
1088- if ( bond_load_keys ( Gap._get_peer (_conn_hdl)->ediv , &bdata ) )
1089- {
1090- (*addr) = _bond_data.peer_id .id_addr_info ;
1091- (*irk) = _bond_data.peer_id .id_info ;
1092-
1093- (*enc_key) = _bond_data.own_enc ;
1094- }
1095- }
1096- }
0 commit comments