I am creating an original service using the example of Multilink Central.
I'm trying to reference an LBS to send data to a particular peripheral.
I tried to send using m_lbs_c [], but the connection was lost and an error occurred.
It seems that an error has occurred because it stops at nrf_ble_gq_item_add.
Unknown function at 0x00000A60
When executed with evt_handler, it will be sent to the correct destination.
An error occurs when trying to execute with a button interrupt.
I think it's a conn_handle problem, but I don't know the solution.
Thank you for your cooperation.

uint32_t ble_original_time_reply(ble_original_c_t * p_ble_original_c, ble_sync_data_t data)
{
VERIFY_PARAM_NOT_NULL(p_ble_original_c);
if (p_ble_original_c->conn_handle == BLE_CONN_HANDLE_INVALID)
{
return NRF_ERROR_INVALID_STATE;
}
uint32_t next_timing;
next_timing = data.next_timing;
uint32_t err_code;
nrf_ble_gq_req_t write_req;
//ble_gattc_write_params_t write_param;
uint8_t encorded_data[30];
uint16_t len=1;
uint16_t hvx_len=1;
encorded_data[0] = 0;
len += uint32_encode(next_timing, &encorded_data[len]);
encorded_data[len++] = data.pettern;
hvx_len = len;
memset(&write_req, 0, sizeof(nrf_ble_gq_req_t));
write_req.type = NRF_BLE_GQ_REQ_GATTC_WRITE;
write_req.error_handler.cb = gatt_error_handler;
write_req.error_handler.p_ctx = p_ble_original_c;
write_req.params.gattc_write.handle = p_ble_original_c->peer_original_db.time_handle;
write_req.params.gattc_write.len = hvx_len;
write_req.params.gattc_write.p_value = encorded_data;
write_req.params.gattc_write.offset = 0;
write_req.params.gattc_write.write_op = BLE_GATT_OP_WRITE_CMD;
/*
memset(&write_param, 0, sizeof(write_param));
write_param.handle = p_ble_original_c->peer_original_db.time_handle;
write_param.len = hvx_len;
write_param.p_value = encorded_data;
write_param.offset = 0;
*/
//NRF_LOG_INFO("reply send. %d",next_timing);
err_code = nrf_ble_gq_item_add(p_ble_original_c->p_gatt_queue, &write_req, p_ble_original_c->conn_handle);
//return err_code;
//err_code = sd_ble_gattc_write(p_ble_original_c->conn_handle, &write_param);
}
case BSP_EVENT_KEY_2:
{
data.pettern = 1;
data.next_timing = 0;
ret_code_t err_code;
for (uint32_t i = 0; i< NRF_SDH_BLE_CENTRAL_LINK_COUNT; i++)
{
err_code = ble_original_time_reply(&m_original_c[i], data); <-I can't do this
if (err_code != NRF_SUCCESS &&
err_code != BLE_ERROR_INVALID_CONN_HANDLE &&
err_code != NRF_ERROR_INVALID_STATE)
{
return err_code;
}
}static void original_c_evt_handler(ble_original_c_t * p_original_c, ble_original_c_evt_t * p_original_c_evt)
{
・
・
・
ble_original_time_reply(p_original_c, data);//<-Can do this
・
・
・
}