iface-modem: load EquipmentIdentifier' and DeviceIdentifier' during init

This commit is contained in:
Aleksander Morgado
2011-11-22 17:40:52 +01:00
parent 7a9b0d9fac
commit 9852433095
2 changed files with 50 additions and 0 deletions

View File

@@ -114,6 +114,8 @@ typedef enum {
INITIALIZATION_STEP_MANUFACTURER,
INITIALIZATION_STEP_MODEL,
INITIALIZATION_STEP_REVISION,
INITIALIZATION_STEP_EQUIPMENT_ID,
INITIALIZATION_STEP_DEVICE_ID,
INITIALIZATION_STEP_LAST
} InitializationStep;
@@ -219,6 +221,8 @@ UINT_REPLY_READY_FN (max_active_bearers, "Max Active Bearers")
STR_REPLY_READY_FN (manufacturer, "Manufacturer")
STR_REPLY_READY_FN (model, "Model")
STR_REPLY_READY_FN (revision, "Revision")
STR_REPLY_READY_FN (equipment_identifier, "Equipment Identifier")
STR_REPLY_READY_FN (device_identifier, "Device Identifier")
static void
interface_initialization_step (InitializationContext *ctx)
@@ -373,6 +377,36 @@ interface_initialization_step (InitializationContext *ctx)
}
break;
case INITIALIZATION_STEP_EQUIPMENT_ID:
/* Equipment ID 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_modem_get_equipment_identifier (ctx->skeleton) == NULL &&
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_equipment_identifier &&
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_equipment_identifier_finish) {
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_equipment_identifier (
ctx->self,
(GAsyncReadyCallback)load_equipment_identifier_ready,
ctx);
return;
}
break;
case INITIALIZATION_STEP_DEVICE_ID:
/* Device ID 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_modem_get_device_identifier (ctx->skeleton) == NULL &&
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_device_identifier &&
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_device_identifier_finish) {
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_device_identifier (
ctx->self,
(GAsyncReadyCallback)load_device_identifier_ready,
ctx);
return;
}
break;
case INITIALIZATION_STEP_LAST:
/* We are done without errors! */
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);

View File

@@ -86,6 +86,22 @@ struct _MMIfaceModem {
gchar * (*load_revision_finish) (MMIfaceModem *self,
GAsyncResult *res,
GError **error);
/* Loading of the EquipmentIdentifier property */
void (*load_equipment_identifier) (MMIfaceModem *self,
GAsyncReadyCallback callback,
gpointer user_data);
gchar * (*load_equipment_identifier_finish) (MMIfaceModem *self,
GAsyncResult *res,
GError **error);
/* Loading of the DeviceIdentifier property */
void (*load_device_identifier) (MMIfaceModem *self,
GAsyncReadyCallback callback,
gpointer user_data);
gchar * (*load_device_identifier_finish) (MMIfaceModem *self,
GAsyncResult *res,
GError **error);
};
GType mm_iface_modem_get_type (void);