mm-base-sim: add EID D-Bus property

This provides a new D-Bus property on the Sim object that
exposes the EID of the SIM, if available.
This commit is contained in:
Eric Caruso
2020-10-19 20:38:43 +00:00
committed by Aleksander Morgado
parent 1ed9f7e94e
commit 9fca046780
4 changed files with 36 additions and 0 deletions
@@ -3110,6 +3110,8 @@ MmGdbusSimIface
mm_gdbus_sim_get_active
mm_gdbus_sim_get_imsi
mm_gdbus_sim_dup_imsi
mm_gdbus_sim_get_eid
mm_gdbus_sim_dup_eid
mm_gdbus_sim_get_sim_identifier
mm_gdbus_sim_dup_sim_identifier
mm_gdbus_sim_get_operator_identifier
@@ -95,6 +95,13 @@
-->
<property name="Imsi" type="s" access="read" />
<!--
Eid:
The EID of the SIM card, if any.
-->
<property name="Eid" type="s" access="read" />
<!--
OperatorId:
+19
View File
@@ -1503,6 +1503,7 @@ typedef enum {
INITIALIZATION_STEP_WAIT_READY,
INITIALIZATION_STEP_SIM_IDENTIFIER,
INITIALIZATION_STEP_IMSI,
INITIALIZATION_STEP_EID,
INITIALIZATION_STEP_OPERATOR_ID,
INITIALIZATION_STEP_OPERATOR_NAME,
INITIALIZATION_STEP_EMERGENCY_NUMBERS,
@@ -1631,6 +1632,7 @@ init_load_emergency_numbers_ready (MMBaseSim *self,
}
STR_REPLY_READY_FN (imsi, "IMSI")
STR_REPLY_READY_FN (eid, "EID")
STR_REPLY_READY_FN (operator_identifier, "operator identifier")
STR_REPLY_READY_FN (operator_name, "operator name")
@@ -1714,6 +1716,22 @@ interface_initialization_step (GTask *task)
ctx->step++;
/* Fall through */
case INITIALIZATION_STEP_EID:
/* EID is meant to be loaded only once during the whole
* lifetime of the modem. Therefore, if we already have them loaded,
* don't try to load them again. */
if (mm_gdbus_sim_get_eid (MM_GDBUS_SIM (self)) == NULL &&
MM_BASE_SIM_GET_CLASS (self)->load_eid &&
MM_BASE_SIM_GET_CLASS (self)->load_eid_finish) {
MM_BASE_SIM_GET_CLASS (self)->load_eid (
self,
(GAsyncReadyCallback)init_load_eid_ready,
task);
return;
}
ctx->step++;
/* Fall through */
case INITIALIZATION_STEP_OPERATOR_ID:
/* Operator ID is meant to be loaded only once during the whole
* lifetime of the modem. Therefore, if we already have them loaded,
@@ -1807,6 +1825,7 @@ initable_init_async (GAsyncInitable *initable,
{
mm_gdbus_sim_set_sim_identifier (MM_GDBUS_SIM (initable), NULL);
mm_gdbus_sim_set_imsi (MM_GDBUS_SIM (initable), NULL);
mm_gdbus_sim_set_eid (MM_GDBUS_SIM (initable), NULL);
mm_gdbus_sim_set_operator_identifier (MM_GDBUS_SIM (initable), NULL);
mm_gdbus_sim_set_operator_name (MM_GDBUS_SIM (initable), NULL);
+8
View File
@@ -76,6 +76,14 @@ struct _MMBaseSimClass {
GAsyncResult *res,
GError **error);
/* Load EID (async) */
void (* load_eid) (MMBaseSim *self,
GAsyncReadyCallback callback,
gpointer user_data);
gchar * (* load_eid_finish) (MMBaseSim *self,
GAsyncResult *res,
GError **error);
/* Load operator identifier (async) */
void (* load_operator_identifier) (MMBaseSim *self,
GAsyncReadyCallback callback,