api,firmware: new UpdateSettings property

This commit is contained in:
Aleksander Morgado
2019-01-03 18:53:52 +00:00
committed by Dan Williams
parent edf8d34939
commit 8e342cf120
16 changed files with 965 additions and 273 deletions
+44
View File
@@ -251,6 +251,7 @@ typedef enum {
INITIALIZATION_STEP_FIRST,
INITIALIZATION_STEP_CHECK_SUPPORT,
INITIALIZATION_STEP_FAIL_IF_UNSUPPORTED,
INITIALIZATION_STEP_UPDATE_SETTINGS,
INITIALIZATION_STEP_LAST
} InitializationStep;
@@ -266,6 +267,37 @@ initialization_context_free (InitializationContext *ctx)
g_free (ctx);
}
static void
load_update_settings_ready (MMIfaceModemFirmware *self,
GAsyncResult *res,
GTask *task)
{
InitializationContext *ctx;
MMFirmwareUpdateSettings *update_settings;
GError *error = NULL;
GVariant *variant = NULL;
ctx = g_task_get_task_data (task);
update_settings = MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->load_update_settings_finish (self, res, &error);
if (!update_settings) {
mm_dbg ("Couldn't load update settings: '%s'", error->message);
g_error_free (error);
} else {
variant = mm_firmware_update_settings_get_variant (update_settings);
g_object_unref (update_settings);
}
mm_gdbus_modem_firmware_set_update_settings (ctx->skeleton, variant);
if (variant)
g_variant_unref (variant);
/* Go on to next step */
ctx->step++;
interface_initialization_step (task);
}
static void
check_support_ready (MMIfaceModemFirmware *self,
GAsyncResult *res,
@@ -363,6 +395,18 @@ interface_initialization_step (GTask *task)
/* Fall down to next step */
ctx->step++;
case INITIALIZATION_STEP_UPDATE_SETTINGS:
if (MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->load_update_settings &&
MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->load_update_settings_finish) {
MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->load_update_settings (
self,
(GAsyncReadyCallback)load_update_settings_ready,
task);
return;
}
/* Fall down to next step */
ctx->step++;
case INITIALIZATION_STEP_LAST:
/* We are done without errors! */
+8
View File
@@ -42,6 +42,14 @@ struct _MMIfaceModemFirmware {
GAsyncResult *res,
GError **error);
/* Get update settings (async) */
void (* load_update_settings) (MMIfaceModemFirmware *self,
GAsyncReadyCallback callback,
gpointer user_data);
MMFirmwareUpdateSettings * (* load_update_settings_finish) (MMIfaceModemFirmware *self,
GAsyncResult *res,
GError **error);
/* Get Firmware list (async) */
void (* load_list) (MMIfaceModemFirmware *self,
GAsyncReadyCallback callback,