From 9235a24c11cfab7fc890fd9c65dd3db112046f98 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 4 Sep 2012 09:41:36 +0200 Subject: [PATCH] broadband-modem-qmi: if WMS service is available Messaging is supported --- src/mm-broadband-modem-qmi.c | 46 ++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index 8e4c1168..c893762b 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -4817,6 +4817,44 @@ modem_cdma_setup_unsolicited_events (MMIfaceModemCdma *self, user_data); } +/*****************************************************************************/ +/* Check support (Messaging interface) */ + +static gboolean +messaging_check_support_finish (MMIfaceModemMessaging *self, + GAsyncResult *res, + GError **error) +{ + /* no error expected here */ + return g_simple_async_result_get_op_res_gboolean (G_SIMPLE_ASYNC_RESULT (res)); +} + +static void +messaging_check_support (MMIfaceModemMessaging *self, + GAsyncReadyCallback callback, + gpointer user_data) +{ + GSimpleAsyncResult *result; + gboolean supported; + + result = g_simple_async_result_new (G_OBJECT (self), + callback, + user_data, + messaging_check_support); + + /* If we have support for the WMS client, messaging is supported */ + supported = !!mm_qmi_port_peek_client (mm_base_modem_peek_port_qmi (MM_BASE_MODEM (self)), + QMI_SERVICE_WMS, + MM_QMI_PORT_FLAG_DEFAULT); + + mm_dbg ("Messaging capabilities %s by this modem", + supported ? "supported" : "not supported"); + + g_simple_async_result_set_op_res_gboolean (result, supported); + g_simple_async_result_complete_in_idle (result); + g_object_unref (result); +} + /*****************************************************************************/ /* First initialization step */ @@ -4960,7 +4998,8 @@ initialization_started (MMBroadbandModem *self, /* Setup services to open */ ctx->services[0] = QMI_SERVICE_DMS; ctx->services[1] = QMI_SERVICE_NAS; - ctx->services[2] = QMI_SERVICE_UNKNOWN; + ctx->services[2] = QMI_SERVICE_WMS; + ctx->services[3] = QMI_SERVICE_UNKNOWN; /* Now open our QMI port */ mm_qmi_port_open (ctx->qmi, @@ -5158,9 +5197,8 @@ iface_modem_cdma_init (MMIfaceModemCdma *iface) static void iface_modem_messaging_init (MMIfaceModemMessaging *iface) { - /* Assume we don't have messaging support */ - iface->check_support = NULL; - iface->check_support_finish = NULL; + iface->check_support = messaging_check_support; + iface->check_support_finish = messaging_check_support_finish; } static void