call: Add answer and hangup

This commit is contained in:
Marius Gripsgard
2024-10-13 19:17:47 +02:00
parent 133778edde
commit b86fcb9aa3
3 changed files with 154 additions and 4 deletions

View File

@@ -280,8 +280,29 @@ qti_ims_call_answer(
GDestroyNotify destroy,
void* user_data)
{
DBG("answer is not implemented yet");
return 0;
QtiImsCall* self = THIS(ext);
QTI_RADIO_RTT_MODE mode = flags & BINDER_EXT_CALL_ANSWER_FLAG_RTT ?
QTI_RADIO_RTT_MODE_FULL : QTI_RADIO_RTT_MODE_DISABLED;
QTI_RADIO_IP_PRESENTATION presentation = QTI_RADIO_IP_PRESENTATION_NUM_DEFAULT;
QTI_RADIO_CALL_TYPE call_type = QTI_RADIO_CALL_TYPE_VOICE;
QtiImsCallResultRequest* req = qti_ims_call_result_request_new(ext,
complete, destroy, user_data);
guint id = qti_radio_ext_answer(self->radio_ext, call_type, presentation, mode,
qti_ims_call_result_response, qti_ims_call_result_request_destroy, req);
DBG("Answering return %d", id);
if (id) {
req->id = id;
req->id_mapped = id;
g_hash_table_insert(self->id_map, ID_KEY(id), ID_VALUE(id));
} else {
qti_ims_call_result_request_free(req);
}
return id;
}
static
@@ -309,8 +330,25 @@ qti_ims_call_hangup(
GDestroyNotify destroy,
void* user_data)
{
DBG("hangup is not implemented yet");
return 0;
QtiImsCall* self = THIS(ext);
QtiImsCallResultRequest* req = qti_ims_call_result_request_new(ext,
complete, destroy, user_data);
guint id = qti_radio_ext_hangup(self->radio_ext, call_id,
qti_ims_call_result_response, qti_ims_call_result_request_destroy, req);
DBG("Hanging up return %d", id);
if (id) {
req->id = id;
req->id_mapped = id;
g_hash_table_insert(self->id_map, ID_KEY(id), ID_VALUE(id));
} else {
qti_ims_call_result_request_free(req);
}
return id;
}
static

View File

@@ -1113,6 +1113,96 @@ qti_radio_ext_dial(
number, clir);
}
static
void
qti_radio_ext_answer_args(
GBinderWriter* args,
va_list va)
{
gint32 call_type = va_arg(va, gint32);
gint32 presentation = va_arg(va, gint32);
gint32 mode = va_arg(va, gint32);
// answer(CallType callType, IpPresentation presentation, RttMode mode);
gbinder_writer_append_int32(args, call_type);
gbinder_writer_append_int32(args, presentation);
gbinder_writer_append_int32(args, mode);
}
guint
qti_radio_ext_answer(
QtiRadioExt* self,
QTI_RADIO_CALL_TYPE call_type,
QTI_RADIO_IP_PRESENTATION presentation,
QTI_RADIO_RTT_MODE mode,
QtiRadioExtResultFunc complete,
GDestroyNotify destroy,
void* user_data)
{
return qti_radio_ext_result_request_submit(self,
QTI_RADIO_REQ_ANSWER,
QTI_RADIO_RESP_ANSWER,
qti_radio_ext_answer_args,
complete, destroy, user_data,
call_type, presentation, mode);
}
static
void
qti_radio_ext_hangup_args(
GBinderWriter* args,
va_list va)
{
gint32 call_id = va_arg(va, gint32);
static const GBinderWriterField qti_radio_hangup_request_info_f[] = {
GBINDER_WRITER_FIELD_HIDL_STRING
(QtiRadioHangupRequestInfo, conn_uri),
GBINDER_WRITER_FIELD_HIDL_VEC_BYTE
(QtiRadioHangupRequestInfo, fail_cause_response.errorinfo), // we are not going to use this, so byte is fine
GBINDER_WRITER_FIELD_HIDL_STRING
(QtiRadioHangupRequestInfo, fail_cause_response.network_error_string),
GBINDER_WRITER_FIELD_HIDL_STRING
(QtiRadioHangupRequestInfo, fail_cause_response.error_details.error_string),
GBINDER_WRITER_FIELD_END()
};
static const GBinderWriterType qti_radio_hangup_request_info_t = {
GBINDER_WRITER_STRUCT_NAME_AND_SIZE(QtiRadioHangupRequestInfo),
qti_radio_hangup_request_info_f
};
// hangup(HangupRequestInfo hangup);
QtiRadioHangupRequestInfo* hangup_request_writer = gbinder_writer_new0(args, QtiRadioHangupRequestInfo);
hangup_request_writer->conn_index = call_id;
hangup_request_writer->has_multi_party = FALSE;
hangup_request_writer->has_fail_cause_response = FALSE;
hangup_request_writer->multi_party = FALSE;
hangup_request_writer->conn_uri.len = 0;
hangup_request_writer->conn_uri.owns_buffer = FALSE;
gbinder_writer_append_struct(args, hangup_request_writer,
&qti_radio_hangup_request_info_t, NULL);
}
guint
qti_radio_ext_hangup(
QtiRadioExt* self,
guint call_id,
QtiRadioExtResultFunc complete,
GDestroyNotify destroy,
void* user_data)
{
return qti_radio_ext_result_request_submit(self,
QTI_RADIO_REQ_HANGUP_1_2,
QTI_RADIO_RESP_HANGUP_1_2,
qti_radio_ext_hangup_args,
complete, destroy, user_data,
call_id);
}
// GET_IMS_REG_STATE
static

View File

@@ -42,6 +42,10 @@ typedef void (*QtiRadioExtCallStateFunc)(
GPtrArray* updated_calls,
void* user_data);
typedef void (*QtiRadioExtRingFunc)(
QtiRadioExt* radio,
void* user_data);
QtiRadioExt*
qti_radio_ext_new(
const char* dev,
@@ -84,6 +88,24 @@ qti_radio_ext_dial(
GDestroyNotify destroy,
void* user_data);
guint
qti_radio_ext_answer(
QtiRadioExt* self,
QTI_RADIO_CALL_TYPE call_type,
QTI_RADIO_IP_PRESENTATION presentation,
QTI_RADIO_RTT_MODE mode,
QtiRadioExtResultFunc complete,
GDestroyNotify destroy,
void* user_data);
guint
qti_radio_ext_hangup(
QtiRadioExt* self,
guint call_id,
QtiRadioExtResultFunc complete,
GDestroyNotify destroy,
void* user_data);
guint
qti_radio_ext_get_ims_reg_state(
QtiRadioExt* self,