iface-modem-firmware: List() and Select() are now optional
Since the Firmware interface now contains more actions and properties apart from List() and Select(), these two actions are now optional. Not all modems implementing the Firmware interface must implement these two methods.
This commit is contained in:

committed by
Dan Williams

parent
fc02b1320c
commit
f69098819b
@@ -126,6 +126,18 @@ list_auth_ready (MMBaseModem *self,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->load_list ||
|
||||
!MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->load_list_finish ||
|
||||
!MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->load_current ||
|
||||
!MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->load_current_finish) {
|
||||
g_dbus_method_invocation_return_error (ctx->invocation,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_UNSUPPORTED,
|
||||
"Cannot list firmware: operation not supported");
|
||||
handle_list_context_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->load_list (MM_IFACE_MODEM_FIRMWARE (self),
|
||||
(GAsyncReadyCallback)load_list_ready,
|
||||
ctx);
|
||||
@@ -138,11 +150,6 @@ handle_list (MmGdbusModemFirmware *skeleton,
|
||||
{
|
||||
HandleListContext *ctx;
|
||||
|
||||
g_assert (MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->load_list != NULL);
|
||||
g_assert (MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->load_list_finish != NULL);
|
||||
g_assert (MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->load_current != NULL);
|
||||
g_assert (MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->load_current_finish != NULL);
|
||||
|
||||
ctx = g_slice_new (HandleListContext);
|
||||
ctx->skeleton = g_object_ref (skeleton);
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
@@ -204,6 +211,17 @@ select_auth_ready (MMBaseModem *self,
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->change_current ||
|
||||
!MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->change_current_finish) {
|
||||
g_dbus_method_invocation_return_error (ctx->invocation,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_UNSUPPORTED,
|
||||
"Cannot select firmware: operation not supported");
|
||||
handle_select_context_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->change_current (MM_IFACE_MODEM_FIRMWARE (self),
|
||||
ctx->name,
|
||||
(GAsyncReadyCallback)change_current_ready,
|
||||
@@ -218,9 +236,6 @@ handle_select (MmGdbusModemFirmware *skeleton,
|
||||
{
|
||||
HandleSelectContext *ctx;
|
||||
|
||||
g_assert (MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->change_current != NULL);
|
||||
g_assert (MM_IFACE_MODEM_FIRMWARE_GET_INTERFACE (self)->change_current_finish != NULL);
|
||||
|
||||
ctx = g_slice_new (HandleSelectContext);
|
||||
ctx->skeleton = g_object_ref (skeleton);
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
|
Reference in New Issue
Block a user