iface-modem-3gpp-ussd: prefer 'events' naming to 'result codes'

The 'result codes' naming is much more AT-protocol specific, 'events'
is more generic.
This commit is contained in:
Aleksander Morgado
2018-08-21 16:50:15 +00:00
committed by Dan Williams
parent 3bc9a2dbe2
commit d16a1711fd
3 changed files with 96 additions and 104 deletions
+26 -26
View File
@@ -5204,9 +5204,9 @@ modem_3gpp_ussd_decode (MMIfaceModem3gppUssd *self,
/* Setup/Cleanup unsolicited result codes (3GPP/USSD interface) */
static gboolean
modem_3gpp_ussd_setup_cleanup_unsolicited_result_codes_finish (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GError **error)
modem_3gpp_ussd_setup_cleanup_unsolicited_events_finish (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GError **error)
{
return g_task_propagate_boolean (G_TASK (res), error);
}
@@ -5406,17 +5406,17 @@ set_unsolicited_result_code_handlers (MMIfaceModem3gppUssd *self,
}
static void
modem_3gpp_ussd_setup_unsolicited_result_codes (MMIfaceModem3gppUssd *self,
GAsyncReadyCallback callback,
gpointer user_data)
modem_3gpp_ussd_setup_unsolicited_events (MMIfaceModem3gppUssd *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
set_unsolicited_result_code_handlers (self, TRUE, callback, user_data);
}
static void
modem_3gpp_ussd_cleanup_unsolicited_result_codes (MMIfaceModem3gppUssd *self,
GAsyncReadyCallback callback,
gpointer user_data)
modem_3gpp_ussd_cleanup_unsolicited_events (MMIfaceModem3gppUssd *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
set_unsolicited_result_code_handlers (self, FALSE, callback, user_data);
}
@@ -5425,9 +5425,9 @@ modem_3gpp_ussd_cleanup_unsolicited_result_codes (MMIfaceModem3gppUssd *self,
/* Enable/Disable URCs (3GPP/USSD interface) */
static gboolean
modem_3gpp_ussd_enable_disable_unsolicited_result_codes_finish (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GError **error)
modem_3gpp_ussd_enable_disable_unsolicited_events_finish (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GError **error)
{
return g_task_propagate_boolean (G_TASK (res), error);
}
@@ -5451,9 +5451,9 @@ urc_enable_disable_ready (MMBroadbandModem *self,
}
static void
modem_3gpp_ussd_disable_unsolicited_result_codes (MMIfaceModem3gppUssd *self,
GAsyncReadyCallback callback,
gpointer user_data)
modem_3gpp_ussd_disable_unsolicited_events (MMIfaceModem3gppUssd *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
@@ -5468,9 +5468,9 @@ modem_3gpp_ussd_disable_unsolicited_result_codes (MMIfaceModem3gppUssd *self,
}
static void
modem_3gpp_ussd_enable_unsolicited_result_codes (MMIfaceModem3gppUssd *self,
GAsyncReadyCallback callback,
gpointer user_data)
modem_3gpp_ussd_enable_unsolicited_events (MMIfaceModem3gppUssd *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
@@ -11135,16 +11135,16 @@ iface_modem_3gpp_ussd_init (MMIfaceModem3gppUssd *iface)
iface->check_support_finish = modem_3gpp_ussd_check_support_finish;
/* Enabling steps */
iface->setup_unsolicited_result_codes = modem_3gpp_ussd_setup_unsolicited_result_codes;
iface->setup_unsolicited_result_codes_finish = modem_3gpp_ussd_setup_cleanup_unsolicited_result_codes_finish;
iface->enable_unsolicited_result_codes = modem_3gpp_ussd_enable_unsolicited_result_codes;
iface->enable_unsolicited_result_codes_finish = modem_3gpp_ussd_enable_disable_unsolicited_result_codes_finish;
iface->setup_unsolicited_events = modem_3gpp_ussd_setup_unsolicited_events;
iface->setup_unsolicited_events_finish = modem_3gpp_ussd_setup_cleanup_unsolicited_events_finish;
iface->enable_unsolicited_events = modem_3gpp_ussd_enable_unsolicited_events;
iface->enable_unsolicited_events_finish = modem_3gpp_ussd_enable_disable_unsolicited_events_finish;
/* Disabling steps */
iface->cleanup_unsolicited_result_codes_finish = modem_3gpp_ussd_setup_cleanup_unsolicited_result_codes_finish;
iface->cleanup_unsolicited_result_codes = modem_3gpp_ussd_cleanup_unsolicited_result_codes;
iface->disable_unsolicited_result_codes = modem_3gpp_ussd_disable_unsolicited_result_codes;
iface->disable_unsolicited_result_codes_finish = modem_3gpp_ussd_enable_disable_unsolicited_result_codes_finish;
iface->cleanup_unsolicited_events_finish = modem_3gpp_ussd_setup_cleanup_unsolicited_events_finish;
iface->cleanup_unsolicited_events = modem_3gpp_ussd_cleanup_unsolicited_events;
iface->disable_unsolicited_events = modem_3gpp_ussd_disable_unsolicited_events;
iface->disable_unsolicited_events_finish = modem_3gpp_ussd_enable_disable_unsolicited_events_finish;
/* Additional actions */
iface->encode = modem_3gpp_ussd_encode;
+36 -44
View File
@@ -467,8 +467,8 @@ static void interface_disabling_step (GTask *task);
typedef enum {
DISABLING_STEP_FIRST,
DISABLING_STEP_DISABLE_UNSOLICITED_RESULT_CODES,
DISABLING_STEP_CLEANUP_UNSOLICITED_RESULT_CODES,
DISABLING_STEP_DISABLE_UNSOLICITED_EVENTS,
DISABLING_STEP_CLEANUP_UNSOLICITED_EVENTS,
DISABLING_STEP_LAST
} DisablingStep;
@@ -494,19 +494,17 @@ mm_iface_modem_3gpp_ussd_disable_finish (MMIfaceModem3gppUssd *self,
}
static void
disable_unsolicited_result_codes_ready (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GTask *task)
disable_unsolicited_events_ready (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GTask *task)
{
DisablingContext *ctx;
GError *error = NULL;
MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->disable_unsolicited_result_codes_finish (self,
res,
&error);
MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->disable_unsolicited_events_finish (self, res, &error);
if (error) {
/* This error shouldn't be treated as critical */
mm_dbg ("Couldn't disable unsolicited result codes: '%s'", error->message);
mm_dbg ("Couldn't disable unsolicited USSD events: '%s'", error->message);
g_error_free (error);
}
@@ -517,19 +515,17 @@ disable_unsolicited_result_codes_ready (MMIfaceModem3gppUssd *self,
}
static void
cleanup_unsolicited_result_codes_ready (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GTask *task)
cleanup_unsolicited_events_ready (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GTask *task)
{
DisablingContext *ctx;
GError *error = NULL;
MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->cleanup_unsolicited_result_codes_finish (self,
res,
&error);
MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->cleanup_unsolicited_events_finish (self, res, &error);
if (error) {
/* This error shouldn't be treated as critical */
mm_dbg ("Couldn't cleanup unsolicited result codes: '%s'", error->message);
mm_dbg ("Couldn't cleanup unsolicited USSD events: '%s'", error->message);
g_error_free (error);
}
@@ -553,17 +549,17 @@ interface_disabling_step (GTask *task)
/* Fall down to next step */
ctx->step++;
case DISABLING_STEP_DISABLE_UNSOLICITED_RESULT_CODES:
MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->disable_unsolicited_result_codes (
case DISABLING_STEP_DISABLE_UNSOLICITED_EVENTS:
MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->disable_unsolicited_events (
self,
(GAsyncReadyCallback)disable_unsolicited_result_codes_ready,
(GAsyncReadyCallback)disable_unsolicited_events_ready,
task);
return;
case DISABLING_STEP_CLEANUP_UNSOLICITED_RESULT_CODES:
MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->cleanup_unsolicited_result_codes (
case DISABLING_STEP_CLEANUP_UNSOLICITED_EVENTS:
MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->cleanup_unsolicited_events (
self,
(GAsyncReadyCallback)cleanup_unsolicited_result_codes_ready,
(GAsyncReadyCallback)cleanup_unsolicited_events_ready,
task);
return;
@@ -615,8 +611,8 @@ static void interface_enabling_step (GTask *task);
typedef enum {
ENABLING_STEP_FIRST,
ENABLING_STEP_SETUP_UNSOLICITED_RESULT_CODES,
ENABLING_STEP_ENABLE_UNSOLICITED_RESULT_CODES,
ENABLING_STEP_SETUP_UNSOLICITED_EVENTS,
ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS,
ENABLING_STEP_LAST
} EnablingStep;
@@ -642,19 +638,17 @@ mm_iface_modem_3gpp_ussd_enable_finish (MMIfaceModem3gppUssd *self,
}
static void
setup_unsolicited_result_codes_ready (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GTask *task)
setup_unsolicited_events_ready (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GTask *task)
{
EnablingContext *ctx;
GError *error = NULL;
MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->setup_unsolicited_result_codes_finish (self,
res,
&error);
MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->setup_unsolicited_events_finish (self, res, &error);
if (error) {
/* This error shouldn't be treated as critical */
mm_dbg ("Couldn't setup unsolicited result codes: '%s'", error->message);
mm_dbg ("Couldn't setup unsolicited USSD events: '%s'", error->message);
g_error_free (error);
}
@@ -665,19 +659,17 @@ setup_unsolicited_result_codes_ready (MMIfaceModem3gppUssd *self,
}
static void
enable_unsolicited_result_codes_ready (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GTask *task)
enable_unsolicited_events_ready (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GTask *task)
{
EnablingContext *ctx;
GError *error = NULL;
MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->enable_unsolicited_result_codes_finish (self,
res,
&error);
MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->enable_unsolicited_events_finish (self, res, &error);
if (error) {
/* This error shouldn't be treated as critical */
mm_dbg ("Couldn't enable unsolicited result codes: '%s'", error->message);
mm_dbg ("Couldn't enable unsolicited USSD events: '%s'", error->message);
g_error_free (error);
}
@@ -701,17 +693,17 @@ interface_enabling_step (GTask *task)
/* Fall down to next step */
ctx->step++;
case ENABLING_STEP_SETUP_UNSOLICITED_RESULT_CODES:
MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->setup_unsolicited_result_codes (
case ENABLING_STEP_SETUP_UNSOLICITED_EVENTS:
MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->setup_unsolicited_events (
self,
(GAsyncReadyCallback)setup_unsolicited_result_codes_ready,
(GAsyncReadyCallback)setup_unsolicited_events_ready,
task);
return;
case ENABLING_STEP_ENABLE_UNSOLICITED_RESULT_CODES:
MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->enable_unsolicited_result_codes (
case ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS:
MM_IFACE_MODEM_3GPP_USSD_GET_INTERFACE (self)->enable_unsolicited_events (
self,
(GAsyncReadyCallback)enable_unsolicited_result_codes_ready,
(GAsyncReadyCallback)enable_unsolicited_events_ready,
task);
return;
+34 -34
View File
@@ -40,44 +40,44 @@ struct _MMIfaceModem3gppUssd {
GTypeInterface g_iface;
/* Check for USSD support (async) */
void (* check_support) (MMIfaceModem3gppUssd *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (*check_support_finish) (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GError **error);
void (* check_support) (MMIfaceModem3gppUssd *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (* check_support_finish) (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GError **error);
/* Asynchronous setup of unsolicited result codes */
void (*setup_unsolicited_result_codes) (MMIfaceModem3gppUssd *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (*setup_unsolicited_result_codes_finish) (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GError **error);
/* Asynchronous setup of unsolicited events */
void (* setup_unsolicited_events) (MMIfaceModem3gppUssd *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (* setup_unsolicited_events_finish) (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GError **error);
/* Asynchronous enabling of unsolicited result codes */
void (*enable_unsolicited_result_codes) (MMIfaceModem3gppUssd *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (*enable_unsolicited_result_codes_finish) (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GError **error);
/* Asynchronous enabling of unsolicited events */
void (* enable_unsolicited_events) (MMIfaceModem3gppUssd *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (* enable_unsolicited_events_finish) (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GError **error);
/* Asynchronous disabling of unsolicited result codes */
void (*disable_unsolicited_result_codes) (MMIfaceModem3gppUssd *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (*disable_unsolicited_result_codes_finish) (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GError **error);
/* Asynchronous disabling of unsolicited events */
void (* disable_unsolicited_events) (MMIfaceModem3gppUssd *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (* disable_unsolicited_events_finish) (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GError **error);
/* Asynchronous cleaning up of unsolicited result codes */
void (*cleanup_unsolicited_result_codes) (MMIfaceModem3gppUssd *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (*cleanup_unsolicited_result_codes_finish) (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GError **error);
/* Asynchronous cleaning up of unsolicited events */
void (* cleanup_unsolicited_events) (MMIfaceModem3gppUssd *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (* cleanup_unsolicited_events_finish) (MMIfaceModem3gppUssd *self,
GAsyncResult *res,
GError **error);
/* Encode/Decode */
gchar * (*encode) (MMIfaceModem3gppUssd *self,