iface-modem-3gpp: indicators and unsolicited events are 3GPP-specific
Moved code from the Modem interface, as this is really 3GPP-specific
This commit is contained in:
@@ -984,7 +984,7 @@ load_signal_quality (MMIfaceModem *self,
|
|||||||
/* SETTING UP INDICATORS */
|
/* SETTING UP INDICATORS */
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
setup_indicators_finish (MMIfaceModem *self,
|
setup_indicators_finish (MMIfaceModem3gpp *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@@ -1036,7 +1036,7 @@ setup_indicators_ready (MMBroadbandModem *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup_indicators (MMIfaceModem *self,
|
setup_indicators (MMIfaceModem3gpp *self,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
@@ -1114,7 +1114,7 @@ unsolicited_events_context_complete_and_free (UnsolicitedEventsContext *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
unsolicited_events_finish (MMIfaceModem *self,
|
unsolicited_events_finish (MMIfaceModem3gpp *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@@ -1198,7 +1198,7 @@ unsolicited_events (UnsolicitedEventsContext *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
enable_unsolicited_events (MMIfaceModem *self,
|
enable_unsolicited_events (MMIfaceModem3gpp *self,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
@@ -1217,9 +1217,9 @@ enable_unsolicited_events (MMIfaceModem *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
disable_unsolicited_events (MMIfaceModem *self,
|
disable_unsolicited_events (MMIfaceModem3gpp *self,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
UnsolicitedEventsContext *ctx;
|
UnsolicitedEventsContext *ctx;
|
||||||
|
|
||||||
@@ -3351,14 +3351,6 @@ iface_modem_init (MMIfaceModem *iface)
|
|||||||
iface->load_supported_charsets_finish = load_supported_charsets_finish;
|
iface->load_supported_charsets_finish = load_supported_charsets_finish;
|
||||||
iface->setup_charset = setup_charset;
|
iface->setup_charset = setup_charset;
|
||||||
iface->setup_charset_finish = setup_charset_finish;
|
iface->setup_charset_finish = setup_charset_finish;
|
||||||
iface->setup_indicators = setup_indicators;
|
|
||||||
iface->setup_indicators_finish = setup_indicators_finish;
|
|
||||||
iface->enable_unsolicited_events = enable_unsolicited_events;
|
|
||||||
iface->enable_unsolicited_events_finish = unsolicited_events_finish;
|
|
||||||
|
|
||||||
/* Disabling steps */
|
|
||||||
iface->disable_unsolicited_events = disable_unsolicited_events;
|
|
||||||
iface->disable_unsolicited_events_finish = unsolicited_events_finish;
|
|
||||||
|
|
||||||
/* Additional actions */
|
/* Additional actions */
|
||||||
iface->load_signal_quality = load_signal_quality;
|
iface->load_signal_quality = load_signal_quality;
|
||||||
@@ -3375,6 +3367,10 @@ iface_modem_3gpp_init (MMIfaceModem3gpp *iface)
|
|||||||
iface->load_imei_finish = load_imei_finish;
|
iface->load_imei_finish = load_imei_finish;
|
||||||
|
|
||||||
/* Enabling steps */
|
/* Enabling steps */
|
||||||
|
iface->setup_indicators = setup_indicators;
|
||||||
|
iface->setup_indicators_finish = setup_indicators_finish;
|
||||||
|
iface->enable_unsolicited_events = enable_unsolicited_events;
|
||||||
|
iface->enable_unsolicited_events_finish = unsolicited_events_finish;
|
||||||
iface->setup_unsolicited_registration = setup_unsolicited_registration;
|
iface->setup_unsolicited_registration = setup_unsolicited_registration;
|
||||||
iface->setup_unsolicited_registration_finish = setup_unsolicited_registration_finish;
|
iface->setup_unsolicited_registration_finish = setup_unsolicited_registration_finish;
|
||||||
iface->setup_cs_registration = setup_cs_registration;
|
iface->setup_cs_registration = setup_cs_registration;
|
||||||
@@ -3383,6 +3379,8 @@ iface_modem_3gpp_init (MMIfaceModem3gpp *iface)
|
|||||||
iface->setup_ps_registration_finish = setup_ps_registration_finish;
|
iface->setup_ps_registration_finish = setup_ps_registration_finish;
|
||||||
|
|
||||||
/* Disabling steps */
|
/* Disabling steps */
|
||||||
|
iface->disable_unsolicited_events = disable_unsolicited_events;
|
||||||
|
iface->disable_unsolicited_events_finish = unsolicited_events_finish;
|
||||||
iface->cleanup_unsolicited_registration = cleanup_unsolicited_registration;
|
iface->cleanup_unsolicited_registration = cleanup_unsolicited_registration;
|
||||||
iface->cleanup_unsolicited_registration_finish = cleanup_unsolicited_registration_finish;
|
iface->cleanup_unsolicited_registration_finish = cleanup_unsolicited_registration_finish;
|
||||||
iface->cleanup_cs_registration = cleanup_cs_registration;
|
iface->cleanup_cs_registration = cleanup_cs_registration;
|
||||||
|
@@ -24,6 +24,12 @@
|
|||||||
#include "mm-modem-helpers.h"
|
#include "mm-modem-helpers.h"
|
||||||
#include "mm-log.h"
|
#include "mm-log.h"
|
||||||
|
|
||||||
|
#define INDICATORS_CHECKED_TAG "indicators-checked-tag"
|
||||||
|
#define UNSOLICITED_EVENTS_SUPPORTED_TAG "unsolicited-events-supported-tag"
|
||||||
|
|
||||||
|
static GQuark indicators_checked_quark;
|
||||||
|
static GQuark unsolicited_events_supported_quark;
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -900,6 +906,7 @@ typedef enum {
|
|||||||
DISABLING_STEP_CLEANUP_PS_REGISTRATION,
|
DISABLING_STEP_CLEANUP_PS_REGISTRATION,
|
||||||
DISABLING_STEP_CLEANUP_CS_REGISTRATION,
|
DISABLING_STEP_CLEANUP_CS_REGISTRATION,
|
||||||
DISABLING_STEP_CLEANUP_UNSOLICITED_REGISTRATION,
|
DISABLING_STEP_CLEANUP_UNSOLICITED_REGISTRATION,
|
||||||
|
DISABLING_STEP_DISABLE_UNSOLICITED_EVENTS,
|
||||||
DISABLING_STEP_LAST
|
DISABLING_STEP_LAST
|
||||||
} DisablingStep;
|
} DisablingStep;
|
||||||
|
|
||||||
@@ -997,6 +1004,8 @@ VOID_REPLY_READY_FN (cleanup_ps_registration,
|
|||||||
"cleanup PS registration")
|
"cleanup PS registration")
|
||||||
VOID_REPLY_READY_FN (cleanup_cs_registration,
|
VOID_REPLY_READY_FN (cleanup_cs_registration,
|
||||||
"cleanup CS registration")
|
"cleanup CS registration")
|
||||||
|
VOID_REPLY_READY_FN (disable_unsolicited_events,
|
||||||
|
"disable unsolicited events")
|
||||||
|
|
||||||
static void
|
static void
|
||||||
interface_disabling_step (DisablingContext *ctx)
|
interface_disabling_step (DisablingContext *ctx)
|
||||||
@@ -1053,6 +1062,26 @@ interface_disabling_step (DisablingContext *ctx)
|
|||||||
/* Fall down to next step */
|
/* Fall down to next step */
|
||||||
ctx->step++;
|
ctx->step++;
|
||||||
|
|
||||||
|
case DISABLING_STEP_DISABLE_UNSOLICITED_EVENTS:
|
||||||
|
if (G_UNLIKELY (!unsolicited_events_supported_quark))
|
||||||
|
unsolicited_events_supported_quark = (g_quark_from_static_string (
|
||||||
|
UNSOLICITED_EVENTS_SUPPORTED_TAG));
|
||||||
|
|
||||||
|
/* Only try to disable if supported */
|
||||||
|
if (GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (ctx->self),
|
||||||
|
unsolicited_events_supported_quark))) {
|
||||||
|
if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->disable_unsolicited_events &&
|
||||||
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->disable_unsolicited_events_finish) {
|
||||||
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->disable_unsolicited_events (
|
||||||
|
ctx->self,
|
||||||
|
(GAsyncReadyCallback)disable_unsolicited_events_ready,
|
||||||
|
ctx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Fall down to next step */
|
||||||
|
ctx->step++;
|
||||||
|
|
||||||
case DISABLING_STEP_LAST:
|
case DISABLING_STEP_LAST:
|
||||||
/* We are done without errors! */
|
/* We are done without errors! */
|
||||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||||
@@ -1080,6 +1109,8 @@ static void interface_enabling_step (EnablingContext *ctx);
|
|||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ENABLING_STEP_FIRST,
|
ENABLING_STEP_FIRST,
|
||||||
|
ENABLING_STEP_SETUP_INDICATORS,
|
||||||
|
ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS,
|
||||||
ENABLING_STEP_SETUP_UNSOLICITED_REGISTRATION,
|
ENABLING_STEP_SETUP_UNSOLICITED_REGISTRATION,
|
||||||
ENABLING_STEP_SETUP_CS_REGISTRATION,
|
ENABLING_STEP_SETUP_CS_REGISTRATION,
|
||||||
ENABLING_STEP_SETUP_PS_REGISTRATION,
|
ENABLING_STEP_SETUP_PS_REGISTRATION,
|
||||||
@@ -1158,6 +1189,60 @@ mm_iface_modem_3gpp_enable_finish (MMIfaceModem3gpp *self,
|
|||||||
interface_enabling_step (ctx); \
|
interface_enabling_step (ctx); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
setup_indicators_ready (MMIfaceModem3gpp *self,
|
||||||
|
GAsyncResult *res,
|
||||||
|
EnablingContext *ctx)
|
||||||
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->setup_indicators_finish (self, res, &error);
|
||||||
|
if (error) {
|
||||||
|
/* This error shouldn't be treated as critical */
|
||||||
|
mm_dbg ("Indicator control setup failed: '%s'", error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
|
||||||
|
/* If we get an error setting up indicators, don't even bother trying to
|
||||||
|
* enable unsolicited events. */
|
||||||
|
ctx->step = ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS + 1;
|
||||||
|
interface_enabling_step (ctx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Indicators setup, so assume we support unsolicited events */
|
||||||
|
g_object_set_qdata (G_OBJECT (self),
|
||||||
|
unsolicited_events_supported_quark,
|
||||||
|
GUINT_TO_POINTER (TRUE));
|
||||||
|
|
||||||
|
/* Go on to next step */
|
||||||
|
ctx->step++;
|
||||||
|
interface_enabling_step (ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
enable_unsolicited_events_ready (MMIfaceModem3gpp *self,
|
||||||
|
GAsyncResult *res,
|
||||||
|
EnablingContext *ctx)
|
||||||
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->enable_unsolicited_events_finish (self, res, &error);
|
||||||
|
if (error) {
|
||||||
|
/* This error shouldn't be treated as critical */
|
||||||
|
mm_dbg ("Enabling unsolicited events failed: '%s'", error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
|
||||||
|
/* Reset support flag */
|
||||||
|
g_object_set_qdata (G_OBJECT (self),
|
||||||
|
unsolicited_events_supported_quark,
|
||||||
|
GUINT_TO_POINTER (FALSE));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Go on to next step */
|
||||||
|
ctx->step++;
|
||||||
|
interface_enabling_step (ctx);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setup_cs_registration_ready (MMIfaceModem3gpp *self,
|
setup_cs_registration_ready (MMIfaceModem3gpp *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
@@ -1226,6 +1311,51 @@ interface_enabling_step (EnablingContext *ctx)
|
|||||||
{
|
{
|
||||||
switch (ctx->step) {
|
switch (ctx->step) {
|
||||||
case ENABLING_STEP_FIRST:
|
case ENABLING_STEP_FIRST:
|
||||||
|
/* Setup quarks if we didn't do it before */
|
||||||
|
if (G_UNLIKELY (!indicators_checked_quark))
|
||||||
|
indicators_checked_quark = (g_quark_from_static_string (
|
||||||
|
INDICATORS_CHECKED_TAG));
|
||||||
|
if (G_UNLIKELY (!unsolicited_events_supported_quark))
|
||||||
|
unsolicited_events_supported_quark = (g_quark_from_static_string (
|
||||||
|
UNSOLICITED_EVENTS_SUPPORTED_TAG));
|
||||||
|
/* Fall down to next step */
|
||||||
|
ctx->step++;
|
||||||
|
|
||||||
|
case ENABLING_STEP_SETUP_INDICATORS:
|
||||||
|
if (!GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (ctx->self),
|
||||||
|
indicators_checked_quark))) {
|
||||||
|
/* Set the checked flag so that we don't run it again */
|
||||||
|
g_object_set_qdata (G_OBJECT (ctx->self),
|
||||||
|
indicators_checked_quark,
|
||||||
|
GUINT_TO_POINTER (TRUE));
|
||||||
|
/* Initially, assume we don't support unsolicited events */
|
||||||
|
g_object_set_qdata (G_OBJECT (ctx->self),
|
||||||
|
unsolicited_events_supported_quark,
|
||||||
|
GUINT_TO_POINTER (FALSE));
|
||||||
|
if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->setup_indicators &&
|
||||||
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->setup_indicators_finish) {
|
||||||
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->setup_indicators (
|
||||||
|
ctx->self,
|
||||||
|
(GAsyncReadyCallback)setup_indicators_ready,
|
||||||
|
ctx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Fall down to next step */
|
||||||
|
ctx->step++;
|
||||||
|
|
||||||
|
case ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS:
|
||||||
|
if (!GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (ctx->self),
|
||||||
|
unsolicited_events_supported_quark))) {
|
||||||
|
if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->enable_unsolicited_events &&
|
||||||
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->enable_unsolicited_events_finish) {
|
||||||
|
MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->enable_unsolicited_events (
|
||||||
|
ctx->self,
|
||||||
|
(GAsyncReadyCallback)enable_unsolicited_events_ready,
|
||||||
|
ctx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
/* Fall down to next step */
|
/* Fall down to next step */
|
||||||
ctx->step++;
|
ctx->step++;
|
||||||
|
|
||||||
|
@@ -44,6 +44,30 @@ struct _MMIfaceModem3gpp {
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
/* Asynchronous setup of indicators */
|
||||||
|
void (*setup_indicators) (MMIfaceModem3gpp *self,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data);
|
||||||
|
gboolean (*setup_indicators_finish) (MMIfaceModem3gpp *self,
|
||||||
|
GAsyncResult *res,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
/* Asynchronous enabling of unsolicited events */
|
||||||
|
void (*enable_unsolicited_events) (MMIfaceModem3gpp *self,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data);
|
||||||
|
gboolean (*enable_unsolicited_events_finish) (MMIfaceModem3gpp *self,
|
||||||
|
GAsyncResult *res,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
/* Asynchronous disabling of unsolicited events */
|
||||||
|
void (*disable_unsolicited_events) (MMIfaceModem3gpp *self,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data);
|
||||||
|
gboolean (*disable_unsolicited_events_finish) (MMIfaceModem3gpp *self,
|
||||||
|
GAsyncResult *res,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
/* Setup unsolicited registration messages */
|
/* Setup unsolicited registration messages */
|
||||||
void (* setup_unsolicited_registration) (MMIfaceModem3gpp *self,
|
void (* setup_unsolicited_registration) (MMIfaceModem3gpp *self,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
|
@@ -27,13 +27,9 @@
|
|||||||
#define SIGNAL_QUALITY_RECENT_TIMEOUT_SEC 60
|
#define SIGNAL_QUALITY_RECENT_TIMEOUT_SEC 60
|
||||||
#define SIGNAL_QUALITY_CHECK_TIMEOUT_SEC 30
|
#define SIGNAL_QUALITY_CHECK_TIMEOUT_SEC 30
|
||||||
|
|
||||||
#define INDICATORS_CHECKED_TAG "indicators-checked-tag"
|
|
||||||
#define UNSOLICITED_EVENTS_SUPPORTED_TAG "unsolicited-events-supported-tag"
|
|
||||||
#define SIGNAL_QUALITY_UPDATE_CONTEXT_TAG "signal-quality-update-context-tag"
|
#define SIGNAL_QUALITY_UPDATE_CONTEXT_TAG "signal-quality-update-context-tag"
|
||||||
#define SIGNAL_QUALITY_CHECK_CONTEXT_TAG "signal-quality-check-context-tag"
|
#define SIGNAL_QUALITY_CHECK_CONTEXT_TAG "signal-quality-check-context-tag"
|
||||||
|
|
||||||
static GQuark indicators_checked_quark;
|
|
||||||
static GQuark unsolicited_events_supported_quark;
|
|
||||||
static GQuark signal_quality_update_context_quark;
|
static GQuark signal_quality_update_context_quark;
|
||||||
static GQuark signal_quality_check_context_quark;
|
static GQuark signal_quality_check_context_quark;
|
||||||
|
|
||||||
@@ -1580,7 +1576,6 @@ static void interface_disabling_step (DisablingContext *ctx);
|
|||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DISABLING_STEP_FIRST,
|
DISABLING_STEP_FIRST,
|
||||||
DISABLING_STEP_DISABLE_UNSOLICITED_EVENTS,
|
|
||||||
DISABLING_STEP_MODEM_POWER_DOWN,
|
DISABLING_STEP_MODEM_POWER_DOWN,
|
||||||
DISABLING_STEP_CLOSE_PORTS,
|
DISABLING_STEP_CLOSE_PORTS,
|
||||||
DISABLING_STEP_LAST
|
DISABLING_STEP_LAST
|
||||||
@@ -1687,7 +1682,6 @@ mm_iface_modem_disable_finish (MMIfaceModem *self,
|
|||||||
interface_disabling_step (ctx); \
|
interface_disabling_step (ctx); \
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID_REPLY_READY_FN (disable_unsolicited_events)
|
|
||||||
VOID_REPLY_READY_FN (modem_power_down)
|
VOID_REPLY_READY_FN (modem_power_down)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1698,26 +1692,6 @@ interface_disabling_step (DisablingContext *ctx)
|
|||||||
/* Fall down to next step */
|
/* Fall down to next step */
|
||||||
ctx->step++;
|
ctx->step++;
|
||||||
|
|
||||||
case DISABLING_STEP_DISABLE_UNSOLICITED_EVENTS:
|
|
||||||
if (G_UNLIKELY (!unsolicited_events_supported_quark))
|
|
||||||
unsolicited_events_supported_quark = (g_quark_from_static_string (
|
|
||||||
UNSOLICITED_EVENTS_SUPPORTED_TAG));
|
|
||||||
|
|
||||||
/* Only try to disable if supported */
|
|
||||||
if (GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (ctx->self),
|
|
||||||
unsolicited_events_supported_quark))) {
|
|
||||||
if (MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->disable_unsolicited_events &&
|
|
||||||
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->disable_unsolicited_events_finish) {
|
|
||||||
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->disable_unsolicited_events (
|
|
||||||
ctx->self,
|
|
||||||
(GAsyncReadyCallback)disable_unsolicited_events_ready,
|
|
||||||
ctx);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Fall down to next step */
|
|
||||||
ctx->step++;
|
|
||||||
|
|
||||||
case DISABLING_STEP_MODEM_POWER_DOWN:
|
case DISABLING_STEP_MODEM_POWER_DOWN:
|
||||||
/* CFUN=0 is dangerous and often will shoot devices in the head (that's
|
/* CFUN=0 is dangerous and often will shoot devices in the head (that's
|
||||||
* what it's supposed to do). So don't use CFUN=0 by default, but let
|
* what it's supposed to do). So don't use CFUN=0 by default, but let
|
||||||
@@ -1789,8 +1763,6 @@ typedef enum {
|
|||||||
ENABLING_STEP_FLOW_CONTROL,
|
ENABLING_STEP_FLOW_CONTROL,
|
||||||
ENABLING_STEP_SUPPORTED_CHARSETS,
|
ENABLING_STEP_SUPPORTED_CHARSETS,
|
||||||
ENABLING_STEP_CHARSET,
|
ENABLING_STEP_CHARSET,
|
||||||
ENABLING_STEP_SETUP_INDICATORS,
|
|
||||||
ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS,
|
|
||||||
ENABLING_STEP_LAST
|
ENABLING_STEP_LAST
|
||||||
} EnablingStep;
|
} EnablingStep;
|
||||||
|
|
||||||
@@ -1914,60 +1886,6 @@ VOID_REPLY_READY_FN (modem_power_up);
|
|||||||
VOID_REPLY_READY_FN (modem_after_power_up);
|
VOID_REPLY_READY_FN (modem_after_power_up);
|
||||||
VOID_REPLY_READY_FN (setup_flow_control);
|
VOID_REPLY_READY_FN (setup_flow_control);
|
||||||
|
|
||||||
static void
|
|
||||||
setup_indicators_ready (MMIfaceModem *self,
|
|
||||||
GAsyncResult *res,
|
|
||||||
EnablingContext *ctx)
|
|
||||||
{
|
|
||||||
GError *error = NULL;
|
|
||||||
|
|
||||||
MM_IFACE_MODEM_GET_INTERFACE (self)->setup_indicators_finish (self, res, &error);
|
|
||||||
if (error) {
|
|
||||||
/* This error shouldn't be treated as critical */
|
|
||||||
mm_dbg ("Indicator control setup failed: '%s'", error->message);
|
|
||||||
g_error_free (error);
|
|
||||||
|
|
||||||
/* If we get an error setting up indicators, don't even bother trying to
|
|
||||||
* enable unsolicited events. */
|
|
||||||
ctx->step = ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS + 1;
|
|
||||||
interface_enabling_step (ctx);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Indicators setup, so assume we support unsolicited events */
|
|
||||||
g_object_set_qdata (G_OBJECT (self),
|
|
||||||
unsolicited_events_supported_quark,
|
|
||||||
GUINT_TO_POINTER (TRUE));
|
|
||||||
|
|
||||||
/* Go on to next step */
|
|
||||||
ctx->step++;
|
|
||||||
interface_enabling_step (ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
enable_unsolicited_events_ready (MMIfaceModem *self,
|
|
||||||
GAsyncResult *res,
|
|
||||||
EnablingContext *ctx)
|
|
||||||
{
|
|
||||||
GError *error = NULL;
|
|
||||||
|
|
||||||
MM_IFACE_MODEM_GET_INTERFACE (self)->enable_unsolicited_events_finish (self, res, &error);
|
|
||||||
if (error) {
|
|
||||||
/* This error shouldn't be treated as critical */
|
|
||||||
mm_dbg ("Enabling unsolicited events failed: '%s'", error->message);
|
|
||||||
g_error_free (error);
|
|
||||||
|
|
||||||
/* Reset support flag */
|
|
||||||
g_object_set_qdata (G_OBJECT (self),
|
|
||||||
unsolicited_events_supported_quark,
|
|
||||||
GUINT_TO_POINTER (FALSE));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Go on to next step */
|
|
||||||
ctx->step++;
|
|
||||||
interface_enabling_step (ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
load_supported_charsets_ready (MMIfaceModem *self,
|
load_supported_charsets_ready (MMIfaceModem *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
@@ -2040,13 +1958,6 @@ interface_enabling_step (EnablingContext *ctx)
|
|||||||
{
|
{
|
||||||
switch (ctx->step) {
|
switch (ctx->step) {
|
||||||
case ENABLING_STEP_FIRST:
|
case ENABLING_STEP_FIRST:
|
||||||
/* Setup quarks if we didn't do it before */
|
|
||||||
if (G_UNLIKELY (!indicators_checked_quark))
|
|
||||||
indicators_checked_quark = (g_quark_from_static_string (
|
|
||||||
INDICATORS_CHECKED_TAG));
|
|
||||||
if (G_UNLIKELY (!unsolicited_events_supported_quark))
|
|
||||||
unsolicited_events_supported_quark = (g_quark_from_static_string (
|
|
||||||
UNSOLICITED_EVENTS_SUPPORTED_TAG));
|
|
||||||
/* Fall down to next step */
|
/* Fall down to next step */
|
||||||
ctx->step++;
|
ctx->step++;
|
||||||
|
|
||||||
@@ -2195,44 +2106,6 @@ interface_enabling_step (EnablingContext *ctx)
|
|||||||
/* Fall down to next step */
|
/* Fall down to next step */
|
||||||
ctx->step++;
|
ctx->step++;
|
||||||
|
|
||||||
case ENABLING_STEP_SETUP_INDICATORS:
|
|
||||||
if (!GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (ctx->self),
|
|
||||||
indicators_checked_quark))) {
|
|
||||||
/* Set the checked flag so that we don't run it again */
|
|
||||||
g_object_set_qdata (G_OBJECT (ctx->self),
|
|
||||||
indicators_checked_quark,
|
|
||||||
GUINT_TO_POINTER (TRUE));
|
|
||||||
/* Initially, assume we don't support unsolicited events */
|
|
||||||
g_object_set_qdata (G_OBJECT (ctx->self),
|
|
||||||
unsolicited_events_supported_quark,
|
|
||||||
GUINT_TO_POINTER (FALSE));
|
|
||||||
if (MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->setup_indicators &&
|
|
||||||
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->setup_indicators_finish) {
|
|
||||||
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->setup_indicators (
|
|
||||||
ctx->self,
|
|
||||||
(GAsyncReadyCallback)setup_indicators_ready,
|
|
||||||
ctx);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Fall down to next step */
|
|
||||||
ctx->step++;
|
|
||||||
|
|
||||||
case ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS:
|
|
||||||
if (!GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (ctx->self),
|
|
||||||
unsolicited_events_supported_quark))) {
|
|
||||||
if (MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->enable_unsolicited_events &&
|
|
||||||
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->enable_unsolicited_events_finish) {
|
|
||||||
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->enable_unsolicited_events (
|
|
||||||
ctx->self,
|
|
||||||
(GAsyncReadyCallback)enable_unsolicited_events_ready,
|
|
||||||
ctx);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Fall down to next step */
|
|
||||||
ctx->step++;
|
|
||||||
|
|
||||||
case ENABLING_STEP_LAST:
|
case ENABLING_STEP_LAST:
|
||||||
/* We are done without errors! */
|
/* We are done without errors! */
|
||||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||||
|
@@ -222,30 +222,6 @@ struct _MMIfaceModem {
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
/* Asynchronous setup of indicators */
|
|
||||||
void (*setup_indicators) (MMIfaceModem *self,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data);
|
|
||||||
gboolean (*setup_indicators_finish) (MMIfaceModem *self,
|
|
||||||
GAsyncResult *res,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
/* Asynchronous enabling of unsolicited events */
|
|
||||||
void (*enable_unsolicited_events) (MMIfaceModem *self,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data);
|
|
||||||
gboolean (*enable_unsolicited_events_finish) (MMIfaceModem *self,
|
|
||||||
GAsyncResult *res,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
/* Asynchronous disabling of unsolicited events */
|
|
||||||
void (*disable_unsolicited_events) (MMIfaceModem *self,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data);
|
|
||||||
gboolean (*disable_unsolicited_events_finish) (MMIfaceModem *self,
|
|
||||||
GAsyncResult *res,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
/* Asynchronous modem power-down operation */
|
/* Asynchronous modem power-down operation */
|
||||||
void (*modem_power_down) (MMIfaceModem *self,
|
void (*modem_power_down) (MMIfaceModem *self,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
|
Reference in New Issue
Block a user