iface-modem-messaging: need to enable/disable SMS indications
This commit is contained in:
@@ -424,6 +424,7 @@ static void interface_disabling_step (DisablingContext *ctx);
|
|||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
DISABLING_STEP_FIRST,
|
DISABLING_STEP_FIRST,
|
||||||
|
DISABLING_STEP_DISABLE_UNSOLICITED_EVENTS,
|
||||||
DISABLING_STEP_CLEANUP_UNSOLICITED_EVENTS,
|
DISABLING_STEP_CLEANUP_UNSOLICITED_EVENTS,
|
||||||
DISABLING_STEP_LAST
|
DISABLING_STEP_LAST
|
||||||
} DisablingStep;
|
} DisablingStep;
|
||||||
@@ -478,6 +479,25 @@ mm_iface_modem_messaging_disable_finish (MMIfaceModemMessaging *self,
|
|||||||
return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
|
return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
disable_unsolicited_events_ready (MMIfaceModemMessaging *self,
|
||||||
|
GAsyncResult *res,
|
||||||
|
DisablingContext *ctx)
|
||||||
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (self)->disable_unsolicited_events_finish (self, res, &error);
|
||||||
|
if (error) {
|
||||||
|
g_simple_async_result_take_error (ctx->result, error);
|
||||||
|
disabling_context_complete_and_free (ctx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Go on to next step */
|
||||||
|
ctx->step++;
|
||||||
|
interface_disabling_step (ctx);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cleanup_unsolicited_events_ready (MMIfaceModemMessaging *self,
|
cleanup_unsolicited_events_ready (MMIfaceModemMessaging *self,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
@@ -505,6 +525,19 @@ 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:
|
||||||
|
/* Allow cleaning up unsolicited events */
|
||||||
|
if (MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->disable_unsolicited_events &&
|
||||||
|
MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->disable_unsolicited_events_finish) {
|
||||||
|
MM_IFACE_MODEM_MESSAGING_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_CLEANUP_UNSOLICITED_EVENTS:
|
case DISABLING_STEP_CLEANUP_UNSOLICITED_EVENTS:
|
||||||
/* Allow cleaning up unsolicited events */
|
/* Allow cleaning up unsolicited events */
|
||||||
if (MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->cleanup_unsolicited_events &&
|
if (MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->cleanup_unsolicited_events &&
|
||||||
@@ -551,9 +584,10 @@ static void interface_enabling_step (EnablingContext *ctx);
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
ENABLING_STEP_FIRST,
|
ENABLING_STEP_FIRST,
|
||||||
ENABLING_STEP_SETUP_SMS_FORMAT,
|
ENABLING_STEP_SETUP_SMS_FORMAT,
|
||||||
ENABLING_STEP_SETUP_UNSOLICITED_EVENTS,
|
|
||||||
ENABLING_STEP_LOAD_INITIAL_SMS_PARTS,
|
ENABLING_STEP_LOAD_INITIAL_SMS_PARTS,
|
||||||
ENABLING_STEP_STORAGE_DEFAULTS,
|
ENABLING_STEP_STORAGE_DEFAULTS,
|
||||||
|
ENABLING_STEP_SETUP_UNSOLICITED_EVENTS,
|
||||||
|
ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS,
|
||||||
ENABLING_STEP_LAST
|
ENABLING_STEP_LAST
|
||||||
} EnablingStep;
|
} EnablingStep;
|
||||||
|
|
||||||
@@ -631,7 +665,6 @@ mm_iface_modem_messaging_enable_finish (MMIfaceModemMessaging *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
VOID_REPLY_READY_FN (setup_sms_format)
|
VOID_REPLY_READY_FN (setup_sms_format)
|
||||||
VOID_REPLY_READY_FN (setup_unsolicited_events)
|
|
||||||
|
|
||||||
static void load_initial_sms_parts_from_storages (EnablingContext *ctx);
|
static void load_initial_sms_parts_from_storages (EnablingContext *ctx);
|
||||||
|
|
||||||
@@ -707,6 +740,26 @@ set_default_storages_ready (MMIfaceModemMessaging *self,
|
|||||||
interface_enabling_step (ctx);
|
interface_enabling_step (ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID_REPLY_READY_FN (setup_unsolicited_events)
|
||||||
|
|
||||||
|
static void
|
||||||
|
enable_unsolicited_events_ready (MMIfaceModemMessaging *self,
|
||||||
|
GAsyncResult *res,
|
||||||
|
EnablingContext *ctx)
|
||||||
|
{
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
/* Not critical! */
|
||||||
|
if (!MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (self)->enable_unsolicited_events_finish (self, res, &error)) {
|
||||||
|
mm_dbg ("Couldn't enable unsolicited events: '%s'", error->message);
|
||||||
|
g_error_free (error);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Go on with next step */
|
||||||
|
ctx->step++;
|
||||||
|
interface_enabling_step (ctx);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
interface_enabling_step (EnablingContext *ctx)
|
interface_enabling_step (EnablingContext *ctx)
|
||||||
{
|
{
|
||||||
@@ -748,19 +801,6 @@ interface_enabling_step (EnablingContext *ctx)
|
|||||||
/* Fall down to next step */
|
/* Fall down to next step */
|
||||||
ctx->step++;
|
ctx->step++;
|
||||||
|
|
||||||
case ENABLING_STEP_SETUP_UNSOLICITED_EVENTS:
|
|
||||||
/* Allow setting up unsolicited events */
|
|
||||||
if (MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->setup_unsolicited_events &&
|
|
||||||
MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->setup_unsolicited_events_finish) {
|
|
||||||
MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->setup_unsolicited_events (
|
|
||||||
ctx->self,
|
|
||||||
(GAsyncReadyCallback)setup_unsolicited_events_ready,
|
|
||||||
ctx);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
/* Fall down to next step */
|
|
||||||
ctx->step++;
|
|
||||||
|
|
||||||
case ENABLING_STEP_LOAD_INITIAL_SMS_PARTS:
|
case ENABLING_STEP_LOAD_INITIAL_SMS_PARTS:
|
||||||
/* Allow loading the initial list of SMS parts */
|
/* Allow loading the initial list of SMS parts */
|
||||||
if (MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->load_initial_sms_parts &&
|
if (MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->load_initial_sms_parts &&
|
||||||
@@ -782,6 +822,32 @@ interface_enabling_step (EnablingContext *ctx)
|
|||||||
ctx);
|
ctx);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case ENABLING_STEP_SETUP_UNSOLICITED_EVENTS:
|
||||||
|
/* Allow setting up unsolicited events */
|
||||||
|
if (MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->setup_unsolicited_events &&
|
||||||
|
MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->setup_unsolicited_events_finish) {
|
||||||
|
MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->setup_unsolicited_events (
|
||||||
|
ctx->self,
|
||||||
|
(GAsyncReadyCallback)setup_unsolicited_events_ready,
|
||||||
|
ctx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* Fall down to next step */
|
||||||
|
ctx->step++;
|
||||||
|
|
||||||
|
case ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS:
|
||||||
|
/* Allow setting up unsolicited events */
|
||||||
|
if (MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->enable_unsolicited_events &&
|
||||||
|
MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->enable_unsolicited_events_finish) {
|
||||||
|
MM_IFACE_MODEM_MESSAGING_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);
|
||||||
|
@@ -98,6 +98,22 @@ struct _MMIfaceModemMessaging {
|
|||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
/* Asynchronous enabling unsolicited SMS reception events */
|
||||||
|
void (* enable_unsolicited_events) (MMIfaceModemMessaging *self,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data);
|
||||||
|
gboolean (* enable_unsolicited_events_finish) (MMIfaceModemMessaging *self,
|
||||||
|
GAsyncResult *res,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
/* Asynchronous disabling unsolicited SMS reception events */
|
||||||
|
void (* disable_unsolicited_events) (MMIfaceModemMessaging *self,
|
||||||
|
GAsyncReadyCallback callback,
|
||||||
|
gpointer user_data);
|
||||||
|
gboolean (* disable_unsolicited_events_finish) (MMIfaceModemMessaging *self,
|
||||||
|
GAsyncResult *res,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
/* Load initial SMS parts (async).
|
/* Load initial SMS parts (async).
|
||||||
* Found parts need to be reported with take_part() */
|
* Found parts need to be reported with take_part() */
|
||||||
void (* load_initial_sms_parts) (MMIfaceModemMessaging *self,
|
void (* load_initial_sms_parts) (MMIfaceModemMessaging *self,
|
||||||
|
Reference in New Issue
Block a user