api: deprecate SubscriptionState property

This commit is contained in:
Aleksander Morgado
2018-10-26 09:41:44 -07:00
committed by Ben Chan
parent 408a2a9c6c
commit 025fcb7e92
6 changed files with 17 additions and 125 deletions
-33
View File
@@ -3954,37 +3954,6 @@ modem_3gpp_load_operator_name (MMIfaceModem3gpp *self,
mm_base_modem_at_command (MM_BASE_MODEM (self), "+COPS?", 3, FALSE, callback, user_data);
}
/*****************************************************************************/
/* Subscription State Loading (3GPP interface) */
static MMModem3gppSubscriptionState
modem_3gpp_load_subscription_state_finish (MMIfaceModem3gpp *self,
GAsyncResult *res,
GError **error)
{
GError *inner_error = NULL;
gssize value;
value = g_task_propagate_int (G_TASK (res), &inner_error);
if (inner_error) {
g_propagate_error (error, inner_error);
return MM_MODEM_3GPP_SUBSCRIPTION_STATE_UNKNOWN;
}
return (MMModem3gppSubscriptionState)value;
}
static void
modem_3gpp_load_subscription_state (MMIfaceModem3gpp *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
task = g_task_new (self, NULL, callback, user_data);
g_task_return_int (task, MM_MODEM_3GPP_SUBSCRIPTION_STATE_UNKNOWN);
g_object_unref (task);
}
/*****************************************************************************/
/* UE mode of operation for EPS loading (3GPP interface) */
@@ -11182,8 +11151,6 @@ iface_modem_3gpp_init (MMIfaceModem3gpp *iface)
iface->load_operator_code_finish = modem_3gpp_load_operator_code_finish;
iface->load_operator_name = modem_3gpp_load_operator_name;
iface->load_operator_name_finish = modem_3gpp_load_operator_name_finish;
iface->load_subscription_state = modem_3gpp_load_subscription_state;
iface->load_subscription_state_finish = modem_3gpp_load_subscription_state_finish;
iface->run_registration_checks = modem_3gpp_run_registration_checks;
iface->run_registration_checks_finish = modem_3gpp_run_registration_checks_finish;
iface->register_in_network = modem_3gpp_register_in_network;
-80
View File
@@ -64,10 +64,6 @@ mm_iface_modem_3gpp_bind_simple_status (MMIfaceModem3gpp *self,
status, MM_SIMPLE_PROPERTY_3GPP_OPERATOR_NAME,
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
g_object_bind_property (skeleton, "subscription-state",
status, MM_SIMPLE_PROPERTY_3GPP_SUBSCRIPTION_STATE,
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
g_object_unref (skeleton);
}
@@ -962,7 +958,6 @@ typedef struct {
MmGdbusModem3gpp *skeleton;
gboolean operator_code_loaded;
gboolean operator_name_loaded;
gboolean subscription_state_loaded;
} ReloadCurrentRegistrationInfoContext;
static void
@@ -1043,31 +1038,6 @@ load_operator_code_ready (MMIfaceModem3gpp *self,
reload_current_registration_info_context_step (task);
}
static void
load_subscription_state_ready (MMIfaceModem3gpp *self,
GAsyncResult *res,
GTask *task)
{
ReloadCurrentRegistrationInfoContext *ctx;
GError *error = NULL;
MMModem3gppSubscriptionState subscription_state = MM_MODEM_3GPP_SUBSCRIPTION_STATE_UNKNOWN;
ctx = g_task_get_task_data (task);
subscription_state = MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_subscription_state_finish (self, res, &error);
if (error) {
mm_warn ("Couldn't load Subscription State: '%s'", error->message);
g_error_free (error);
}
if (ctx->skeleton)
mm_gdbus_modem3gpp_set_subscription_state (ctx->skeleton, subscription_state);
ctx->subscription_state_loaded = TRUE;
reload_current_registration_info_context_step (task);
}
static void
reload_current_registration_info_context_step (GTask *task)
{
@@ -1095,15 +1065,6 @@ reload_current_registration_info_context_step (GTask *task)
return;
}
if (!ctx->subscription_state_loaded) {
/* Launch subscription state update */
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_subscription_state (
self,
(GAsyncReadyCallback)load_subscription_state_ready,
task);
return;
}
/* If all are loaded, all done */
g_task_return_boolean (task, TRUE);
g_object_unref (task);
@@ -1147,11 +1108,6 @@ mm_iface_modem_3gpp_reload_current_registration_info (MMIfaceModem3gpp *self,
if (ctx->operator_name_loaded)
mm_gdbus_modem3gpp_set_operator_name (ctx->skeleton, NULL);
ctx->subscription_state_loaded = !(MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_subscription_state &&
MM_IFACE_MODEM_3GPP_GET_INTERFACE (self)->load_subscription_state_finish);
if (ctx->subscription_state_loaded)
mm_gdbus_modem3gpp_set_subscription_state (ctx->skeleton, MM_MODEM_3GPP_SUBSCRIPTION_STATE_UNKNOWN);
reload_current_registration_info_context_step (task);
}
@@ -1172,19 +1128,6 @@ mm_iface_modem_3gpp_clear_current_operator (MMIfaceModem3gpp *self)
mm_iface_modem_location_3gpp_update_mcc_mnc (MM_IFACE_MODEM_LOCATION (self), 0, 0);
}
static void
clear_subscription_state (MMIfaceModem3gpp *self)
{
MmGdbusModem3gpp *skeleton = NULL;
g_object_get (self,
MM_IFACE_MODEM_3GPP_DBUS_SKELETON, &skeleton,
NULL);
if (!skeleton)
return;
mm_gdbus_modem3gpp_set_subscription_state (skeleton, MM_MODEM_3GPP_SUBSCRIPTION_STATE_UNKNOWN);
}
/*****************************************************************************/
void
@@ -1286,13 +1229,6 @@ update_non_registered_state (MMIfaceModem3gpp *self,
/* Not registered neither in home nor roaming network */
mm_iface_modem_3gpp_clear_current_operator (self);
/* The subscription state can be computed in two ways: a) via PCO which is
* sent by the carrier during registration or b) by looking at the
* registration reject error code. If b), we want to make sure we
* preserve the subscription state */
if (reg_state_is_registered (old_state))
clear_subscription_state (self);
/* The property in the interface is bound to the property
* in the skeleton, so just updating here is enough */
g_object_set (self,
@@ -1429,22 +1365,6 @@ mm_iface_modem_3gpp_update_eps_registration_state (MMIfaceModem3gpp *self,
update_registration_state (self, get_consolidated_reg_state (ctx), TRUE);
}
void
mm_iface_modem_3gpp_update_subscription_state (MMIfaceModem3gpp *self,
MMModem3gppSubscriptionState state)
{
MmGdbusModem3gpp *skeleton = NULL;
g_object_get (self,
MM_IFACE_MODEM_3GPP_DBUS_SKELETON, &skeleton,
NULL);
if (skeleton) {
mm_dbg ("Setting subscription state to: %s", mm_modem_3gpp_subscription_state_get_string (state));
mm_gdbus_modem3gpp_set_subscription_state (skeleton, state);
g_object_unref (skeleton);
}
}
/*****************************************************************************/
typedef struct {
-8
View File
@@ -184,14 +184,6 @@ struct _MMIfaceModem3gpp {
GAsyncResult *res,
GError **error);
/* Loading of the subscription state property */
void (*load_subscription_state) (MMIfaceModem3gpp *self,
GAsyncReadyCallback callback,
gpointer user_data);
MMModem3gppSubscriptionState (*load_subscription_state_finish) (MMIfaceModem3gpp *self,
GAsyncResult *res,
GError **error);
/* Scan current networks, expect a GList of MMModem3gppNetworkInfo */
void (* scan_networks) (MMIfaceModem3gpp *self,
GAsyncReadyCallback callback,