This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

If no use bonding and secure fuction may I just mask the pm_conn_secure in central device project

Hi I use nRF52832 and SDK13 and Central Device project. and my device has not bonding function so may I mask my central device pm_conn_secure call here is my part of code

#define SEC_PARAM_BOND  0//1
static void peer_manager_init(void)

{ ble_gap_sec_params_t sec_param; ret_code_t err_code;

err_code = pm_init();
APP_ERROR_CHECK(err_code);

memset(&sec_param, 0, sizeof(ble_gap_sec_params_t));

// Security parameters to be used for all security procedures.
sec_param.bond           = SEC_PARAM_BOND;
sec_param.mitm           = SEC_PARAM_MITM;
sec_param.lesc           = SEC_PARAM_LESC;
sec_param.keypress       = SEC_PARAM_KEYPRESS;
sec_param.io_caps        = SEC_PARAM_IO_CAPABILITIES;
sec_param.oob            = SEC_PARAM_OOB;
sec_param.min_key_size   = SEC_PARAM_MIN_KEY_SIZE;
sec_param.max_key_size   = SEC_PARAM_MAX_KEY_SIZE;
sec_param.kdist_own.enc  = 0;//1;
sec_param.kdist_own.id   = 0;//1;
sec_param.kdist_peer.enc = 0;//1;
sec_param.kdist_peer.id  = 0;//1;

err_code = pm_sec_params_set(&sec_param);
APP_ERROR_CHECK(err_code);

err_code = pm_register(pm_evt_handler);
APP_ERROR_CHECK(err_code);

}

static void hrs_c_evt_handler(ble_hrs_c_t * p_hrs_c, ble_hrs_c_evt_t * p_hrs_c_evt)

{ switch (p_hrs_c_evt->evt_type) { case BLE_HRS_C_EVT_DISCOVERY_COMPLETE: {
ret_code_t err_code;

         err_code = ble_hrs_c_handles_assign(p_hrs_c,p_hrs_c_evt->conn_handle, &p_hrs_c_evt->params.peer_db);
         APP_ERROR_CHECK(err_code);
         // Initiate bonding.
         //err_code = pm_conn_secure( p_hrs_c_evt->conn_handle, false);
         //if (err_code != NRF_ERROR_INVALID_STATE)
         //{
         //    APP_ERROR_CHECK(err_code);
         //}
         // Heart rate service discovered. Enable notification of Heart Rate Measurement.
         err_code = ble_hrs_c_hrm_notif_enable(p_hrs_c);
         APP_ERROR_CHECK(err_code);
    } break; // BLE_HRS_C_EVT_DISCOVERY_COMPLETE

    case BLE_HRS_C_EVT_HRM_NOTIFICATION:
    {
        m_scr.m_hr.hr = p_hrs_c_evt->params.hrm.hr_value;
    } break; // BLE_HRS_C_EVT_HRM_NOTIFICATION

    default:
        break;
}

}

The reason is I just need scan the device and connect to it and there is no bonding and secure need.

May I delete the pm_conn_secure function call.

Thanks

Related