From ea91202d490a7e83729c729c4d696965cce4d671 Mon Sep 17 00:00:00 2001 From: Marius Gripsgard Date: Sat, 30 Aug 2025 22:21:06 +0000 Subject: [PATCH] radio: Add SMS status report handling support - Add QtiRadioExtSmsReportFunc typedef for SMS report callbacks - Add qti_radio_ext_add_sms_report_handler() function - Implement qti_radio_ext_handle_sms_report_indication() to parse SMS status reports - Add SIGNAL_EXT_ON_SMS_REPORT signal for SMS status reports - Enable SMS_STATUS_REPORT_INDICATION handling in indication dispatcher --- src/qti_radio_ext.c | 60 ++++++++++++++++++++++++++++++++++++++++++++- src/qti_radio_ext.h | 13 ++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/src/qti_radio_ext.c b/src/qti_radio_ext.c index 5c730de..947c5c1 100644 --- a/src/qti_radio_ext.c +++ b/src/qti_radio_ext.c @@ -97,6 +97,7 @@ enum qti_radio_ext_signal { SIGNAL_EXT_CALL_STATE_CHANGED, SIGNAL_EXT_ON_RING, SIGNAL_EXT_ON_INCOMING_SMS, + SIGNAL_EXT_ON_SMS_REPORT, SIGNAL_COUNT }; @@ -104,6 +105,7 @@ enum qti_radio_ext_signal { #define SIGNAL_EXT_CALL_STATE_CHANGED_NAME "qti-radio-ext-call-state-changed" #define SIGNAL_EXT_ON_RING_NAME "qti-radio-ext-on-ring" #define SIGNAL_EXT_ON_INCOMING_SMS_NAME "qti-radio-ext-on-incoming-sms" +#define SIGNAL_EXT_ON_SMS_REPORT_NAME "qti-radio-ext-on-sms-report" static guint qti_radio_ext_signals[SIGNAL_COUNT] = { 0 }; @@ -484,6 +486,48 @@ qti_radio_ext_handle_incoming_sms_indication( } } +/* + +typedef struct qti_radio_ims_sms_send_status_report { + guint32 message_ref RADIO_ALIGNED(4); + GBinderHidlString format RADIO_ALIGNED(8); + GBinderHidlVec pdu RADIO_ALIGNED(8); +} RADIO_ALIGNED(8) QtiRadioImsSmsSendStatusReport; + +*/ + +// implement sms report +static +void +qti_radio_ext_handle_sms_report_indication( + QtiRadioExt* self, + const GBinderReader* args) +{ + GBinderReader reader; + QtiRadioImsSmsSendStatusReport* report; + + gbinder_reader_copy(&reader, args); + report = gbinder_reader_read_hidl_struct(&reader, QtiRadioImsSmsSendStatusReport); + + if (report) { + const guint32 message_ref = report->message_ref; + const char *format = report->format.data.str ? report->format.data.str : ""; + const guint32 pdu_len = report->pdu.count; + const void* pdu = report->pdu.data.ptr; + + // copy pdu to a new buffer + const void* pdu_copy = g_memdup(pdu, pdu_len); + + DBG("%s: SMS status report indication message_ref:%d format:%s pdu_len:%d", + self->slot, message_ref, format, pdu_len); + gutil_log_dump(&qti_radio_ext_binder_dump_module, GLOG_LEVEL_VERBOSE, " ", pdu_copy, pdu_len); + + g_signal_emit(self, qti_radio_ext_signals[SIGNAL_EXT_ON_SMS_REPORT], 0, pdu_copy, pdu_len, message_ref); + } else { + DBG("%s: failed to parse SMS status report data", self->slot); + } +} + static GBinderLocalReply* @@ -527,7 +571,7 @@ qti_radio_ext_indication( qti_radio_ext_handle_call_state_indication(self, &args); return NULL; case QTI_RADIO_IND_SMS_STATUS_REPORT_INDICATION: - DBG("SMS status report indication"); + qti_radio_ext_handle_sms_report_indication(self, &args); return NULL; case QTI_RADIO_IND_INCOMING_SMS_INDICATION: qti_radio_ext_handle_incoming_sms_indication(self, &args); @@ -578,6 +622,16 @@ qti_radio_ext_add_incoming_sms_handler( SIGNAL_EXT_ON_INCOMING_SMS_NAME, G_CALLBACK(handler), user_data) : 0; } +gulong +qti_radio_ext_add_sms_report_handler( + QtiRadioExt* self, + QtiRadioExtSmsReportFunc handler, + void* user_data) +{ + return (G_LIKELY(self) && G_LIKELY(handler)) ? g_signal_connect(self, + SIGNAL_EXT_ON_SMS_REPORT_NAME, G_CALLBACK(handler), user_data) : 0; +} + static GBinderLocalReply* qti_radio_ext_response( @@ -1404,6 +1458,10 @@ qti_radio_ext_class_init( g_signal_new(SIGNAL_EXT_ON_INCOMING_SMS_NAME, G_OBJECT_CLASS_TYPE(klass), G_SIGNAL_RUN_FIRST, 0, NULL, NULL, NULL, G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_UINT); + qti_radio_ext_signals[SIGNAL_EXT_ON_SMS_REPORT] = + g_signal_new(SIGNAL_EXT_ON_SMS_REPORT_NAME, G_OBJECT_CLASS_TYPE(klass), + G_SIGNAL_RUN_FIRST, 0, NULL, NULL, NULL, G_TYPE_NONE, + 4, G_TYPE_POINTER, G_TYPE_UINT, G_TYPE_UINT); } /* diff --git a/src/qti_radio_ext.h b/src/qti_radio_ext.h index 67ee233..d045f86 100644 --- a/src/qti_radio_ext.h +++ b/src/qti_radio_ext.h @@ -55,6 +55,13 @@ typedef void (*QtiRadioExtIncomingSmsFunc)( guint pdu_len, void* user_data); +typedef void (*QtiRadioExtSmsReportFunc)( + QtiRadioExt* radio, + const void* pdu, + gsize pdu_len, + guint32 message_ref, + void* user_data); + QtiRadioExt* qti_radio_ext_new( const char* dev, @@ -158,6 +165,12 @@ qti_radio_ext_add_incoming_sms_handler( QtiRadioExtIncomingSmsFunc handler, void* user_data); +gulong +qti_radio_ext_add_sms_report_handler( + QtiRadioExt* self, + QtiRadioExtSmsReportFunc handler, + void* user_data); + guint qti_radio_ext_acknowledge_sms( QtiRadioExt* self,