iface-modem-messaging: allow configuring preferred SMS format

This commit is contained in:
Aleksander Morgado
2012-02-01 09:58:32 +01:00
parent 14fa4aae1d
commit 21b1de678d
2 changed files with 42 additions and 0 deletions

View File

@@ -135,6 +135,7 @@ static void interface_enabling_step (EnablingContext *ctx);
typedef enum { typedef enum {
ENABLING_STEP_FIRST, ENABLING_STEP_FIRST,
ENABLING_STEP_SETUP_SMS_FORMAT,
ENABLING_STEP_LAST ENABLING_STEP_LAST
} EnablingStep; } EnablingStep;
@@ -188,6 +189,28 @@ mm_iface_modem_messaging_enable_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
setup_sms_format_ready (MMIfaceModemMessaging *self,
GAsyncResult *res,
EnablingContext *ctx)
{
GError *error = NULL;
if (!MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (self)->setup_sms_format_finish (self,
res,
&error)) {
g_simple_async_result_take_error (ctx->result, error);
enabling_context_complete_and_free (ctx);
return;
}
mm_dbg ("SMS format correctly setup");
/* Go on to next step */
ctx->step++;
interface_enabling_step (ctx);
}
static void static void
interface_enabling_step (EnablingContext *ctx) interface_enabling_step (EnablingContext *ctx)
{ {
@@ -204,6 +227,17 @@ interface_enabling_step (EnablingContext *ctx)
/* Fall down to next step */ /* Fall down to next step */
ctx->step++; ctx->step++;
} }
case ENABLING_STEP_SETUP_SMS_FORMAT:
/* Allow setting SMS format to use */
if (MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->setup_sms_format &&
MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->setup_sms_format_finish) {
MM_IFACE_MODEM_MESSAGING_GET_INTERFACE (ctx->self)->setup_sms_format (
ctx->self,
(GAsyncReadyCallback)setup_sms_format_ready,
ctx);
return;
}
/* Fall down to next step */ /* Fall down to next step */
ctx->step++; ctx->step++;

View File

@@ -41,6 +41,14 @@ struct _MMIfaceModemMessaging {
gboolean (*check_support_finish) (MMIfaceModemMessaging *self, gboolean (*check_support_finish) (MMIfaceModemMessaging *self,
GAsyncResult *res, GAsyncResult *res,
GError **error); GError **error);
/* Setup SMS format (async) */
void (* setup_sms_format) (MMIfaceModemMessaging *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (*setup_sms_format_finish) (MMIfaceModemMessaging *self,
GAsyncResult *res,
GError **error);
}; };
GType mm_iface_modem_messaging_get_type (void); GType mm_iface_modem_messaging_get_type (void);