base-sim: allow creating preinitialized SIM objects

The default SIM creation method will attempt to initialize the SIM
properties during the object creation.

This new method allows creating SIM objects with already known
property values, and therefore not explicitly running the
asynchronous initialization process.
This commit is contained in:
Aleksander Morgado
2020-08-28 14:59:06 +00:00
parent c999c8e9cf
commit 18084f8939
2 changed files with 38 additions and 0 deletions
+29
View File
@@ -1466,6 +1466,35 @@ load_operator_name (MMBaseSim *self,
/*****************************************************************************/
MMBaseSim *
mm_base_sim_new_initialized (MMBaseModem *modem,
guint slot_number,
gboolean active,
const gchar *sim_identifier,
const gchar *imsi,
const gchar *operator_identifier,
const gchar *operator_name,
const GStrv emergency_numbers)
{
MMBaseSim *sim;
sim = MM_BASE_SIM (g_object_new (MM_TYPE_BASE_SIM,
MM_BASE_SIM_MODEM, modem,
MM_BASE_SIM_SLOT_NUMBER, slot_number,
"active", active,
"sim-identifier", sim_identifier,
"imsi", imsi,
"operator-identifier", operator_identifier,
"operator-name", operator_name,
"emergency-numbers", emergency_numbers,
NULL));
mm_base_sim_export (sim);
return sim;
}
/*****************************************************************************/
typedef struct _InitAsyncContext InitAsyncContext;
static void interface_initialization_step (GTask *task);
+9
View File
@@ -153,6 +153,15 @@ gboolean mm_base_sim_initialize_finish (MMBaseSim *self,
GAsyncResult *result,
GError **error);
MMBaseSim *mm_base_sim_new_initialized (MMBaseModem *modem,
guint slot_number,
gboolean active,
const gchar *sim_identifier,
const gchar *imsi,
const gchar *operator_identifier,
const gchar *operator_name,
const GStrv emergency_numbers);
void mm_base_sim_send_pin (MMBaseSim *self,
const gchar *pin,
GAsyncReadyCallback callback,