broadband-modem: implement the Messaging interface

This commit is contained in:
Aleksander Morgado
2012-01-25 13:04:30 +01:00
parent bc0454badf
commit 52f1c87b06

View File

@@ -34,6 +34,7 @@
#include "mm-iface-modem-cdma.h" #include "mm-iface-modem-cdma.h"
#include "mm-iface-modem-simple.h" #include "mm-iface-modem-simple.h"
#include "mm-iface-modem-location.h" #include "mm-iface-modem-location.h"
#include "mm-iface-modem-messaging.h"
#include "mm-broadband-bearer.h" #include "mm-broadband-bearer.h"
#include "mm-bearer-list.h" #include "mm-bearer-list.h"
#include "mm-sim.h" #include "mm-sim.h"
@@ -51,6 +52,7 @@ static void iface_modem_3gpp_ussd_init (MMIfaceModem3gppUssd *iface);
static void iface_modem_cdma_init (MMIfaceModemCdma *iface); static void iface_modem_cdma_init (MMIfaceModemCdma *iface);
static void iface_modem_simple_init (MMIfaceModemSimple *iface); static void iface_modem_simple_init (MMIfaceModemSimple *iface);
static void iface_modem_location_init (MMIfaceModemLocation *iface); static void iface_modem_location_init (MMIfaceModemLocation *iface);
static void iface_modem_messaging_init (MMIfaceModemMessaging *iface);
G_DEFINE_TYPE_EXTENDED (MMBroadbandModem, mm_broadband_modem, MM_TYPE_BASE_MODEM, 0, G_DEFINE_TYPE_EXTENDED (MMBroadbandModem, mm_broadband_modem, MM_TYPE_BASE_MODEM, 0,
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init) G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM, iface_modem_init)
@@ -58,7 +60,8 @@ G_DEFINE_TYPE_EXTENDED (MMBroadbandModem, mm_broadband_modem, MM_TYPE_BASE_MODEM
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_3GPP_USSD, iface_modem_3gpp_ussd_init) G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_3GPP_USSD, iface_modem_3gpp_ussd_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_CDMA, iface_modem_cdma_init) G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_CDMA, iface_modem_cdma_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_SIMPLE, iface_modem_simple_init) G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_SIMPLE, iface_modem_simple_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_LOCATION, iface_modem_location_init)); G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_LOCATION, iface_modem_location_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_MESSAGING, iface_modem_messaging_init));
enum { enum {
PROP_0, PROP_0,
@@ -68,6 +71,7 @@ enum {
PROP_MODEM_CDMA_DBUS_SKELETON, PROP_MODEM_CDMA_DBUS_SKELETON,
PROP_MODEM_SIMPLE_DBUS_SKELETON, PROP_MODEM_SIMPLE_DBUS_SKELETON,
PROP_MODEM_LOCATION_DBUS_SKELETON, PROP_MODEM_LOCATION_DBUS_SKELETON,
PROP_MODEM_MESSAGING_DBUS_SKELETON,
PROP_MODEM_SIM, PROP_MODEM_SIM,
PROP_MODEM_BEARER_LIST, PROP_MODEM_BEARER_LIST,
PROP_MODEM_STATE, PROP_MODEM_STATE,
@@ -141,6 +145,10 @@ struct _MMBroadbandModemPrivate {
/* Properties */ /* Properties */
GObject *modem_location_dbus_skeleton; GObject *modem_location_dbus_skeleton;
GVariant *modem_location_dictionary; GVariant *modem_location_dictionary;
/*<--- Modem Messaging interface --->*/
/* Properties */
GObject *modem_messaging_dbus_skeleton;
}; };
/*****************************************************************************/ /*****************************************************************************/
@@ -4656,6 +4664,7 @@ INTERFACE_DISABLE_READY_FN (iface_modem_3gpp, MM_IFACE_MODEM_3GPP, TRU
INTERFACE_DISABLE_READY_FN (iface_modem_3gpp_ussd, MM_IFACE_MODEM_3GPP_USSD, TRUE) INTERFACE_DISABLE_READY_FN (iface_modem_3gpp_ussd, MM_IFACE_MODEM_3GPP_USSD, TRUE)
INTERFACE_DISABLE_READY_FN (iface_modem_cdma, MM_IFACE_MODEM_CDMA, TRUE) INTERFACE_DISABLE_READY_FN (iface_modem_cdma, MM_IFACE_MODEM_CDMA, TRUE)
INTERFACE_DISABLE_READY_FN (iface_modem_location, MM_IFACE_MODEM_LOCATION, FALSE) INTERFACE_DISABLE_READY_FN (iface_modem_location, MM_IFACE_MODEM_LOCATION, FALSE)
INTERFACE_DISABLE_READY_FN (iface_modem_messaging, MM_IFACE_MODEM_MESSAGING, FALSE)
static void static void
bearer_list_disconnect_all_bearers_ready (MMBearerList *list, bearer_list_disconnect_all_bearers_ready (MMBearerList *list,
@@ -4695,6 +4704,14 @@ disabling_step (DisablingContext *ctx)
ctx->step++; ctx->step++;
case DISABLING_STEP_IFACE_MESSAGING: case DISABLING_STEP_IFACE_MESSAGING:
if (ctx->self->priv->modem_messaging_dbus_skeleton) {
mm_dbg ("Modem has messaging capabilities, disabling the Messaging interface...");
/* Disabling the Modem Messaging interface */
mm_iface_modem_messaging_disable (MM_IFACE_MODEM_MESSAGING (ctx->self),
(GAsyncReadyCallback)iface_modem_messaging_disable_ready,
ctx);
return;
}
/* Fall down to next step */ /* Fall down to next step */
ctx->step++; ctx->step++;
@@ -4911,6 +4928,7 @@ INTERFACE_ENABLE_READY_FN (iface_modem_3gpp, MM_IFACE_MODEM_3GPP, TRUE
INTERFACE_ENABLE_READY_FN (iface_modem_3gpp_ussd, MM_IFACE_MODEM_3GPP_USSD, TRUE) INTERFACE_ENABLE_READY_FN (iface_modem_3gpp_ussd, MM_IFACE_MODEM_3GPP_USSD, TRUE)
INTERFACE_ENABLE_READY_FN (iface_modem_cdma, MM_IFACE_MODEM_CDMA, TRUE) INTERFACE_ENABLE_READY_FN (iface_modem_cdma, MM_IFACE_MODEM_CDMA, TRUE)
INTERFACE_ENABLE_READY_FN (iface_modem_location, MM_IFACE_MODEM_LOCATION, FALSE) INTERFACE_ENABLE_READY_FN (iface_modem_location, MM_IFACE_MODEM_LOCATION, FALSE)
INTERFACE_ENABLE_READY_FN (iface_modem_messaging, MM_IFACE_MODEM_MESSAGING, FALSE)
static void static void
enabling_step (EnablingContext *ctx) enabling_step (EnablingContext *ctx)
@@ -4984,6 +5002,14 @@ enabling_step (EnablingContext *ctx)
ctx->step++; ctx->step++;
case ENABLING_STEP_IFACE_MESSAGING: case ENABLING_STEP_IFACE_MESSAGING:
if (ctx->self->priv->modem_messaging_dbus_skeleton) {
mm_dbg ("Modem has messaging capabilities, enabling the Messaging interface...");
/* Enabling the Modem Messaging interface */
mm_iface_modem_messaging_enable (MM_IFACE_MODEM_MESSAGING (ctx->self),
(GAsyncReadyCallback)iface_modem_messaging_enable_ready,
ctx);
return;
}
/* Fall down to next step */ /* Fall down to next step */
ctx->step++; ctx->step++;
@@ -5156,6 +5182,7 @@ INTERFACE_INIT_READY_FN (iface_modem_3gpp, MM_IFACE_MODEM_3GPP, TRUE)
INTERFACE_INIT_READY_FN (iface_modem_3gpp_ussd, MM_IFACE_MODEM_3GPP_USSD, FALSE) INTERFACE_INIT_READY_FN (iface_modem_3gpp_ussd, MM_IFACE_MODEM_3GPP_USSD, FALSE)
INTERFACE_INIT_READY_FN (iface_modem_cdma, MM_IFACE_MODEM_CDMA, TRUE) INTERFACE_INIT_READY_FN (iface_modem_cdma, MM_IFACE_MODEM_CDMA, TRUE)
INTERFACE_INIT_READY_FN (iface_modem_location, MM_IFACE_MODEM_LOCATION, FALSE) INTERFACE_INIT_READY_FN (iface_modem_location, MM_IFACE_MODEM_LOCATION, FALSE)
INTERFACE_INIT_READY_FN (iface_modem_messaging, MM_IFACE_MODEM_MESSAGING, FALSE)
static void static void
initialize_step (InitializeContext *ctx) initialize_step (InitializeContext *ctx)
@@ -5252,8 +5279,12 @@ initialize_step (InitializeContext *ctx)
return; return;
case INITIALIZE_STEP_IFACE_MESSAGING: case INITIALIZE_STEP_IFACE_MESSAGING:
/* Fall down to next step */ /* Initialize the Messaging interface */
ctx->step++; mm_iface_modem_messaging_initialize (MM_IFACE_MODEM_MESSAGING (ctx->self),
ctx->port,
(GAsyncReadyCallback)iface_modem_messaging_initialize_ready,
ctx);
return;
case INITIALIZE_STEP_IFACE_SIMPLE: case INITIALIZE_STEP_IFACE_SIMPLE:
mm_iface_modem_simple_initialize (MM_IFACE_MODEM_SIMPLE (ctx->self)); mm_iface_modem_simple_initialize (MM_IFACE_MODEM_SIMPLE (ctx->self));
@@ -5342,6 +5373,10 @@ set_property (GObject *object,
g_clear_object (&self->priv->modem_location_dbus_skeleton); g_clear_object (&self->priv->modem_location_dbus_skeleton);
self->priv->modem_location_dbus_skeleton = g_value_dup_object (value); self->priv->modem_location_dbus_skeleton = g_value_dup_object (value);
break; break;
case PROP_MODEM_MESSAGING_DBUS_SKELETON:
g_clear_object (&self->priv->modem_messaging_dbus_skeleton);
self->priv->modem_messaging_dbus_skeleton = g_value_dup_object (value);
break;
case PROP_MODEM_SIM: case PROP_MODEM_SIM:
g_clear_object (&self->priv->modem_sim); g_clear_object (&self->priv->modem_sim);
self->priv->modem_sim = g_value_dup_object (value); self->priv->modem_sim = g_value_dup_object (value);
@@ -5414,6 +5449,9 @@ get_property (GObject *object,
case PROP_MODEM_LOCATION_DBUS_SKELETON: case PROP_MODEM_LOCATION_DBUS_SKELETON:
g_value_set_object (value, self->priv->modem_location_dbus_skeleton); g_value_set_object (value, self->priv->modem_location_dbus_skeleton);
break; break;
case PROP_MODEM_MESSAGING_DBUS_SKELETON:
g_value_set_object (value, self->priv->modem_messaging_dbus_skeleton);
break;
case PROP_MODEM_SIM: case PROP_MODEM_SIM:
g_value_set_object (value, self->priv->modem_sim); g_value_set_object (value, self->priv->modem_sim);
break; break;
@@ -5517,6 +5555,11 @@ dispose (GObject *object)
g_clear_object (&self->priv->modem_location_dbus_skeleton); g_clear_object (&self->priv->modem_location_dbus_skeleton);
} }
if (self->priv->modem_messaging_dbus_skeleton) {
mm_iface_modem_messaging_shutdown (MM_IFACE_MODEM_MESSAGING (object));
g_clear_object (&self->priv->modem_messaging_dbus_skeleton);
}
if (self->priv->modem_simple_dbus_skeleton) { if (self->priv->modem_simple_dbus_skeleton) {
mm_iface_modem_simple_shutdown (MM_IFACE_MODEM_SIMPLE (object)); mm_iface_modem_simple_shutdown (MM_IFACE_MODEM_SIMPLE (object));
g_clear_object (&self->priv->modem_simple_dbus_skeleton); g_clear_object (&self->priv->modem_simple_dbus_skeleton);
@@ -5685,6 +5728,11 @@ iface_modem_location_init (MMIfaceModemLocation *iface)
iface->load_capabilities_finish = modem_location_load_capabilities_finish; iface->load_capabilities_finish = modem_location_load_capabilities_finish;
} }
static void
iface_modem_messaging_init (MMIfaceModemMessaging *iface)
{
}
static void static void
mm_broadband_modem_class_init (MMBroadbandModemClass *klass) mm_broadband_modem_class_init (MMBroadbandModemClass *klass)
{ {
@@ -5730,6 +5778,10 @@ mm_broadband_modem_class_init (MMBroadbandModemClass *klass)
PROP_MODEM_LOCATION_DBUS_SKELETON, PROP_MODEM_LOCATION_DBUS_SKELETON,
MM_IFACE_MODEM_LOCATION_DBUS_SKELETON); MM_IFACE_MODEM_LOCATION_DBUS_SKELETON);
g_object_class_override_property (object_class,
PROP_MODEM_MESSAGING_DBUS_SKELETON,
MM_IFACE_MODEM_MESSAGING_DBUS_SKELETON);
g_object_class_override_property (object_class, g_object_class_override_property (object_class,
PROP_MODEM_SIM, PROP_MODEM_SIM,
MM_IFACE_MODEM_SIM); MM_IFACE_MODEM_SIM);