mirror of
https://gitlab.com/ubports/development/core/hybris-support/ofono-binder-plugin-ext-qti
synced 2025-11-03 20:45:53 +08:00
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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user