broadband-modem: handle the new 'Signal' interface

This commit is contained in:
Aleksander Morgado
2013-07-08 21:11:02 +02:00
parent d368d30c53
commit 5ef439e2d6

View File

@@ -37,6 +37,7 @@
#include "mm-iface-modem-messaging.h" #include "mm-iface-modem-messaging.h"
#include "mm-iface-modem-time.h" #include "mm-iface-modem-time.h"
#include "mm-iface-modem-firmware.h" #include "mm-iface-modem-firmware.h"
#include "mm-iface-modem-signal.h"
#include "mm-broadband-bearer.h" #include "mm-broadband-bearer.h"
#include "mm-bearer-list.h" #include "mm-bearer-list.h"
#include "mm-sms-list.h" #include "mm-sms-list.h"
@@ -56,6 +57,7 @@ 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); static void iface_modem_messaging_init (MMIfaceModemMessaging *iface);
static void iface_modem_time_init (MMIfaceModemTime *iface); static void iface_modem_time_init (MMIfaceModemTime *iface);
static void iface_modem_signal_init (MMIfaceModemSignal *iface);
static void iface_modem_firmware_init (MMIfaceModemFirmware *iface); static void iface_modem_firmware_init (MMIfaceModemFirmware *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,
@@ -67,6 +69,7 @@ G_DEFINE_TYPE_EXTENDED (MMBroadbandModem, mm_broadband_modem, MM_TYPE_BASE_MODEM
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) G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_MESSAGING, iface_modem_messaging_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_TIME, iface_modem_time_init) G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_TIME, iface_modem_time_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_SIGNAL, iface_modem_signal_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_FIRMWARE, iface_modem_firmware_init)) G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_MODEM_FIRMWARE, iface_modem_firmware_init))
enum { enum {
@@ -79,6 +82,7 @@ enum {
PROP_MODEM_LOCATION_DBUS_SKELETON, PROP_MODEM_LOCATION_DBUS_SKELETON,
PROP_MODEM_MESSAGING_DBUS_SKELETON, PROP_MODEM_MESSAGING_DBUS_SKELETON,
PROP_MODEM_TIME_DBUS_SKELETON, PROP_MODEM_TIME_DBUS_SKELETON,
PROP_MODEM_SIGNAL_DBUS_SKELETON,
PROP_MODEM_FIRMWARE_DBUS_SKELETON, PROP_MODEM_FIRMWARE_DBUS_SKELETON,
PROP_MODEM_SIM, PROP_MODEM_SIM,
PROP_MODEM_BEARER_LIST, PROP_MODEM_BEARER_LIST,
@@ -184,6 +188,10 @@ struct _MMBroadbandModemPrivate {
/* Properties */ /* Properties */
GObject *modem_time_dbus_skeleton; GObject *modem_time_dbus_skeleton;
/*<--- Modem Signal interface --->*/
/* Properties */
GObject *modem_signal_dbus_skeleton;
/*<--- Modem Firmware interface --->*/ /*<--- Modem Firmware interface --->*/
/* Properties */ /* Properties */
GObject *modem_firmware_dbus_skeleton; GObject *modem_firmware_dbus_skeleton;
@@ -7925,6 +7933,7 @@ typedef enum {
DISABLING_STEP_DISCONNECT_BEARERS, DISABLING_STEP_DISCONNECT_BEARERS,
DISABLING_STEP_IFACE_SIMPLE, DISABLING_STEP_IFACE_SIMPLE,
DISABLING_STEP_IFACE_FIRMWARE, DISABLING_STEP_IFACE_FIRMWARE,
DISABLING_STEP_IFACE_SIGNAL,
DISABLING_STEP_IFACE_TIME, DISABLING_STEP_IFACE_TIME,
DISABLING_STEP_IFACE_MESSAGING, DISABLING_STEP_IFACE_MESSAGING,
DISABLING_STEP_IFACE_LOCATION, DISABLING_STEP_IFACE_LOCATION,
@@ -8035,6 +8044,7 @@ INTERFACE_DISABLE_READY_FN (iface_modem_3gpp_ussd, MM_IFACE_MODEM_3GPP_USSD, TRU
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) INTERFACE_DISABLE_READY_FN (iface_modem_messaging, MM_IFACE_MODEM_MESSAGING, FALSE)
INTERFACE_DISABLE_READY_FN (iface_modem_signal, MM_IFACE_MODEM_SIGNAL, FALSE)
INTERFACE_DISABLE_READY_FN (iface_modem_time, MM_IFACE_MODEM_TIME, FALSE) INTERFACE_DISABLE_READY_FN (iface_modem_time, MM_IFACE_MODEM_TIME, FALSE)
static void static void
@@ -8133,6 +8143,18 @@ disabling_step (DisablingContext *ctx)
/* Fall down to next step */ /* Fall down to next step */
ctx->step++; ctx->step++;
case DISABLING_STEP_IFACE_SIGNAL:
if (ctx->self->priv->modem_signal_dbus_skeleton) {
mm_dbg ("Modem has extended signal reporting capabilities, disabling the Signal interface...");
/* Disabling the Modem Signal interface */
mm_iface_modem_signal_disable (MM_IFACE_MODEM_SIGNAL (ctx->self),
(GAsyncReadyCallback)iface_modem_signal_disable_ready,
ctx);
return;
}
/* Fall down to next step */
ctx->step++;
case DISABLING_STEP_IFACE_TIME: case DISABLING_STEP_IFACE_TIME:
if (ctx->self->priv->modem_time_dbus_skeleton) { if (ctx->self->priv->modem_time_dbus_skeleton) {
mm_dbg ("Modem has time capabilities, disabling the Time interface..."); mm_dbg ("Modem has time capabilities, disabling the Time interface...");
@@ -8264,6 +8286,7 @@ typedef enum {
ENABLING_STEP_IFACE_LOCATION, ENABLING_STEP_IFACE_LOCATION,
ENABLING_STEP_IFACE_MESSAGING, ENABLING_STEP_IFACE_MESSAGING,
ENABLING_STEP_IFACE_TIME, ENABLING_STEP_IFACE_TIME,
ENABLING_STEP_IFACE_SIGNAL,
ENABLING_STEP_IFACE_FIRMWARE, ENABLING_STEP_IFACE_FIRMWARE,
ENABLING_STEP_IFACE_SIMPLE, ENABLING_STEP_IFACE_SIMPLE,
ENABLING_STEP_LAST, ENABLING_STEP_LAST,
@@ -8361,6 +8384,7 @@ 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) INTERFACE_ENABLE_READY_FN (iface_modem_messaging, MM_IFACE_MODEM_MESSAGING, FALSE)
INTERFACE_ENABLE_READY_FN (iface_modem_signal, MM_IFACE_MODEM_SIGNAL, FALSE)
INTERFACE_ENABLE_READY_FN (iface_modem_time, MM_IFACE_MODEM_TIME, FALSE) INTERFACE_ENABLE_READY_FN (iface_modem_time, MM_IFACE_MODEM_TIME, FALSE)
static void static void
@@ -8531,6 +8555,19 @@ enabling_step (EnablingContext *ctx)
/* Fall down to next step */ /* Fall down to next step */
ctx->step++; ctx->step++;
case ENABLING_STEP_IFACE_SIGNAL:
if (ctx->self->priv->modem_signal_dbus_skeleton) {
mm_dbg ("Modem has extended signal reporting capabilities, enabling the Signal interface...");
/* Enabling the Modem Signal interface */
mm_iface_modem_signal_enable (MM_IFACE_MODEM_SIGNAL (ctx->self),
ctx->cancellable,
(GAsyncReadyCallback)iface_modem_signal_enable_ready,
ctx);
return;
}
/* Fall down to next step */
ctx->step++;
case ENABLING_STEP_IFACE_FIRMWARE: case ENABLING_STEP_IFACE_FIRMWARE:
/* Fall down to next step */ /* Fall down to next step */
ctx->step++; ctx->step++;
@@ -8641,6 +8678,7 @@ typedef enum {
INITIALIZE_STEP_IFACE_LOCATION, INITIALIZE_STEP_IFACE_LOCATION,
INITIALIZE_STEP_IFACE_MESSAGING, INITIALIZE_STEP_IFACE_MESSAGING,
INITIALIZE_STEP_IFACE_TIME, INITIALIZE_STEP_IFACE_TIME,
INITIALIZE_STEP_IFACE_SIGNAL,
INITIALIZE_STEP_IFACE_FIRMWARE, INITIALIZE_STEP_IFACE_FIRMWARE,
INITIALIZE_STEP_IFACE_SIMPLE, INITIALIZE_STEP_IFACE_SIMPLE,
INITIALIZE_STEP_LAST, INITIALIZE_STEP_LAST,
@@ -8836,6 +8874,7 @@ 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) INTERFACE_INIT_READY_FN (iface_modem_messaging, MM_IFACE_MODEM_MESSAGING, FALSE)
INTERFACE_INIT_READY_FN (iface_modem_time, MM_IFACE_MODEM_TIME, FALSE) INTERFACE_INIT_READY_FN (iface_modem_time, MM_IFACE_MODEM_TIME, FALSE)
INTERFACE_INIT_READY_FN (iface_modem_signal, MM_IFACE_MODEM_SIGNAL, FALSE)
INTERFACE_INIT_READY_FN (iface_modem_firmware, MM_IFACE_MODEM_FIRMWARE, FALSE) INTERFACE_INIT_READY_FN (iface_modem_firmware, MM_IFACE_MODEM_FIRMWARE, FALSE)
static void static void
@@ -8948,6 +8987,14 @@ initialize_step (InitializeContext *ctx)
ctx); ctx);
return; return;
case INITIALIZE_STEP_IFACE_SIGNAL:
/* Initialize the Signal interface */
mm_iface_modem_signal_initialize (MM_IFACE_MODEM_SIGNAL (ctx->self),
ctx->cancellable,
(GAsyncReadyCallback)iface_modem_signal_initialize_ready,
ctx);
return;
case INITIALIZE_STEP_IFACE_FIRMWARE: case INITIALIZE_STEP_IFACE_FIRMWARE:
/* Initialize the Firmware interface */ /* Initialize the Firmware interface */
mm_iface_modem_firmware_initialize (MM_IFACE_MODEM_FIRMWARE (ctx->self), mm_iface_modem_firmware_initialize (MM_IFACE_MODEM_FIRMWARE (ctx->self),
@@ -9189,6 +9236,10 @@ set_property (GObject *object,
g_clear_object (&self->priv->modem_time_dbus_skeleton); g_clear_object (&self->priv->modem_time_dbus_skeleton);
self->priv->modem_time_dbus_skeleton = g_value_dup_object (value); self->priv->modem_time_dbus_skeleton = g_value_dup_object (value);
break; break;
case PROP_MODEM_SIGNAL_DBUS_SKELETON:
g_clear_object (&self->priv->modem_signal_dbus_skeleton);
self->priv->modem_signal_dbus_skeleton = g_value_dup_object (value);
break;
case PROP_MODEM_FIRMWARE_DBUS_SKELETON: case PROP_MODEM_FIRMWARE_DBUS_SKELETON:
g_clear_object (&self->priv->modem_firmware_dbus_skeleton); g_clear_object (&self->priv->modem_firmware_dbus_skeleton);
self->priv->modem_firmware_dbus_skeleton = g_value_dup_object (value); self->priv->modem_firmware_dbus_skeleton = g_value_dup_object (value);
@@ -9284,6 +9335,9 @@ get_property (GObject *object,
case PROP_MODEM_TIME_DBUS_SKELETON: case PROP_MODEM_TIME_DBUS_SKELETON:
g_value_set_object (value, self->priv->modem_time_dbus_skeleton); g_value_set_object (value, self->priv->modem_time_dbus_skeleton);
break; break;
case PROP_MODEM_SIGNAL_DBUS_SKELETON:
g_value_set_object (value, self->priv->modem_signal_dbus_skeleton);
break;
case PROP_MODEM_FIRMWARE_DBUS_SKELETON: case PROP_MODEM_FIRMWARE_DBUS_SKELETON:
g_value_set_object (value, self->priv->modem_firmware_dbus_skeleton); g_value_set_object (value, self->priv->modem_firmware_dbus_skeleton);
break; break;
@@ -9622,6 +9676,11 @@ iface_modem_time_init (MMIfaceModemTime *iface)
{ {
} }
static void
iface_modem_signal_init (MMIfaceModemSignal *iface)
{
}
static void static void
iface_modem_firmware_init (MMIfaceModemFirmware *iface) iface_modem_firmware_init (MMIfaceModemFirmware *iface)
{ {
@@ -9690,6 +9749,10 @@ mm_broadband_modem_class_init (MMBroadbandModemClass *klass)
PROP_MODEM_TIME_DBUS_SKELETON, PROP_MODEM_TIME_DBUS_SKELETON,
MM_IFACE_MODEM_TIME_DBUS_SKELETON); MM_IFACE_MODEM_TIME_DBUS_SKELETON);
g_object_class_override_property (object_class,
PROP_MODEM_SIGNAL_DBUS_SKELETON,
MM_IFACE_MODEM_SIGNAL_DBUS_SKELETON);
g_object_class_override_property (object_class, g_object_class_override_property (object_class,
PROP_MODEM_FIRMWARE_DBUS_SKELETON, PROP_MODEM_FIRMWARE_DBUS_SKELETON,
MM_IFACE_MODEM_FIRMWARE_DBUS_SKELETON); MM_IFACE_MODEM_FIRMWARE_DBUS_SKELETON);