samsung: use generic Icera unlock retries checking functions
This commit is contained in:

committed by
Aleksander Morgado

parent
abfce5493c
commit
b1c2e0ba5f
@@ -445,78 +445,6 @@ set_bands (MMIfaceModem *self,
|
||||
ctx);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Load unlock retries (Modem interface) */
|
||||
|
||||
static MMUnlockRetries *
|
||||
load_unlock_retries_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
||||
return NULL;
|
||||
return (MMUnlockRetries *) g_object_ref (g_simple_async_result_get_op_res_gpointer (
|
||||
G_SIMPLE_ASYNC_RESULT (res)));
|
||||
}
|
||||
|
||||
static void
|
||||
load_unlock_retries_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GSimpleAsyncResult *operation_result)
|
||||
{
|
||||
const gchar *response;
|
||||
GError *error = NULL;
|
||||
int pin1, puk1, pin2, puk2;
|
||||
|
||||
|
||||
response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
|
||||
if (!response) {
|
||||
mm_dbg ("Couldn't query unlock retries: '%s'", error->message);
|
||||
g_simple_async_result_take_error (operation_result, error);
|
||||
g_simple_async_result_complete (operation_result);
|
||||
g_object_unref (operation_result);
|
||||
return;
|
||||
}
|
||||
|
||||
response = mm_strip_tag (response, "%PINNUM:");
|
||||
if (sscanf (response, " %d, %d, %d, %d", &pin1, &puk1, &pin2, &puk2) == 4) {
|
||||
MMUnlockRetries *retries;
|
||||
retries = mm_unlock_retries_new ();
|
||||
mm_unlock_retries_set (retries, MM_MODEM_LOCK_SIM_PIN, pin1);
|
||||
mm_unlock_retries_set (retries, MM_MODEM_LOCK_SIM_PUK, puk1);
|
||||
mm_unlock_retries_set (retries, MM_MODEM_LOCK_SIM_PIN2, pin2);
|
||||
mm_unlock_retries_set (retries, MM_MODEM_LOCK_SIM_PUK2, puk2);
|
||||
g_simple_async_result_set_op_res_gpointer (operation_result,
|
||||
retries,
|
||||
(GDestroyNotify)g_object_unref);
|
||||
} else {
|
||||
g_simple_async_result_set_error (operation_result,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
"Invalid unlock retries response: '%s'",
|
||||
response);
|
||||
}
|
||||
g_simple_async_result_complete (operation_result);
|
||||
g_object_unref (operation_result);
|
||||
}
|
||||
|
||||
static void
|
||||
load_unlock_retries (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
mm_base_modem_at_command (
|
||||
MM_BASE_MODEM (self),
|
||||
"%PINNUM?",
|
||||
3,
|
||||
FALSE,
|
||||
(GAsyncReadyCallback)load_unlock_retries_ready,
|
||||
g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
load_unlock_retries));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Modem power down (Modem interface) */
|
||||
|
||||
@@ -814,8 +742,6 @@ iface_modem_init (MMIfaceModem *iface)
|
||||
iface->load_current_bands_finish = load_current_bands_finish;
|
||||
iface->set_bands = set_bands;
|
||||
iface->set_bands_finish = set_bands_finish;
|
||||
iface->load_unlock_retries = load_unlock_retries;
|
||||
iface->load_unlock_retries_finish = load_unlock_retries_finish;
|
||||
iface->modem_power_down = modem_power_down;
|
||||
iface->modem_power_down_finish = modem_power_down_finish;
|
||||
iface->create_bearer = create_bearer;
|
||||
@@ -828,6 +754,8 @@ iface_modem_init (MMIfaceModem *iface)
|
||||
iface->set_allowed_modes_finish = mm_iface_icera_modem_set_allowed_modes_finish;
|
||||
iface->load_access_technologies = mm_iface_icera_modem_load_access_technologies;
|
||||
iface->load_access_technologies_finish = mm_iface_icera_modem_load_access_technologies_finish;
|
||||
iface->load_unlock_retries = mm_iface_icera_modem_load_unlock_retries;
|
||||
iface->load_unlock_retries_finish = mm_iface_icera_modem_load_unlock_retries_finish;
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user