iface-modem-3gpp: cleanup unsolicited registration messages during disable
This commit is contained in:
@@ -570,6 +570,7 @@ static void interface_disabling_step (DisablingContext *ctx);
|
||||
|
||||
typedef enum {
|
||||
DISABLING_STEP_FIRST,
|
||||
DISABLING_STEP_CLEANUP_UNSOLICITED_REGISTRATION,
|
||||
DISABLING_STEP_LAST
|
||||
} DisablingStep;
|
||||
|
||||
@@ -623,6 +624,29 @@ mm_iface_modem_3gpp_disable_finish (MMIfaceModem3gpp *self,
|
||||
return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
|
||||
}
|
||||
|
||||
#undef VOID_REPLY_READY_FN
|
||||
#define VOID_REPLY_READY_FN(NAME,DISPLAY) \
|
||||
static void \
|
||||
NAME##_ready (MMIfaceModem3gpp *self, \
|
||||
GAsyncResult *res, \
|
||||
DisablingContext *ctx) \
|
||||
{ \
|
||||
GError *error = NULL; \
|
||||
\
|
||||
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->NAME##_finish (self, res, &error); \
|
||||
if (error) { \
|
||||
mm_dbg ("Couldn't %s: '%s'", DISPLAY, error->message); \
|
||||
g_error_free (error); \
|
||||
} \
|
||||
\
|
||||
/* Go on to next step */ \
|
||||
ctx->step++; \
|
||||
interface_disabling_step (ctx); \
|
||||
}
|
||||
|
||||
VOID_REPLY_READY_FN (cleanup_unsolicited_registration,
|
||||
"cleanup unsolicited registration")
|
||||
|
||||
static void
|
||||
interface_disabling_step (DisablingContext *ctx)
|
||||
{
|
||||
@@ -631,6 +655,18 @@ interface_disabling_step (DisablingContext *ctx)
|
||||
/* Fall down to next step */
|
||||
ctx->step++;
|
||||
|
||||
case DISABLING_STEP_CLEANUP_UNSOLICITED_REGISTRATION:
|
||||
if (MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_unsolicited_registration &&
|
||||
MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_unsolicited_registration_finish) {
|
||||
MM_IFACE_MODEM_3GPP_GET_INTERFACE (ctx->self)->cleanup_unsolicited_registration (
|
||||
ctx->self,
|
||||
(GAsyncReadyCallback)cleanup_unsolicited_registration_ready,
|
||||
ctx);
|
||||
return;
|
||||
}
|
||||
/* Fall down to next step */
|
||||
ctx->step++;
|
||||
|
||||
case DISABLING_STEP_LAST:
|
||||
/* We are done without errors! */
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
|
||||
@@ -50,6 +50,14 @@ struct _MMIfaceModem3gpp {
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
/* Cleanup unsolicited registration messages */
|
||||
void (* cleanup_unsolicited_registration) (MMIfaceModem3gpp *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean (*cleanup_unsolicited_registration_finish) (MMIfaceModem3gpp *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
/* Setup CS Registration */
|
||||
void (* setup_cs_registration) (MMIfaceModem3gpp *self,
|
||||
GAsyncReadyCallback callback,
|
||||
|
||||
Reference in New Issue
Block a user