iface-modem: load SupportedModes' and
SupportedBands' during init
This commit is contained in:
@@ -262,6 +262,8 @@ typedef enum {
|
||||
INITIALIZATION_STEP_DEVICE_ID,
|
||||
INITIALIZATION_STEP_UNLOCK_REQUIRED,
|
||||
INITIALIZATION_STEP_UNLOCK_RETRIES,
|
||||
INITIALIZATION_STEP_SUPPORTED_MODES,
|
||||
INITIALIZATION_STEP_SUPPORTED_BANDS,
|
||||
INITIALIZATION_STEP_LAST
|
||||
} InitializationStep;
|
||||
|
||||
@@ -371,6 +373,8 @@ 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")
|
||||
UINT_REPLY_READY_FN (supported_modes, "Supported Modes")
|
||||
UINT_REPLY_READY_FN (supported_bands, "Supported Bands")
|
||||
|
||||
static void
|
||||
load_unlock_required_ready (MMIfaceModem *self,
|
||||
@@ -605,6 +609,36 @@ interface_initialization_step (InitializationContext *ctx)
|
||||
}
|
||||
break;
|
||||
|
||||
case INITIALIZATION_STEP_SUPPORTED_MODES:
|
||||
/* Supported modes are 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_supported_modes (ctx->skeleton) == MM_MODEM_MODE_NONE &&
|
||||
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_supported_modes &&
|
||||
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_supported_modes_finish) {
|
||||
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_supported_modes (
|
||||
ctx->self,
|
||||
(GAsyncReadyCallback)load_supported_modes_ready,
|
||||
ctx);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case INITIALIZATION_STEP_SUPPORTED_BANDS:
|
||||
/* Supported bands are 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_supported_bands (ctx->skeleton) == MM_MODEM_BAND_UNKNOWN &&
|
||||
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_supported_bands &&
|
||||
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_supported_bands_finish) {
|
||||
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_supported_bands (
|
||||
ctx->self,
|
||||
(GAsyncReadyCallback)load_supported_bands_ready,
|
||||
ctx);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case INITIALIZATION_STEP_LAST:
|
||||
/* We are done without errors! */
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
|
@@ -118,6 +118,22 @@ struct _MMIfaceModem {
|
||||
MMModemLock (*load_unlock_retries_finish) (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
/* Loading of the SupportedModes property */
|
||||
void (*load_supported_modes) (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
MMModemMode (*load_supported_modes_finish) (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
/* Loading of the SupportedBands property */
|
||||
void (*load_supported_bands) (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
MMModemBand (*load_supported_bands_finish) (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
};
|
||||
|
||||
GType mm_iface_modem_get_type (void);
|
||||
|
Reference in New Issue
Block a user