api,introspection: merge 'AllowedModes' and 'SupportedMode' into 'CurrentModes'
We now have a single 'CurrentModes' property which contains both values in a tuple with signature "(uu)". Also, rename 'SetAllowedModes()' to 'SetCurrentModes()', and update the list of arguments expected to have a single "(uu)" tuple.
This commit is contained in:
@@ -241,8 +241,10 @@ print_modem_info (void)
|
||||
MMModemModeCombination *modes = NULL;
|
||||
guint n_modes = 0;
|
||||
gchar *supported_modes_string;
|
||||
gchar *allowed_modes_string;
|
||||
gchar *preferred_mode_string;
|
||||
MMModemMode allowed_modes;
|
||||
gchar *allowed_modes_string = NULL;
|
||||
MMModemMode preferred_mode;
|
||||
gchar *preferred_mode_string = NULL;
|
||||
gchar *supported_bands_string;
|
||||
gchar *current_bands_string;
|
||||
gchar *supported_ip_families_string;
|
||||
@@ -277,10 +279,10 @@ print_modem_info (void)
|
||||
mm_modem_get_supported_bands (ctx->modem, &bands, &n_bands);
|
||||
supported_bands_string = mm_common_build_bands_string (bands, n_bands);
|
||||
g_free (bands);
|
||||
allowed_modes_string = mm_modem_mode_build_string_from_mask (
|
||||
mm_modem_get_allowed_modes (ctx->modem));
|
||||
preferred_mode_string = mm_modem_mode_build_string_from_mask (
|
||||
mm_modem_get_preferred_mode (ctx->modem));
|
||||
if (mm_modem_get_current_modes (ctx->modem, &allowed_modes, &preferred_mode)) {
|
||||
allowed_modes_string = mm_modem_mode_build_string_from_mask (allowed_modes);
|
||||
preferred_mode_string = mm_modem_mode_build_string_from_mask (preferred_mode);
|
||||
}
|
||||
supported_ip_families_string = mm_bearer_ip_family_build_string_from_mask (
|
||||
mm_modem_get_supported_ip_families (ctx->modem));
|
||||
|
||||
@@ -385,8 +387,7 @@ print_modem_info (void)
|
||||
/* Modes */
|
||||
g_print (" -------------------------\n"
|
||||
" Modes | supported: '%s'\n"
|
||||
" | allowed: '%s'\n"
|
||||
" | preferred: '%s'\n",
|
||||
" | current: 'allowed: %s; preferred: %s'\n",
|
||||
VALIDATE_UNKNOWN (supported_modes_string),
|
||||
VALIDATE_UNKNOWN (allowed_modes_string),
|
||||
VALIDATE_UNKNOWN (preferred_mode_string));
|
||||
@@ -763,28 +764,28 @@ delete_bearer_ready (MMModem *modem,
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_modes_process_reply (gboolean result,
|
||||
set_current_modes_process_reply (gboolean result,
|
||||
const GError *error)
|
||||
{
|
||||
if (!result) {
|
||||
g_printerr ("error: couldn't set allowed modes: '%s'\n",
|
||||
g_printerr ("error: couldn't set current modes: '%s'\n",
|
||||
error ? error->message : "unknown error");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
g_print ("successfully set allowed modes in the modem\n");
|
||||
g_print ("successfully set current modes in the modem\n");
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_modes_ready (MMModem *modem,
|
||||
set_current_modes_ready (MMModem *modem,
|
||||
GAsyncResult *result,
|
||||
gpointer nothing)
|
||||
{
|
||||
gboolean operation_result;
|
||||
GError *error = NULL;
|
||||
|
||||
operation_result = mm_modem_set_allowed_modes_finish (modem, result, &error);
|
||||
set_allowed_modes_process_reply (operation_result, error);
|
||||
operation_result = mm_modem_set_current_modes_finish (modem, result, &error);
|
||||
set_current_modes_process_reply (operation_result, error);
|
||||
|
||||
mmcli_async_operation_done ();
|
||||
}
|
||||
@@ -1041,11 +1042,11 @@ get_modem_ready (GObject *source,
|
||||
MMModemMode preferred;
|
||||
|
||||
parse_modes (&allowed, &preferred);
|
||||
mm_modem_set_allowed_modes (ctx->modem,
|
||||
mm_modem_set_current_modes (ctx->modem,
|
||||
allowed,
|
||||
preferred,
|
||||
ctx->cancellable,
|
||||
(GAsyncReadyCallback)set_allowed_modes_ready,
|
||||
(GAsyncReadyCallback)set_current_modes_ready,
|
||||
NULL);
|
||||
return;
|
||||
}
|
||||
@@ -1254,13 +1255,13 @@ mmcli_modem_run_synchronous (GDBusConnection *connection)
|
||||
gboolean result;
|
||||
|
||||
parse_modes (&allowed, &preferred);
|
||||
result = mm_modem_set_allowed_modes_sync (ctx->modem,
|
||||
result = mm_modem_set_current_modes_sync (ctx->modem,
|
||||
allowed,
|
||||
preferred,
|
||||
NULL,
|
||||
&error);
|
||||
|
||||
set_allowed_modes_process_reply (result, error);
|
||||
set_current_modes_process_reply (result, error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -109,8 +109,7 @@ mm_modem_get_own_numbers
|
||||
mm_modem_dup_own_numbers
|
||||
mm_modem_peek_supported_modes
|
||||
mm_modem_get_supported_modes
|
||||
mm_modem_get_allowed_modes
|
||||
mm_modem_get_preferred_mode
|
||||
mm_modem_get_current_modes
|
||||
mm_modem_peek_supported_bands
|
||||
mm_modem_get_supported_bands
|
||||
mm_modem_peek_current_bands
|
||||
@@ -134,9 +133,9 @@ mm_modem_disable_sync
|
||||
mm_modem_set_power_state
|
||||
mm_modem_set_power_state_finish
|
||||
mm_modem_set_power_state_sync
|
||||
mm_modem_set_allowed_modes
|
||||
mm_modem_set_allowed_modes_finish
|
||||
mm_modem_set_allowed_modes_sync
|
||||
mm_modem_set_current_modes
|
||||
mm_modem_set_current_modes_finish
|
||||
mm_modem_set_current_modes_sync
|
||||
mm_modem_set_current_bands
|
||||
mm_modem_set_current_bands_finish
|
||||
mm_modem_set_current_bands_sync
|
||||
@@ -638,8 +637,8 @@ mm_simple_connect_properties_get_operator_id
|
||||
mm_simple_connect_properties_set_operator_id
|
||||
mm_simple_connect_properties_get_current_bands
|
||||
mm_simple_connect_properties_set_current_bands
|
||||
mm_simple_connect_properties_get_allowed_modes
|
||||
mm_simple_connect_properties_set_allowed_modes
|
||||
mm_simple_connect_properties_get_current_modes
|
||||
mm_simple_connect_properties_set_current_modes
|
||||
mm_simple_connect_properties_get_apn
|
||||
mm_simple_connect_properties_set_apn
|
||||
mm_simple_connect_properties_get_allowed_auth
|
||||
@@ -1418,7 +1417,8 @@ MmGdbusModem
|
||||
MmGdbusModemIface
|
||||
<SUBSECTION Getters>
|
||||
mm_gdbus_modem_get_access_technologies
|
||||
mm_gdbus_modem_get_allowed_modes
|
||||
mm_gdbus_modem_get_current_modes
|
||||
mm_gdbus_modem_dup_current_modes
|
||||
mm_gdbus_modem_get_current_bands
|
||||
mm_gdbus_modem_dup_current_bands
|
||||
mm_gdbus_modem_get_current_capabilities
|
||||
@@ -1444,7 +1444,6 @@ mm_gdbus_modem_dup_plugin
|
||||
mm_gdbus_modem_get_power_state
|
||||
mm_gdbus_modem_get_primary_port
|
||||
mm_gdbus_modem_dup_primary_port
|
||||
mm_gdbus_modem_get_preferred_mode
|
||||
mm_gdbus_modem_get_revision
|
||||
mm_gdbus_modem_dup_revision
|
||||
mm_gdbus_modem_get_signal_quality
|
||||
@@ -1483,9 +1482,9 @@ mm_gdbus_modem_call_reset_sync
|
||||
mm_gdbus_modem_call_factory_reset
|
||||
mm_gdbus_modem_call_factory_reset_finish
|
||||
mm_gdbus_modem_call_factory_reset_sync
|
||||
mm_gdbus_modem_call_set_allowed_modes
|
||||
mm_gdbus_modem_call_set_allowed_modes_finish
|
||||
mm_gdbus_modem_call_set_allowed_modes_sync
|
||||
mm_gdbus_modem_call_set_current_modes
|
||||
mm_gdbus_modem_call_set_current_modes_finish
|
||||
mm_gdbus_modem_call_set_current_modes_sync
|
||||
mm_gdbus_modem_call_set_current_bands
|
||||
mm_gdbus_modem_call_set_current_bands_finish
|
||||
mm_gdbus_modem_call_set_current_bands_sync
|
||||
@@ -1494,7 +1493,7 @@ mm_gdbus_modem_call_command_finish
|
||||
mm_gdbus_modem_call_command_sync
|
||||
<SUBSECTION Private>
|
||||
mm_gdbus_modem_set_access_technologies
|
||||
mm_gdbus_modem_set_allowed_modes
|
||||
mm_gdbus_modem_set_current_modes
|
||||
mm_gdbus_modem_set_current_bands
|
||||
mm_gdbus_modem_set_current_capabilities
|
||||
mm_gdbus_modem_set_device
|
||||
@@ -1509,7 +1508,6 @@ mm_gdbus_modem_set_modem_capabilities
|
||||
mm_gdbus_modem_set_own_numbers
|
||||
mm_gdbus_modem_set_plugin
|
||||
mm_gdbus_modem_set_primary_port
|
||||
mm_gdbus_modem_set_preferred_mode
|
||||
mm_gdbus_modem_set_revision
|
||||
mm_gdbus_modem_set_signal_quality
|
||||
mm_gdbus_modem_set_sim
|
||||
@@ -1530,7 +1528,7 @@ mm_gdbus_modem_complete_set_power_state
|
||||
mm_gdbus_modem_complete_factory_reset
|
||||
mm_gdbus_modem_complete_list_bearers
|
||||
mm_gdbus_modem_complete_reset
|
||||
mm_gdbus_modem_complete_set_allowed_modes
|
||||
mm_gdbus_modem_complete_set_current_modes
|
||||
mm_gdbus_modem_complete_set_current_bands
|
||||
mm_gdbus_modem_interface_info
|
||||
mm_gdbus_modem_override_properties
|
||||
|
@@ -137,16 +137,17 @@
|
||||
</method>
|
||||
|
||||
<!--
|
||||
SetAllowedModes:
|
||||
@modes: Bitmask of <link linkend="MMModemMode">MMModemMode</link> values, to specify all the modes allowed in the modem.
|
||||
@preferred: Specific <link linkend="MMModemMode">MMModemMode</link> preferred among the ones allowed, if any.
|
||||
SetCurrentModes:
|
||||
@modes: A pair of <link linkend="MMModemMode">MMModemMode</link> values, where the first one is a bitmask of allowed modes, and the second one the preferred mode, if any.
|
||||
|
||||
Set the access technologies (eg 2G/3G/4G preference) the device is
|
||||
Set the access technologies (e.g. 2G/3G/4G preference) the device is
|
||||
currently allowed to use when connecting to a network.
|
||||
|
||||
The given combination should be supported by the modem, as specified in the
|
||||
#org.freedesktop.ModemManager1.Modem:SupportedModes property.
|
||||
-->
|
||||
<method name="SetAllowedModes">
|
||||
<arg name="modes" type="u" direction="in" />
|
||||
<arg name="preferred" type="u" direction="in" />
|
||||
<method name="SetCurrentModes">
|
||||
<arg name="modes" type="(uu)" direction="in" />
|
||||
</method>
|
||||
|
||||
<!--
|
||||
@@ -431,31 +432,17 @@
|
||||
<property name="SupportedModes" type="a(uu)" access="read" />
|
||||
|
||||
<!--
|
||||
AllowedModes:
|
||||
CurrentModes:
|
||||
|
||||
Bitmask of <link linkend="MMModemMode">MMModemMode</link> values,
|
||||
specifying the access technologies (eg 2G/3G/4G preference) the device
|
||||
is currently allowed to use when connecting to a network.
|
||||
A pair of <link linkend="MMModemMode">MMModemMode</link> values, where the first one
|
||||
is a bitmask specifying the access technologies (eg 2G/3G/4G) the device
|
||||
is currently allowed to use when connecting to a network, and the second one is the
|
||||
preferred mode of those specified as allowed.
|
||||
|
||||
It must be a subset of #org.freedesktop.ModemManager1.Modem:SupportedModes.
|
||||
|
||||
For POTS devices, only the
|
||||
<link linkend="MM-MODEM-MODE-ANY:CAPS"><constant>MM_MODEM_MODE_ANY</constant></link>
|
||||
mode is supported.
|
||||
The pair must be one of those specified in
|
||||
#org.freedesktop.ModemManager1.Modem:SupportedModes.
|
||||
-->
|
||||
<property name="AllowedModes" type="u" access="read" />
|
||||
|
||||
<!--
|
||||
PreferredMode:
|
||||
|
||||
A single <link linkend="MMModemMode">MMModemMode</link> value,
|
||||
specifying the preferred access technology (eg 2G/3G/4G), among the
|
||||
ones defined in the allowed modes.
|
||||
|
||||
It must be one of the modes configured in
|
||||
#org.freedesktop.ModemManager1.Modem:AllowedModes.
|
||||
-->
|
||||
<property name="PreferredMode" type="u" access="read" />
|
||||
<property name="CurrentModes" type="(uu)" access="read" />
|
||||
|
||||
<!--
|
||||
SupportedBands:
|
||||
|
@@ -1034,41 +1034,39 @@ mm_modem_peek_supported_modes (MMModem *self,
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* mm_modem_get_allowed_modes:
|
||||
* mm_modem_get_current_modes:
|
||||
* @self: A #MMModem.
|
||||
* @allowed: (out): Return location for a bitmask of #MMModemMode values.
|
||||
* @preferred: (out): Return location for a #MMModemMode value.
|
||||
*
|
||||
* Gets the list of modes specifying the access technologies (eg 2G/3G/4G preference)
|
||||
* the #MMModem is currently allowed to use when connecting to a network.
|
||||
* Gets the list of modes specifying the access technologies (eg 2G/3G/4G)
|
||||
* the #MMModem is currently allowed to use when connecting to a network, as
|
||||
* well as the preferred one, if any.
|
||||
*
|
||||
* For POTS devices, only the #MM_MODEM_MODE_ANY is supported.
|
||||
*
|
||||
* Returns: A bitmask of #MMModemMode values.
|
||||
* Returns: %TRUE if @allowed and @preferred are set, %FALSE otherwise.
|
||||
*/
|
||||
MMModemMode
|
||||
mm_modem_get_allowed_modes (MMModem *self)
|
||||
gboolean
|
||||
mm_modem_get_current_modes (MMModem *self,
|
||||
MMModemMode *allowed,
|
||||
MMModemMode *preferred)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_MODEM (self), MM_MODEM_MODE_NONE);
|
||||
GVariant *variant;
|
||||
|
||||
return (MMModemMode) mm_gdbus_modem_get_allowed_modes (MM_GDBUS_MODEM (self));
|
||||
}
|
||||
g_return_val_if_fail (MM_IS_MODEM (self), FALSE);
|
||||
g_return_val_if_fail (allowed != NULL, FALSE);
|
||||
g_return_val_if_fail (preferred != NULL, FALSE);
|
||||
|
||||
/*****************************************************************************/
|
||||
variant = mm_gdbus_modem_dup_current_modes (MM_GDBUS_MODEM (self));
|
||||
if (variant) {
|
||||
g_variant_get (variant,
|
||||
"(uu)",
|
||||
allowed,
|
||||
preferred);
|
||||
g_variant_unref (variant);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_modem_get_preferred_mode:
|
||||
* @self: A #MMModem.
|
||||
*
|
||||
* Get the preferred access technology (eg 2G/3G/4G preference), among
|
||||
* the ones defined in the allowed modes.
|
||||
*
|
||||
* Returns: A single #MMModemMode value.
|
||||
*/
|
||||
MMModemMode
|
||||
mm_modem_get_preferred_mode (MMModem *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_MODEM (self), MM_MODEM_MODE_NONE);
|
||||
|
||||
return (MMModemMode) mm_gdbus_modem_get_preferred_mode (MM_GDBUS_MODEM (self));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -2318,27 +2316,27 @@ mm_modem_set_power_state_sync (MMModem *self,
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* mm_modem_set_allowed_modes_finish:
|
||||
* mm_modem_set_current_modes_finish:
|
||||
* @self: A #MMModem.
|
||||
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_modem_set_allowed_modes().
|
||||
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to mm_modem_set_current_modes().
|
||||
* @error: Return location for error or %NULL.
|
||||
*
|
||||
* Finishes an operation started with mm_modem_set_allowed_modes().
|
||||
* Finishes an operation started with mm_modem_set_current_modes().
|
||||
*
|
||||
* Returns: %TRUE if the allowed modes were successfully set, %FALSE if @error is set.
|
||||
*/
|
||||
gboolean
|
||||
mm_modem_set_allowed_modes_finish (MMModem *self,
|
||||
mm_modem_set_current_modes_finish (MMModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_MODEM (self), FALSE);
|
||||
|
||||
return mm_gdbus_modem_call_set_allowed_modes_finish (MM_GDBUS_MODEM (self), res, error);
|
||||
return mm_gdbus_modem_call_set_current_modes_finish (MM_GDBUS_MODEM (self), res, error);
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_modem_set_allowed_modes:
|
||||
* mm_modem_set_current_modes:
|
||||
* @self: A #MMModem.
|
||||
* @modes: Mask of #MMModemMode values specifying which modes are allowed.
|
||||
* @preferred: A #MMModemMode value specifying which of the modes given in @modes is the preferred one, or #MM_MODEM_MODE_NONE if none.
|
||||
@@ -2350,12 +2348,12 @@ mm_modem_set_allowed_modes_finish (MMModem *self,
|
||||
* currently allowed to use when connecting to a network.
|
||||
*
|
||||
* When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
|
||||
* You can then call mm_modem_set_allowed_modes_finish() to get the result of the operation.
|
||||
* You can then call mm_modem_set_current_modes_finish() to get the result of the operation.
|
||||
*
|
||||
* See mm_modem_set_allowed_modes_sync() for the synchronous, blocking version of this method.
|
||||
* See mm_modem_set_current_modes_sync() for the synchronous, blocking version of this method.
|
||||
*/
|
||||
void
|
||||
mm_modem_set_allowed_modes (MMModem *self,
|
||||
mm_modem_set_current_modes (MMModem *self,
|
||||
MMModemMode modes,
|
||||
MMModemMode preferred,
|
||||
GCancellable *cancellable,
|
||||
@@ -2364,11 +2362,15 @@ mm_modem_set_allowed_modes (MMModem *self,
|
||||
{
|
||||
g_return_if_fail (MM_IS_MODEM (self));
|
||||
|
||||
mm_gdbus_modem_call_set_allowed_modes (MM_GDBUS_MODEM (self), modes, preferred, cancellable, callback, user_data);
|
||||
mm_gdbus_modem_call_set_current_modes (MM_GDBUS_MODEM (self),
|
||||
g_variant_new ("(uu)", modes, preferred),
|
||||
cancellable,
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_modem_set_allowed_modes_sync:
|
||||
* mm_modem_set_current_modes_sync:
|
||||
* @self: A #MMModem.
|
||||
* @modes: Mask of #MMModemMode values specifying which modes are allowed.
|
||||
* @preferred: A #MMModemMode value specifying which of the modes given in @modes is the preferred one, or #MM_MODEM_MODE_NONE if none.
|
||||
@@ -2378,13 +2380,13 @@ mm_modem_set_allowed_modes (MMModem *self,
|
||||
* Synchronously sets the access technologies (e.g. 2G/3G/4G preference) the device is
|
||||
* currently allowed to use when connecting to a network.
|
||||
*
|
||||
* The calling thread is blocked until a reply is received. See mm_modem_set_allowed_modes()
|
||||
* The calling thread is blocked until a reply is received. See mm_modem_set_current_modes()
|
||||
* for the asynchronous version of this method.
|
||||
*
|
||||
* Returns: %TRUE if the allowed modes were successfully set, %FALSE if @error is set.
|
||||
*/
|
||||
gboolean
|
||||
mm_modem_set_allowed_modes_sync (MMModem *self,
|
||||
mm_modem_set_current_modes_sync (MMModem *self,
|
||||
MMModemMode modes,
|
||||
MMModemMode preferred,
|
||||
GCancellable *cancellable,
|
||||
@@ -2392,7 +2394,10 @@ mm_modem_set_allowed_modes_sync (MMModem *self,
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_MODEM (self), FALSE);
|
||||
|
||||
return mm_gdbus_modem_call_set_allowed_modes_sync (MM_GDBUS_MODEM (self), modes, preferred, cancellable, error);
|
||||
return mm_gdbus_modem_call_set_current_modes_sync (MM_GDBUS_MODEM (self),
|
||||
g_variant_new ("(uu)", modes, preferred),
|
||||
cancellable,
|
||||
error);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@@ -135,9 +135,9 @@ gboolean mm_modem_get_supported_modes (MMModem *self,
|
||||
MMModemModeCombination **modes,
|
||||
guint *n_modes);
|
||||
|
||||
MMModemMode mm_modem_get_allowed_modes (MMModem *self);
|
||||
|
||||
MMModemMode mm_modem_get_preferred_mode (MMModem *self);
|
||||
gboolean mm_modem_get_current_modes (MMModem *self,
|
||||
MMModemMode *allowed,
|
||||
MMModemMode *preferred);
|
||||
|
||||
gboolean mm_modem_peek_supported_bands (MMModem *self,
|
||||
const MMModemBand **bands,
|
||||
@@ -266,16 +266,16 @@ gboolean mm_modem_set_power_state_sync (MMModem *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void mm_modem_set_allowed_modes (MMModem *self,
|
||||
void mm_modem_set_current_modes (MMModem *self,
|
||||
MMModemMode modes,
|
||||
MMModemMode preferred,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_modem_set_allowed_modes_finish (MMModem *self,
|
||||
gboolean mm_modem_set_current_modes_finish (MMModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
gboolean mm_modem_set_allowed_modes_sync (MMModem *self,
|
||||
gboolean mm_modem_set_current_modes_sync (MMModem *self,
|
||||
MMModemMode modes,
|
||||
MMModemMode preferred,
|
||||
GCancellable *cancellable,
|
||||
|
@@ -49,7 +49,7 @@ struct _MMSimpleConnectPropertiesPrivate {
|
||||
MMModemBand *current_bands;
|
||||
guint n_current_bands;
|
||||
/* Modes */
|
||||
gboolean allowed_modes_set;
|
||||
gboolean current_modes_set;
|
||||
MMModemMode allowed_modes;
|
||||
MMModemMode preferred_mode;
|
||||
/* Bearer properties */
|
||||
@@ -183,7 +183,7 @@ mm_simple_connect_properties_get_current_bands (MMSimpleConnectProperties *self,
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* mm_simple_connect_properties_set_allowed_modes:
|
||||
* mm_simple_connect_properties_set_current_modes:
|
||||
* @self: a #MMSimpleConnectProperties.
|
||||
* @allowed: bitmask of #MMModemMode values specifying which are allowed.
|
||||
* @preferred: a #MMModemMode value, specifying which of the ones in @allowed is preferred, if any.
|
||||
@@ -191,7 +191,7 @@ mm_simple_connect_properties_get_current_bands (MMSimpleConnectProperties *self,
|
||||
* Sets the modes allowed to use, and which of them is preferred.
|
||||
*/
|
||||
void
|
||||
mm_simple_connect_properties_set_allowed_modes (MMSimpleConnectProperties *self,
|
||||
mm_simple_connect_properties_set_current_modes (MMSimpleConnectProperties *self,
|
||||
MMModemMode allowed,
|
||||
MMModemMode preferred)
|
||||
{
|
||||
@@ -199,11 +199,11 @@ mm_simple_connect_properties_set_allowed_modes (MMSimpleConnectProperties *self,
|
||||
|
||||
self->priv->allowed_modes = allowed;
|
||||
self->priv->preferred_mode = preferred;
|
||||
self->priv->allowed_modes_set = TRUE;
|
||||
self->priv->current_modes_set = TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_simple_connect_properties_get_allowed_modes:
|
||||
* mm_simple_connect_properties_get_current_modes:
|
||||
* @self: a #MMSimpleConnectProperties.
|
||||
* @allowed: (out): location for the bitmask of #MMModemMode values specifying which are allowed.
|
||||
* @preferred: (out): loction for a #MMModemMode value, specifying which of the ones in @allowed is preferred, if any.
|
||||
@@ -213,7 +213,7 @@ mm_simple_connect_properties_set_allowed_modes (MMSimpleConnectProperties *self,
|
||||
* Returns: %TRUE if @allowed and @preferred are set, %FALSE otherwise.
|
||||
*/
|
||||
gboolean
|
||||
mm_simple_connect_properties_get_allowed_modes (MMSimpleConnectProperties *self,
|
||||
mm_simple_connect_properties_get_current_modes (MMSimpleConnectProperties *self,
|
||||
MMModemMode *allowed,
|
||||
MMModemMode *preferred)
|
||||
{
|
||||
@@ -221,7 +221,7 @@ mm_simple_connect_properties_get_allowed_modes (MMSimpleConnectProperties *self,
|
||||
g_return_val_if_fail (allowed != NULL, FALSE);
|
||||
g_return_val_if_fail (preferred != NULL, FALSE);
|
||||
|
||||
if (self->priv->allowed_modes_set) {
|
||||
if (self->priv->current_modes_set) {
|
||||
*allowed = self->priv->allowed_modes;
|
||||
*preferred = self->priv->preferred_mode;
|
||||
return TRUE;
|
||||
@@ -524,7 +524,7 @@ mm_simple_connect_properties_get_dictionary (MMSimpleConnectProperties *self)
|
||||
mm_common_bands_array_to_variant (self->priv->current_bands,
|
||||
self->priv->n_current_bands));
|
||||
|
||||
if (self->priv->allowed_modes_set) {
|
||||
if (self->priv->current_modes_set) {
|
||||
g_variant_builder_add (&builder,
|
||||
"{sv}",
|
||||
PROPERTY_ALLOWED_MODES,
|
||||
@@ -639,7 +639,7 @@ mm_simple_connect_properties_new_from_string (const gchar *str,
|
||||
g_object_unref (ctx.self);
|
||||
ctx.self = NULL;
|
||||
} else {
|
||||
mm_simple_connect_properties_set_allowed_modes (
|
||||
mm_simple_connect_properties_set_current_modes (
|
||||
ctx.self,
|
||||
allowed_modes,
|
||||
preferred_mode);
|
||||
@@ -730,7 +730,7 @@ mm_simple_connect_properties_new_from_dictionary (GVariant *dictionary,
|
||||
}
|
||||
/* If we got allowed modes variant, check if we got preferred mode */
|
||||
else if (allowed_modes_variant) {
|
||||
mm_simple_connect_properties_set_allowed_modes (
|
||||
mm_simple_connect_properties_set_current_modes (
|
||||
self,
|
||||
g_variant_get_uint32 (allowed_modes_variant),
|
||||
(preferred_mode_variant ?
|
||||
@@ -739,7 +739,7 @@ mm_simple_connect_properties_new_from_dictionary (GVariant *dictionary,
|
||||
}
|
||||
/* If we only got preferred mode, assume allowed is ANY */
|
||||
else if (preferred_mode_variant) {
|
||||
mm_simple_connect_properties_set_allowed_modes (
|
||||
mm_simple_connect_properties_set_current_modes (
|
||||
self,
|
||||
MM_MODEM_MODE_ANY,
|
||||
g_variant_get_uint32 (preferred_mode_variant));
|
||||
|
@@ -66,7 +66,7 @@ void mm_simple_connect_properties_set_operator_id (MMSimpleConnectProperties *
|
||||
void mm_simple_connect_properties_set_current_bands (MMSimpleConnectProperties *self,
|
||||
const MMModemBand *bands,
|
||||
guint n_bands);
|
||||
void mm_simple_connect_properties_set_allowed_modes (MMSimpleConnectProperties *self,
|
||||
void mm_simple_connect_properties_set_current_modes (MMSimpleConnectProperties *self,
|
||||
MMModemMode allowed,
|
||||
MMModemMode preferred);
|
||||
void mm_simple_connect_properties_set_apn (MMSimpleConnectProperties *self,
|
||||
@@ -89,7 +89,7 @@ const gchar *mm_simple_connect_properties_get_operator_id (MMSimpleCon
|
||||
gboolean mm_simple_connect_properties_get_current_bands (MMSimpleConnectProperties *self,
|
||||
const MMModemBand **bands,
|
||||
guint *n_bands);
|
||||
gboolean mm_simple_connect_properties_get_allowed_modes (MMSimpleConnectProperties *self,
|
||||
gboolean mm_simple_connect_properties_get_current_modes (MMSimpleConnectProperties *self,
|
||||
MMModemMode *allowed,
|
||||
MMModemMode *preferred);
|
||||
const gchar *mm_simple_connect_properties_get_apn (MMSimpleConnectProperties *self);
|
||||
|
@@ -590,10 +590,10 @@ load_supported_modes (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ALLOWED MODES */
|
||||
/* Set current modes (Modem interface) */
|
||||
|
||||
static gboolean
|
||||
set_allowed_modes_finish (MMIfaceModem *self,
|
||||
set_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -618,7 +618,7 @@ allowed_access_technology_update_ready (MMBroadbandModemCinterion *self,
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_modes (MMIfaceModem *self,
|
||||
set_current_modes (MMIfaceModem *self,
|
||||
MMModemMode allowed,
|
||||
MMModemMode preferred,
|
||||
GAsyncReadyCallback callback,
|
||||
@@ -629,7 +629,7 @@ set_allowed_modes (MMIfaceModem *self,
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
set_allowed_modes);
|
||||
set_current_modes);
|
||||
|
||||
/* For dual 2G/3G devices... */
|
||||
if (mm_iface_modem_is_2g (self) &&
|
||||
@@ -646,11 +646,9 @@ set_allowed_modes (MMIfaceModem *self,
|
||||
* which is based on the quality of the connection.
|
||||
*/
|
||||
cmd = g_string_new ("+COPS=,,,");
|
||||
if (allowed == MM_MODEM_MODE_3G &&
|
||||
preferred == MM_MODEM_MODE_NONE) {
|
||||
if (allowed == MM_MODEM_MODE_3G) {
|
||||
g_string_append (cmd, "2");
|
||||
} else if (allowed == MM_MODEM_MODE_2G &&
|
||||
preferred == MM_MODEM_MODE_NONE) {
|
||||
} else if (allowed == MM_MODEM_MODE_2G) {
|
||||
g_string_append (cmd, "0");
|
||||
} else {
|
||||
gchar *allowed_str;
|
||||
@@ -1271,8 +1269,8 @@ iface_modem_init (MMIfaceModem *iface)
|
||||
|
||||
iface->load_supported_modes = load_supported_modes;
|
||||
iface->load_supported_modes_finish = load_supported_modes_finish;
|
||||
iface->set_allowed_modes = set_allowed_modes;
|
||||
iface->set_allowed_modes_finish = set_allowed_modes_finish;
|
||||
iface->set_current_modes = set_current_modes;
|
||||
iface->set_current_modes_finish = set_current_modes_finish;
|
||||
iface->load_supported_bands = load_supported_bands;
|
||||
iface->load_supported_bands_finish = load_supported_bands_finish;
|
||||
iface->load_current_bands = load_current_bands;
|
||||
|
@@ -1187,7 +1187,7 @@ parse_prefmode (const gchar *response, MMModemMode *preferred, GError **error)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
load_allowed_modes_finish (MMIfaceModem *self,
|
||||
load_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
MMModemMode *allowed,
|
||||
MMModemMode *preferred,
|
||||
@@ -1208,7 +1208,7 @@ load_allowed_modes_finish (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
load_allowed_modes (MMIfaceModem *self,
|
||||
load_current_modes (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -1226,7 +1226,7 @@ load_allowed_modes (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Set allowed modes (Modem interface) */
|
||||
/* Set current modes (Modem interface) */
|
||||
|
||||
static gboolean
|
||||
allowed_mode_to_prefmode (MMModemMode allowed, guint *huawei_mode, GError **error)
|
||||
@@ -1256,7 +1256,7 @@ allowed_mode_to_prefmode (MMModemMode allowed, guint *huawei_mode, GError **erro
|
||||
}
|
||||
|
||||
static gboolean
|
||||
set_allowed_modes_finish (MMIfaceModem *self,
|
||||
set_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -1281,7 +1281,7 @@ allowed_mode_update_ready (MMBroadbandModemHuawei *self,
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_modes (MMIfaceModem *self,
|
||||
set_current_modes (MMIfaceModem *self,
|
||||
MMModemMode allowed,
|
||||
MMModemMode preferred,
|
||||
GAsyncReadyCallback callback,
|
||||
@@ -1296,7 +1296,7 @@ set_allowed_modes (MMIfaceModem *self,
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
set_allowed_modes);
|
||||
set_current_modes);
|
||||
|
||||
if (mm_iface_modem_is_cdma_only (self)) {
|
||||
if (allowed_mode_to_prefmode (allowed, &mode, &error))
|
||||
@@ -2743,10 +2743,10 @@ iface_modem_init (MMIfaceModem *iface)
|
||||
iface->set_current_bands_finish = set_current_bands_finish;
|
||||
iface->load_supported_modes = load_supported_modes;
|
||||
iface->load_supported_modes_finish = load_supported_modes_finish;
|
||||
iface->load_allowed_modes = load_allowed_modes;
|
||||
iface->load_allowed_modes_finish = load_allowed_modes_finish;
|
||||
iface->set_allowed_modes = set_allowed_modes;
|
||||
iface->set_allowed_modes_finish = set_allowed_modes_finish;
|
||||
iface->load_current_modes = load_current_modes;
|
||||
iface->load_current_modes_finish = load_current_modes_finish;
|
||||
iface->set_current_modes = set_current_modes;
|
||||
iface->set_current_modes_finish = set_current_modes_finish;
|
||||
iface->load_signal_quality = modem_load_signal_quality;
|
||||
iface->load_signal_quality_finish = modem_load_signal_quality_finish;
|
||||
iface->create_bearer = huawei_modem_create_bearer;
|
||||
|
@@ -153,7 +153,7 @@ load_supported_modes (MMIfaceModem *self,
|
||||
/* Load initial allowed/preferred modes (Modem interface) */
|
||||
|
||||
static gboolean
|
||||
modem_load_allowed_modes_finish (MMIfaceModem *self,
|
||||
modem_load_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
MMModemMode *allowed,
|
||||
MMModemMode *preferred,
|
||||
@@ -212,7 +212,7 @@ modem_load_allowed_modes_finish (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
modem_load_allowed_modes (MMIfaceModem *self,
|
||||
modem_load_current_modes (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -228,7 +228,7 @@ modem_load_allowed_modes (MMIfaceModem *self,
|
||||
/* Set allowed modes (Modem interface) */
|
||||
|
||||
static gboolean
|
||||
modem_set_allowed_modes_finish (MMIfaceModem *self,
|
||||
modem_set_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -253,7 +253,7 @@ allowed_mode_update_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
modem_set_allowed_modes (MMIfaceModem *self,
|
||||
modem_set_current_modes (MMIfaceModem *self,
|
||||
MMModemMode allowed,
|
||||
MMModemMode preferred,
|
||||
GAsyncReadyCallback callback,
|
||||
@@ -266,7 +266,7 @@ modem_set_allowed_modes (MMIfaceModem *self,
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
modem_set_allowed_modes);
|
||||
modem_set_current_modes);
|
||||
|
||||
/*
|
||||
* The core has checked the following:
|
||||
@@ -1857,10 +1857,10 @@ iface_modem_init (MMIfaceModem *iface)
|
||||
|
||||
iface->load_supported_modes = load_supported_modes;
|
||||
iface->load_supported_modes_finish = load_supported_modes_finish;
|
||||
iface->load_allowed_modes = modem_load_allowed_modes;
|
||||
iface->load_allowed_modes_finish = modem_load_allowed_modes_finish;
|
||||
iface->set_allowed_modes = modem_set_allowed_modes;
|
||||
iface->set_allowed_modes_finish = modem_set_allowed_modes_finish;
|
||||
iface->load_current_modes = modem_load_current_modes;
|
||||
iface->load_current_modes_finish = modem_load_current_modes_finish;
|
||||
iface->set_current_modes = modem_set_current_modes;
|
||||
iface->set_current_modes_finish = modem_set_current_modes_finish;
|
||||
iface->load_access_technologies = modem_load_access_technologies;
|
||||
iface->load_access_technologies_finish = modem_load_access_technologies_finish;
|
||||
iface->load_unlock_retries = modem_load_unlock_retries;
|
||||
|
@@ -123,7 +123,7 @@ load_supported_modes (MMIfaceModem *self,
|
||||
/* Load initial allowed/preferred modes (Modem interface) */
|
||||
|
||||
static gboolean
|
||||
load_allowed_modes_finish (MMIfaceModem *self,
|
||||
load_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
MMModemMode *allowed,
|
||||
MMModemMode *preferred,
|
||||
@@ -173,7 +173,7 @@ load_allowed_modes_finish (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
load_allowed_modes (MMIfaceModem *self,
|
||||
load_current_modes (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -189,7 +189,7 @@ load_allowed_modes (MMIfaceModem *self,
|
||||
/* Set allowed modes (Modem interface) */
|
||||
|
||||
static gboolean
|
||||
set_allowed_modes_finish (MMIfaceModem *self,
|
||||
set_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -214,7 +214,7 @@ allowed_mode_update_ready (MMBroadbandModemLinktop *self,
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_modes (MMIfaceModem *self,
|
||||
set_current_modes (MMIfaceModem *self,
|
||||
MMModemMode allowed,
|
||||
MMModemMode preferred,
|
||||
GAsyncReadyCallback callback,
|
||||
@@ -227,7 +227,7 @@ set_allowed_modes (MMIfaceModem *self,
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
set_allowed_modes);
|
||||
set_current_modes);
|
||||
|
||||
if (allowed == MM_MODEM_MODE_2G)
|
||||
linktop_mode = LINKTOP_MODE_2G;
|
||||
@@ -302,10 +302,10 @@ iface_modem_init (MMIfaceModem *iface)
|
||||
|
||||
iface->load_supported_modes = load_supported_modes;
|
||||
iface->load_supported_modes_finish = load_supported_modes_finish;
|
||||
iface->load_allowed_modes = load_allowed_modes;
|
||||
iface->load_allowed_modes_finish = load_allowed_modes_finish;
|
||||
iface->set_allowed_modes = set_allowed_modes;
|
||||
iface->set_allowed_modes_finish = set_allowed_modes_finish;
|
||||
iface->load_current_modes = load_current_modes;
|
||||
iface->load_current_modes_finish = load_current_modes_finish;
|
||||
iface->set_current_modes = set_current_modes;
|
||||
iface->set_current_modes_finish = set_current_modes_finish;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -120,7 +120,7 @@ load_supported_modes (MMIfaceModem *self,
|
||||
/* Load initial allowed/preferred modes (Modem interface) */
|
||||
|
||||
static gboolean
|
||||
load_allowed_modes_finish (MMIfaceModem *self,
|
||||
load_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
MMModemMode *allowed,
|
||||
MMModemMode *preferred,
|
||||
@@ -179,7 +179,7 @@ load_allowed_modes_finish (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
load_allowed_modes (MMIfaceModem *self,
|
||||
load_current_modes (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -195,7 +195,7 @@ load_allowed_modes (MMIfaceModem *self,
|
||||
/* Set allowed modes (Modem interface) */
|
||||
|
||||
static gboolean
|
||||
set_allowed_modes_finish (MMIfaceModem *self,
|
||||
set_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -220,7 +220,7 @@ allowed_mode_update_ready (MMBroadbandModemLongcheer *self,
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_modes (MMIfaceModem *self,
|
||||
set_current_modes (MMIfaceModem *self,
|
||||
MMModemMode allowed,
|
||||
MMModemMode preferred,
|
||||
GAsyncReadyCallback callback,
|
||||
@@ -233,7 +233,7 @@ set_allowed_modes (MMIfaceModem *self,
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
set_allowed_modes);
|
||||
set_current_modes);
|
||||
|
||||
if (allowed == MM_MODEM_MODE_2G)
|
||||
mododr = 3;
|
||||
@@ -424,10 +424,10 @@ iface_modem_init (MMIfaceModem *iface)
|
||||
iface->load_access_technologies_finish = load_access_technologies_finish;
|
||||
iface->load_supported_modes = load_supported_modes;
|
||||
iface->load_supported_modes_finish = load_supported_modes_finish;
|
||||
iface->load_allowed_modes = load_allowed_modes;
|
||||
iface->load_allowed_modes_finish = load_allowed_modes_finish;
|
||||
iface->set_allowed_modes = set_allowed_modes;
|
||||
iface->set_allowed_modes_finish = set_allowed_modes_finish;
|
||||
iface->load_current_modes = load_current_modes;
|
||||
iface->load_current_modes_finish = load_current_modes_finish;
|
||||
iface->set_current_modes = set_current_modes;
|
||||
iface->set_current_modes_finish = set_current_modes_finish;
|
||||
iface->load_unlock_retries = load_unlock_retries;
|
||||
iface->load_unlock_retries_finish = load_unlock_retries_finish;
|
||||
}
|
||||
|
@@ -269,7 +269,7 @@ load_supported_modes (MMIfaceModem *self,
|
||||
/* Load initial allowed/preferred modes (Modem interface) */
|
||||
|
||||
static gboolean
|
||||
load_allowed_modes_finish (MMIfaceModem *_self,
|
||||
load_current_modes_finish (MMIfaceModem *_self,
|
||||
GAsyncResult *res,
|
||||
MMModemMode *allowed,
|
||||
MMModemMode *preferred,
|
||||
@@ -319,7 +319,7 @@ load_allowed_modes_finish (MMIfaceModem *_self,
|
||||
}
|
||||
|
||||
static void
|
||||
load_allowed_modes (MMIfaceModem *self,
|
||||
load_current_modes (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -338,19 +338,19 @@ typedef struct {
|
||||
MMBroadbandModemMbm *self;
|
||||
GSimpleAsyncResult *result;
|
||||
gint mbm_mode;
|
||||
} SetAllowedModesContext;
|
||||
} SetCurrentModesContext;
|
||||
|
||||
static void
|
||||
set_allowed_modes_context_complete_and_free (SetAllowedModesContext *ctx)
|
||||
set_current_modes_context_complete_and_free (SetCurrentModesContext *ctx)
|
||||
{
|
||||
g_simple_async_result_complete_in_idle (ctx->result);
|
||||
g_object_unref (ctx->result);
|
||||
g_object_unref (ctx->self);
|
||||
g_slice_free (SetAllowedModesContext, ctx);
|
||||
g_slice_free (SetCurrentModesContext, ctx);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
set_allowed_modes_finish (MMIfaceModem *self,
|
||||
set_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -360,7 +360,7 @@ set_allowed_modes_finish (MMIfaceModem *self,
|
||||
static void
|
||||
allowed_mode_update_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
SetAllowedModesContext *ctx)
|
||||
SetCurrentModesContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
@@ -373,25 +373,25 @@ allowed_mode_update_ready (MMBaseModem *self,
|
||||
ctx->self->priv->mbm_mode = ctx->mbm_mode;
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
}
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_modes (MMIfaceModem *self,
|
||||
set_current_modes (MMIfaceModem *self,
|
||||
MMModemMode allowed,
|
||||
MMModemMode preferred,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
SetAllowedModesContext *ctx;
|
||||
SetCurrentModesContext *ctx;
|
||||
gchar *command;
|
||||
|
||||
ctx = g_slice_new (SetAllowedModesContext);
|
||||
ctx = g_slice_new (SetCurrentModesContext);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
set_allowed_modes);
|
||||
set_current_modes);
|
||||
ctx->mbm_mode = -1;
|
||||
|
||||
if (allowed == MM_MODEM_MODE_2G)
|
||||
@@ -419,7 +419,7 @@ set_allowed_modes (MMIfaceModem *self,
|
||||
g_free (allowed_str);
|
||||
g_free (preferred_str);
|
||||
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1322,10 +1322,10 @@ iface_modem_init (MMIfaceModem *iface)
|
||||
iface->modem_after_sim_unlock_finish = modem_after_sim_unlock_finish;
|
||||
iface->load_supported_modes = load_supported_modes;
|
||||
iface->load_supported_modes_finish = load_supported_modes_finish;
|
||||
iface->load_allowed_modes = load_allowed_modes;
|
||||
iface->load_allowed_modes_finish = load_allowed_modes_finish;
|
||||
iface->set_allowed_modes = set_allowed_modes;
|
||||
iface->set_allowed_modes_finish = set_allowed_modes_finish;
|
||||
iface->load_current_modes = load_current_modes;
|
||||
iface->load_current_modes_finish = load_current_modes_finish;
|
||||
iface->set_current_modes = set_current_modes;
|
||||
iface->set_current_modes_finish = set_current_modes_finish;
|
||||
iface->reset = reset;
|
||||
iface->reset_finish = reset_finish;
|
||||
iface->factory_reset = factory_reset;
|
||||
|
@@ -138,16 +138,16 @@ load_supported_modes (MMIfaceModem *self,
|
||||
typedef struct {
|
||||
MMModemMode allowed;
|
||||
MMModemMode preferred;
|
||||
} LoadAllowedModesResult;
|
||||
} LoadCurrentModesResult;
|
||||
|
||||
static gboolean
|
||||
load_allowed_modes_finish (MMIfaceModem *self,
|
||||
load_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
MMModemMode *allowed,
|
||||
MMModemMode *preferred,
|
||||
GError **error)
|
||||
{
|
||||
LoadAllowedModesResult *result;
|
||||
LoadCurrentModesResult *result;
|
||||
|
||||
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
||||
return FALSE;
|
||||
@@ -164,7 +164,7 @@ nwrat_query_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GSimpleAsyncResult *simple)
|
||||
{
|
||||
LoadAllowedModesResult result;
|
||||
LoadCurrentModesResult result;
|
||||
GError *error = NULL;
|
||||
const gchar *response;
|
||||
GRegex *r;
|
||||
@@ -255,7 +255,7 @@ nwrat_query_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
load_allowed_modes (MMIfaceModem *self,
|
||||
load_current_modes (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -264,7 +264,7 @@ load_allowed_modes (MMIfaceModem *self,
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
load_allowed_modes);
|
||||
load_current_modes);
|
||||
|
||||
/* Load allowed modes only in 3GPP modems */
|
||||
if (!mm_iface_modem_is_3gpp (self)) {
|
||||
@@ -290,7 +290,7 @@ load_allowed_modes (MMIfaceModem *self,
|
||||
/* Set allowed modes (Modem interface) */
|
||||
|
||||
static gboolean
|
||||
set_allowed_modes_finish (MMIfaceModem *self,
|
||||
set_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -315,7 +315,7 @@ allowed_mode_update_ready (MMBroadbandModemNovatel *self,
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_modes (MMIfaceModem *self,
|
||||
set_current_modes (MMIfaceModem *self,
|
||||
MMModemMode allowed,
|
||||
MMModemMode preferred,
|
||||
GAsyncReadyCallback callback,
|
||||
@@ -329,7 +329,7 @@ set_allowed_modes (MMIfaceModem *self,
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
set_allowed_modes);
|
||||
set_current_modes);
|
||||
|
||||
/* Setting allowed modes only in 3GPP modems */
|
||||
if (!mm_iface_modem_is_3gpp (self)) {
|
||||
@@ -1237,10 +1237,10 @@ iface_modem_init (MMIfaceModem *iface)
|
||||
|
||||
iface->load_supported_modes = load_supported_modes;
|
||||
iface->load_supported_modes_finish = load_supported_modes_finish;
|
||||
iface->load_allowed_modes = load_allowed_modes;
|
||||
iface->load_allowed_modes_finish = load_allowed_modes_finish;
|
||||
iface->set_allowed_modes = set_allowed_modes;
|
||||
iface->set_allowed_modes_finish = set_allowed_modes_finish;
|
||||
iface->load_current_modes = load_current_modes;
|
||||
iface->load_current_modes_finish = load_current_modes_finish;
|
||||
iface->set_current_modes = set_current_modes;
|
||||
iface->set_current_modes_finish = set_current_modes_finish;
|
||||
iface->load_access_technologies_finish = modem_load_access_technologies_finish;
|
||||
iface->load_access_technologies = modem_load_access_technologies;
|
||||
iface->load_signal_quality = modem_load_signal_quality;
|
||||
|
@@ -143,7 +143,7 @@ load_supported_modes (MMIfaceModem *self,
|
||||
/* Load initial allowed/preferred modes (Modem interface) */
|
||||
|
||||
static gboolean
|
||||
load_allowed_modes_finish (MMIfaceModem *self,
|
||||
load_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
MMModemMode *allowed,
|
||||
MMModemMode *preferred,
|
||||
@@ -202,7 +202,7 @@ load_allowed_modes_finish (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
load_allowed_modes (MMIfaceModem *self,
|
||||
load_current_modes (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -218,7 +218,7 @@ load_allowed_modes (MMIfaceModem *self,
|
||||
/* Set allowed modes (Modem interface) */
|
||||
|
||||
static gboolean
|
||||
set_allowed_modes_finish (MMIfaceModem *self,
|
||||
set_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -243,7 +243,7 @@ allowed_mode_update_ready (MMBroadbandModemOption *self,
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_modes (MMIfaceModem *self,
|
||||
set_current_modes (MMIfaceModem *self,
|
||||
MMModemMode allowed,
|
||||
MMModemMode preferred,
|
||||
GAsyncReadyCallback callback,
|
||||
@@ -256,7 +256,7 @@ set_allowed_modes (MMIfaceModem *self,
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
set_allowed_modes);
|
||||
set_current_modes);
|
||||
|
||||
if (allowed == MM_MODEM_MODE_2G)
|
||||
option_mode = 0;
|
||||
@@ -1232,10 +1232,10 @@ iface_modem_init (MMIfaceModem *iface)
|
||||
iface->load_access_technologies_finish = load_access_technologies_finish;
|
||||
iface->load_supported_modes = load_supported_modes;
|
||||
iface->load_supported_modes_finish = load_supported_modes_finish;
|
||||
iface->load_allowed_modes = load_allowed_modes;
|
||||
iface->load_allowed_modes_finish = load_allowed_modes_finish;
|
||||
iface->set_allowed_modes = set_allowed_modes;
|
||||
iface->set_allowed_modes_finish = set_allowed_modes_finish;
|
||||
iface->load_current_modes = load_current_modes;
|
||||
iface->load_current_modes_finish = load_current_modes_finish;
|
||||
iface->set_current_modes = set_current_modes;
|
||||
iface->set_current_modes_finish = set_current_modes_finish;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -622,16 +622,16 @@ load_supported_modes (MMIfaceModem *self,
|
||||
typedef struct {
|
||||
MMModemMode allowed;
|
||||
MMModemMode preferred;
|
||||
} LoadAllowedModesResult;
|
||||
} LoadCurrentModesResult;
|
||||
|
||||
static gboolean
|
||||
load_allowed_modes_finish (MMIfaceModem *self,
|
||||
load_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
MMModemMode *allowed,
|
||||
MMModemMode *preferred,
|
||||
GError **error)
|
||||
{
|
||||
LoadAllowedModesResult *result;
|
||||
LoadCurrentModesResult *result;
|
||||
|
||||
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
||||
return FALSE;
|
||||
@@ -648,7 +648,7 @@ selrat_query_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GSimpleAsyncResult *simple)
|
||||
{
|
||||
LoadAllowedModesResult result;
|
||||
LoadCurrentModesResult result;
|
||||
const gchar *response;
|
||||
GError *error = NULL;
|
||||
GRegex *r = NULL;
|
||||
@@ -746,7 +746,7 @@ selrat_query_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
load_allowed_modes (MMIfaceModem *self,
|
||||
load_current_modes (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -756,7 +756,7 @@ load_allowed_modes (MMIfaceModem *self,
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
load_allowed_modes);
|
||||
load_current_modes);
|
||||
|
||||
if (!mm_iface_modem_is_3gpp (self)) {
|
||||
/* Cannot do this in CDMA modems */
|
||||
@@ -794,10 +794,10 @@ load_allowed_modes (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Set allowed modes (Modem interface) */
|
||||
/* Set current modes (Modem interface) */
|
||||
|
||||
static gboolean
|
||||
set_allowed_modes_finish (MMIfaceModem *self,
|
||||
set_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -821,7 +821,7 @@ selrat_set_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_modes (MMIfaceModem *self,
|
||||
set_current_modes (MMIfaceModem *self,
|
||||
MMModemMode allowed,
|
||||
MMModemMode preferred,
|
||||
GAsyncReadyCallback callback,
|
||||
@@ -835,7 +835,7 @@ set_allowed_modes (MMIfaceModem *self,
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
load_allowed_modes);
|
||||
set_current_modes);
|
||||
|
||||
if (!mm_iface_modem_is_3gpp (self)) {
|
||||
/* Cannot do this in CDMA modems */
|
||||
@@ -1665,10 +1665,10 @@ iface_modem_init (MMIfaceModem *iface)
|
||||
|
||||
iface->load_supported_modes = load_supported_modes;
|
||||
iface->load_supported_modes_finish = load_supported_modes_finish;
|
||||
iface->load_allowed_modes = load_allowed_modes;
|
||||
iface->load_allowed_modes_finish = load_allowed_modes_finish;
|
||||
iface->set_allowed_modes = set_allowed_modes;
|
||||
iface->set_allowed_modes_finish = set_allowed_modes_finish;
|
||||
iface->load_current_modes = load_current_modes;
|
||||
iface->load_current_modes_finish = load_current_modes_finish;
|
||||
iface->set_current_modes = set_current_modes;
|
||||
iface->set_current_modes_finish = set_current_modes_finish;
|
||||
iface->load_access_technologies = load_access_technologies;
|
||||
iface->load_access_technologies_finish = load_access_technologies_finish;
|
||||
iface->load_own_numbers = modem_load_own_numbers;
|
||||
|
@@ -532,17 +532,17 @@ load_supported_modes (MMIfaceModem *self,
|
||||
typedef struct {
|
||||
MMModemMode allowed;
|
||||
MMModemMode preferred;
|
||||
} LoadAllowedModesResult;
|
||||
} LoadCurrentModesResult;
|
||||
|
||||
typedef struct {
|
||||
MMBroadbandModemSimtech *self;
|
||||
GSimpleAsyncResult *result;
|
||||
gint acqord;
|
||||
gint modepref;
|
||||
} LoadAllowedModesContext;
|
||||
} LoadCurrentModesContext;
|
||||
|
||||
static void
|
||||
load_allowed_modes_context_complete_and_free (LoadAllowedModesContext *ctx)
|
||||
load_current_modes_context_complete_and_free (LoadCurrentModesContext *ctx)
|
||||
{
|
||||
g_simple_async_result_complete (ctx->result);
|
||||
g_object_unref (ctx->result);
|
||||
@@ -551,13 +551,13 @@ load_allowed_modes_context_complete_and_free (LoadAllowedModesContext *ctx)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
load_allowed_modes_finish (MMIfaceModem *self,
|
||||
load_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
MMModemMode *allowed,
|
||||
MMModemMode *preferred,
|
||||
GError **error)
|
||||
{
|
||||
LoadAllowedModesResult *result;
|
||||
LoadCurrentModesResult *result;
|
||||
|
||||
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
||||
return FALSE;
|
||||
@@ -571,9 +571,9 @@ load_allowed_modes_finish (MMIfaceModem *self,
|
||||
static void
|
||||
cnmp_query_ready (MMBroadbandModemSimtech *self,
|
||||
GAsyncResult *res,
|
||||
LoadAllowedModesContext *ctx)
|
||||
LoadCurrentModesContext *ctx)
|
||||
{
|
||||
LoadAllowedModesResult *result;
|
||||
LoadCurrentModesResult *result;
|
||||
const gchar *response, *p;
|
||||
GError *error = NULL;
|
||||
|
||||
@@ -581,7 +581,7 @@ cnmp_query_ready (MMBroadbandModemSimtech *self,
|
||||
if (!response) {
|
||||
/* Let the error be critical. */
|
||||
g_simple_async_result_take_error (ctx->result, error);
|
||||
load_allowed_modes_context_complete_and_free (ctx);
|
||||
load_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -593,11 +593,11 @@ cnmp_query_ready (MMBroadbandModemSimtech *self,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
"Failed to parse the mode preference response: '%s'",
|
||||
response);
|
||||
load_allowed_modes_context_complete_and_free (ctx);
|
||||
load_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
result = g_new (LoadAllowedModesResult, 1);
|
||||
result = g_new (LoadCurrentModesResult, 1);
|
||||
result->allowed = MM_MODEM_MODE_NONE;
|
||||
result->preferred = MM_MODEM_MODE_NONE;
|
||||
|
||||
@@ -625,7 +625,7 @@ cnmp_query_ready (MMBroadbandModemSimtech *self,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
"Unknown acquisition order preference: '%d'",
|
||||
ctx->acqord);
|
||||
load_allowed_modes_context_complete_and_free (ctx);
|
||||
load_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@@ -649,7 +649,7 @@ cnmp_query_ready (MMBroadbandModemSimtech *self,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
"Unknown mode preference: '%d'",
|
||||
ctx->modepref);
|
||||
load_allowed_modes_context_complete_and_free (ctx);
|
||||
load_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -657,13 +657,13 @@ cnmp_query_ready (MMBroadbandModemSimtech *self,
|
||||
g_simple_async_result_set_op_res_gpointer (ctx->result,
|
||||
result,
|
||||
g_free);
|
||||
load_allowed_modes_context_complete_and_free (ctx);
|
||||
load_current_modes_context_complete_and_free (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
cnaop_query_ready (MMBroadbandModemSimtech *self,
|
||||
GAsyncResult *res,
|
||||
LoadAllowedModesContext *ctx)
|
||||
LoadCurrentModesContext *ctx)
|
||||
{
|
||||
const gchar *response, *p;
|
||||
GError *error = NULL;
|
||||
@@ -672,7 +672,7 @@ cnaop_query_ready (MMBroadbandModemSimtech *self,
|
||||
if (!response) {
|
||||
/* Let the error be critical. */
|
||||
g_simple_async_result_take_error (ctx->result, error);
|
||||
load_allowed_modes_context_complete_and_free (ctx);
|
||||
load_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -687,7 +687,7 @@ cnaop_query_ready (MMBroadbandModemSimtech *self,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
"Failed to parse the acquisition order response: '%s'",
|
||||
response);
|
||||
load_allowed_modes_context_complete_and_free (ctx);
|
||||
load_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -701,18 +701,18 @@ cnaop_query_ready (MMBroadbandModemSimtech *self,
|
||||
}
|
||||
|
||||
static void
|
||||
load_allowed_modes (MMIfaceModem *self,
|
||||
load_current_modes (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
LoadAllowedModesContext *ctx;
|
||||
LoadCurrentModesContext *ctx;
|
||||
|
||||
ctx = g_new (LoadAllowedModesContext, 1);
|
||||
ctx = g_new (LoadCurrentModesContext, 1);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
load_allowed_modes);
|
||||
load_current_modes);
|
||||
ctx->acqord = -1;
|
||||
ctx->modepref = -1;
|
||||
|
||||
@@ -733,10 +733,10 @@ typedef struct {
|
||||
GSimpleAsyncResult *result;
|
||||
guint nmp; /* mode preference */
|
||||
guint naop; /* acquisition order */
|
||||
} SetAllowedModesContext;
|
||||
} SetCurrentModesContext;
|
||||
|
||||
static void
|
||||
set_allowed_modes_context_complete_and_free (SetAllowedModesContext *ctx)
|
||||
set_current_modes_context_complete_and_free (SetCurrentModesContext *ctx)
|
||||
{
|
||||
g_simple_async_result_complete_in_idle (ctx->result);
|
||||
g_object_unref (ctx->result);
|
||||
@@ -745,7 +745,7 @@ set_allowed_modes_context_complete_and_free (SetAllowedModesContext *ctx)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
set_allowed_modes_finish (MMIfaceModem *self,
|
||||
set_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -755,7 +755,7 @@ set_allowed_modes_finish (MMIfaceModem *self,
|
||||
static void
|
||||
cnaop_set_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
SetAllowedModesContext *ctx)
|
||||
SetCurrentModesContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
@@ -766,13 +766,13 @@ cnaop_set_ready (MMBaseModem *self,
|
||||
else
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
cnmp_set_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
SetAllowedModesContext *ctx)
|
||||
SetCurrentModesContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
gchar *command;
|
||||
@@ -781,7 +781,7 @@ cnmp_set_ready (MMBaseModem *self,
|
||||
if (error) {
|
||||
/* Let the error be critical. */
|
||||
g_simple_async_result_take_error (ctx->result, error);
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -797,21 +797,21 @@ cnmp_set_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_modes (MMIfaceModem *self,
|
||||
set_current_modes (MMIfaceModem *self,
|
||||
MMModemMode allowed,
|
||||
MMModemMode preferred,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
SetAllowedModesContext *ctx;
|
||||
SetCurrentModesContext *ctx;
|
||||
gchar *command;
|
||||
|
||||
ctx = g_new (SetAllowedModesContext, 1);
|
||||
ctx = g_new (SetCurrentModesContext, 1);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
set_allowed_modes);
|
||||
set_current_modes);
|
||||
|
||||
/* Defaults: automatic search */
|
||||
ctx->nmp = 2;
|
||||
@@ -851,7 +851,7 @@ set_allowed_modes (MMIfaceModem *self,
|
||||
g_free (allowed_str);
|
||||
g_free (preferred_str);
|
||||
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -927,10 +927,10 @@ iface_modem_init (MMIfaceModem *iface)
|
||||
iface->load_access_technologies_finish = load_access_technologies_finish;
|
||||
iface->load_supported_modes = load_supported_modes;
|
||||
iface->load_supported_modes_finish = load_supported_modes_finish;
|
||||
iface->load_allowed_modes = load_allowed_modes;
|
||||
iface->load_allowed_modes_finish = load_allowed_modes_finish;
|
||||
iface->set_allowed_modes = set_allowed_modes;
|
||||
iface->set_allowed_modes_finish = set_allowed_modes_finish;
|
||||
iface->load_current_modes = load_current_modes;
|
||||
iface->load_current_modes_finish = load_current_modes_finish;
|
||||
iface->set_current_modes = set_current_modes;
|
||||
iface->set_current_modes_finish = set_current_modes_finish;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -212,16 +212,16 @@ load_supported_modes (MMIfaceModem *self,
|
||||
typedef struct {
|
||||
MMModemMode allowed;
|
||||
MMModemMode preferred;
|
||||
} LoadAllowedModesResult;
|
||||
} LoadCurrentModesResult;
|
||||
|
||||
static gboolean
|
||||
load_allowed_modes_finish (MMIfaceModem *self,
|
||||
load_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
MMModemMode *allowed,
|
||||
MMModemMode *preferred,
|
||||
GError **error)
|
||||
{
|
||||
LoadAllowedModesResult *result;
|
||||
LoadCurrentModesResult *result;
|
||||
|
||||
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
||||
return FALSE;
|
||||
@@ -240,7 +240,7 @@ wwsm_read_ready (MMBaseModem *self,
|
||||
{
|
||||
GRegex *r;
|
||||
GMatchInfo *match_info = NULL;
|
||||
LoadAllowedModesResult result;
|
||||
LoadCurrentModesResult result;
|
||||
const gchar *response;
|
||||
GError *error = NULL;
|
||||
|
||||
@@ -330,7 +330,7 @@ current_ms_class_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
GSimpleAsyncResult *simple)
|
||||
{
|
||||
LoadAllowedModesResult result;
|
||||
LoadCurrentModesResult result;
|
||||
const gchar *response;
|
||||
GError *error = NULL;
|
||||
|
||||
@@ -394,7 +394,7 @@ current_ms_class_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
load_allowed_modes (MMIfaceModem *self,
|
||||
load_current_modes (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -403,7 +403,7 @@ load_allowed_modes (MMIfaceModem *self,
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
load_allowed_modes);
|
||||
load_current_modes);
|
||||
|
||||
mm_base_modem_at_command (MM_BASE_MODEM (self),
|
||||
"+CGCLASS?",
|
||||
@@ -421,10 +421,10 @@ typedef struct {
|
||||
GSimpleAsyncResult *result;
|
||||
gchar *cgclass_command;
|
||||
gchar *wwsm_command;
|
||||
} SetAllowedModesContext;
|
||||
} SetCurrentModesContext;
|
||||
|
||||
static void
|
||||
set_allowed_modes_context_complete_and_free (SetAllowedModesContext *ctx)
|
||||
set_current_modes_context_complete_and_free (SetCurrentModesContext *ctx)
|
||||
{
|
||||
g_simple_async_result_complete_in_idle (ctx->result);
|
||||
g_object_unref (ctx->result);
|
||||
@@ -435,7 +435,7 @@ set_allowed_modes_context_complete_and_free (SetAllowedModesContext *ctx)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
set_allowed_modes_finish (MMIfaceModem *self,
|
||||
set_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -445,7 +445,7 @@ set_allowed_modes_finish (MMIfaceModem *self,
|
||||
static void
|
||||
wwsm_update_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
SetAllowedModesContext *ctx)
|
||||
SetCurrentModesContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
@@ -456,13 +456,13 @@ wwsm_update_ready (MMBaseModem *self,
|
||||
else
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
cgclass_update_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
SetAllowedModesContext *ctx)
|
||||
SetCurrentModesContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
@@ -470,13 +470,13 @@ cgclass_update_ready (MMBaseModem *self,
|
||||
if (error) {
|
||||
/* Let the error be critical. */
|
||||
g_simple_async_result_take_error (ctx->result, error);
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ctx->wwsm_command) {
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -489,20 +489,20 @@ cgclass_update_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_modes (MMIfaceModem *self,
|
||||
set_current_modes (MMIfaceModem *self,
|
||||
MMModemMode allowed,
|
||||
MMModemMode preferred,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
SetAllowedModesContext *ctx;
|
||||
SetCurrentModesContext *ctx;
|
||||
|
||||
ctx = g_new0 (SetAllowedModesContext, 1);
|
||||
ctx = g_new0 (SetCurrentModesContext, 1);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
set_allowed_modes);
|
||||
set_current_modes);
|
||||
|
||||
/* Handle ANY/NONE */
|
||||
if (allowed == MM_MODEM_MODE_ANY && preferred == MM_MODEM_MODE_NONE) {
|
||||
@@ -553,7 +553,7 @@ set_allowed_modes (MMIfaceModem *self,
|
||||
g_free (allowed_str);
|
||||
g_free (preferred_str);
|
||||
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1186,10 +1186,10 @@ iface_modem_init (MMIfaceModem *iface)
|
||||
|
||||
iface->load_supported_modes = load_supported_modes;
|
||||
iface->load_supported_modes_finish = load_supported_modes_finish;
|
||||
iface->load_allowed_modes = load_allowed_modes;
|
||||
iface->load_allowed_modes_finish = load_allowed_modes_finish;
|
||||
iface->set_allowed_modes = set_allowed_modes;
|
||||
iface->set_allowed_modes_finish = set_allowed_modes_finish;
|
||||
iface->load_current_modes = load_current_modes;
|
||||
iface->load_current_modes_finish = load_current_modes_finish;
|
||||
iface->set_current_modes = set_current_modes;
|
||||
iface->set_current_modes_finish = set_current_modes_finish;
|
||||
iface->load_supported_bands = load_supported_bands;
|
||||
iface->load_supported_bands_finish = load_supported_bands_finish;
|
||||
iface->load_current_bands = load_current_bands;
|
||||
|
@@ -115,7 +115,7 @@ load_supported_modes (MMIfaceModem *self,
|
||||
/* Load initial allowed/preferred modes (Modem interface) */
|
||||
|
||||
static gboolean
|
||||
load_allowed_modes_finish (MMIfaceModem *self,
|
||||
load_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
MMModemMode *allowed,
|
||||
MMModemMode *preferred,
|
||||
@@ -180,7 +180,7 @@ load_allowed_modes_finish (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
load_allowed_modes (MMIfaceModem *self,
|
||||
load_current_modes (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -196,7 +196,7 @@ load_allowed_modes (MMIfaceModem *self,
|
||||
/* Set allowed modes (Modem interface) */
|
||||
|
||||
static gboolean
|
||||
set_allowed_modes_finish (MMIfaceModem *self,
|
||||
set_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -221,7 +221,7 @@ allowed_mode_update_ready (MMBroadbandModemX22x *self,
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_modes (MMIfaceModem *self,
|
||||
set_current_modes (MMIfaceModem *self,
|
||||
MMModemMode allowed,
|
||||
MMModemMode preferred,
|
||||
GAsyncReadyCallback callback,
|
||||
@@ -234,7 +234,7 @@ set_allowed_modes (MMIfaceModem *self,
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
set_allowed_modes);
|
||||
set_current_modes);
|
||||
|
||||
if (allowed == MM_MODEM_MODE_2G)
|
||||
syssel = 1;
|
||||
@@ -346,10 +346,10 @@ iface_modem_init (MMIfaceModem *iface)
|
||||
iface->load_access_technologies_finish = load_access_technologies_finish;
|
||||
iface->load_supported_modes = load_supported_modes;
|
||||
iface->load_supported_modes_finish = load_supported_modes_finish;
|
||||
iface->load_allowed_modes = load_allowed_modes;
|
||||
iface->load_allowed_modes_finish = load_allowed_modes_finish;
|
||||
iface->set_allowed_modes = set_allowed_modes;
|
||||
iface->set_allowed_modes_finish = set_allowed_modes_finish;
|
||||
iface->load_current_modes = load_current_modes;
|
||||
iface->load_current_modes_finish = load_current_modes_finish;
|
||||
iface->set_current_modes = set_current_modes;
|
||||
iface->set_current_modes_finish = set_current_modes_finish;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -347,7 +347,7 @@ load_supported_modes (MMIfaceModem *self,
|
||||
/* Load initial allowed/preferred modes (Modem interface) */
|
||||
|
||||
static gboolean
|
||||
load_allowed_modes_finish (MMIfaceModem *self,
|
||||
load_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
MMModemMode *allowed,
|
||||
MMModemMode *preferred,
|
||||
@@ -434,7 +434,7 @@ done:
|
||||
}
|
||||
|
||||
static void
|
||||
load_allowed_modes (MMIfaceModem *self,
|
||||
load_current_modes (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
@@ -450,7 +450,7 @@ load_allowed_modes (MMIfaceModem *self,
|
||||
/* Set allowed modes (Modem interface) */
|
||||
|
||||
static gboolean
|
||||
set_allowed_modes_finish (MMIfaceModem *self,
|
||||
set_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -476,7 +476,7 @@ allowed_mode_update_ready (MMBroadbandModemZte *self,
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_modes (MMIfaceModem *self,
|
||||
set_current_modes (MMIfaceModem *self,
|
||||
MMModemMode allowed,
|
||||
MMModemMode preferred,
|
||||
GAsyncReadyCallback callback,
|
||||
@@ -490,7 +490,7 @@ set_allowed_modes (MMIfaceModem *self,
|
||||
result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
set_allowed_modes);
|
||||
set_current_modes);
|
||||
|
||||
if (allowed == MM_MODEM_MODE_2G) {
|
||||
cm_mode = 1;
|
||||
@@ -780,10 +780,10 @@ iface_modem_init (MMIfaceModem *iface)
|
||||
iface->load_access_technologies_finish = load_access_technologies_finish;
|
||||
iface->load_supported_modes = load_supported_modes;
|
||||
iface->load_supported_modes_finish = load_supported_modes_finish;
|
||||
iface->load_allowed_modes = load_allowed_modes;
|
||||
iface->load_allowed_modes_finish = load_allowed_modes_finish;
|
||||
iface->set_allowed_modes = set_allowed_modes;
|
||||
iface->set_allowed_modes_finish = set_allowed_modes_finish;
|
||||
iface->load_current_modes = load_current_modes;
|
||||
iface->load_current_modes_finish = load_current_modes_finish;
|
||||
iface->set_current_modes = set_current_modes;
|
||||
iface->set_current_modes_finish = set_current_modes_finish;
|
||||
iface->load_unlock_retries = load_unlock_retries;
|
||||
iface->load_unlock_retries_finish = load_unlock_retries_finish;
|
||||
}
|
||||
|
@@ -2468,7 +2468,7 @@ modem_factory_reset (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Load allowed modes (Modem interface) */
|
||||
/* Load current modes (Modem interface) */
|
||||
|
||||
typedef struct {
|
||||
MMBroadbandModemQmi *self;
|
||||
@@ -2476,15 +2476,15 @@ typedef struct {
|
||||
GSimpleAsyncResult *result;
|
||||
gboolean run_get_system_selection_preference;
|
||||
gboolean run_get_technology_preference;
|
||||
} LoadAllowedModesContext;
|
||||
} LoadCurrentModesContext;
|
||||
|
||||
typedef struct {
|
||||
MMModemMode allowed;
|
||||
MMModemMode preferred;
|
||||
} LoadAllowedModesResult;
|
||||
} LoadCurrentModesResult;
|
||||
|
||||
static void
|
||||
load_allowed_modes_context_complete_and_free (LoadAllowedModesContext *ctx)
|
||||
load_current_modes_context_complete_and_free (LoadCurrentModesContext *ctx)
|
||||
{
|
||||
g_simple_async_result_complete_in_idle (ctx->result);
|
||||
g_object_unref (ctx->result);
|
||||
@@ -2494,13 +2494,13 @@ load_allowed_modes_context_complete_and_free (LoadAllowedModesContext *ctx)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
load_allowed_modes_finish (MMIfaceModem *self,
|
||||
load_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
MMModemMode *allowed,
|
||||
MMModemMode *preferred,
|
||||
GError **error)
|
||||
{
|
||||
LoadAllowedModesResult *result;
|
||||
LoadCurrentModesResult *result;
|
||||
|
||||
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
|
||||
return FALSE;
|
||||
@@ -2511,14 +2511,14 @@ load_allowed_modes_finish (MMIfaceModem *self,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void load_allowed_modes_context_step (LoadAllowedModesContext *ctx);
|
||||
static void load_current_modes_context_step (LoadCurrentModesContext *ctx);
|
||||
|
||||
static void
|
||||
get_technology_preference_ready (QmiClientNas *client,
|
||||
GAsyncResult *res,
|
||||
LoadAllowedModesContext *ctx)
|
||||
LoadCurrentModesContext *ctx)
|
||||
{
|
||||
LoadAllowedModesResult *result = NULL;
|
||||
LoadCurrentModesResult *result = NULL;
|
||||
QmiMessageNasGetTechnologyPreferenceOutput *output = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
@@ -2547,7 +2547,7 @@ get_technology_preference_ready (QmiClientNas *client,
|
||||
g_free (str);
|
||||
} else {
|
||||
/* We got a valid value from here */
|
||||
result = g_new (LoadAllowedModesResult, 1);
|
||||
result = g_new (LoadCurrentModesResult, 1);
|
||||
result->allowed = allowed;
|
||||
result->preferred = MM_MODEM_MODE_NONE;
|
||||
}
|
||||
@@ -2558,7 +2558,7 @@ get_technology_preference_ready (QmiClientNas *client,
|
||||
|
||||
if (!result) {
|
||||
ctx->run_get_technology_preference = FALSE;
|
||||
load_allowed_modes_context_step (ctx);
|
||||
load_current_modes_context_step (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2566,15 +2566,15 @@ get_technology_preference_ready (QmiClientNas *client,
|
||||
ctx->result,
|
||||
result,
|
||||
(GDestroyNotify)g_free);
|
||||
load_allowed_modes_context_complete_and_free (ctx);
|
||||
load_current_modes_context_complete_and_free (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
allowed_modes_get_system_selection_preference_ready (QmiClientNas *client,
|
||||
current_modes_get_system_selection_preference_ready (QmiClientNas *client,
|
||||
GAsyncResult *res,
|
||||
LoadAllowedModesContext *ctx)
|
||||
LoadCurrentModesContext *ctx)
|
||||
{
|
||||
LoadAllowedModesResult *result = NULL;
|
||||
LoadCurrentModesResult *result = NULL;
|
||||
QmiMessageNasGetSystemSelectionPreferenceOutput *output = NULL;
|
||||
GError *error = NULL;
|
||||
QmiNasRatModePreference mode_preference_mask = 0;
|
||||
@@ -2605,7 +2605,7 @@ allowed_modes_get_system_selection_preference_ready (QmiClientNas *client,
|
||||
QmiNasGsmWcdmaAcquisitionOrderPreference gsm_or_wcdma;
|
||||
|
||||
/* We got a valid value from here */
|
||||
result = g_new (LoadAllowedModesResult, 1);
|
||||
result = g_new (LoadCurrentModesResult, 1);
|
||||
result->allowed = allowed;
|
||||
result->preferred = MM_MODEM_MODE_NONE;
|
||||
|
||||
@@ -2626,7 +2626,7 @@ allowed_modes_get_system_selection_preference_ready (QmiClientNas *client,
|
||||
if (!result) {
|
||||
/* Try with the deprecated command */
|
||||
ctx->run_get_system_selection_preference = FALSE;
|
||||
load_allowed_modes_context_step (ctx);
|
||||
load_current_modes_context_step (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2634,11 +2634,11 @@ allowed_modes_get_system_selection_preference_ready (QmiClientNas *client,
|
||||
ctx->result,
|
||||
result,
|
||||
(GDestroyNotify)g_free);
|
||||
load_allowed_modes_context_complete_and_free (ctx);
|
||||
load_current_modes_context_complete_and_free (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
load_allowed_modes_context_step (LoadAllowedModesContext *ctx)
|
||||
load_current_modes_context_step (LoadCurrentModesContext *ctx)
|
||||
{
|
||||
if (ctx->run_get_system_selection_preference) {
|
||||
qmi_client_nas_get_system_selection_preference (
|
||||
@@ -2646,7 +2646,7 @@ load_allowed_modes_context_step (LoadAllowedModesContext *ctx)
|
||||
NULL, /* no input */
|
||||
5,
|
||||
NULL, /* cancellable */
|
||||
(GAsyncReadyCallback)allowed_modes_get_system_selection_preference_ready,
|
||||
(GAsyncReadyCallback)current_modes_get_system_selection_preference_ready,
|
||||
ctx);
|
||||
return;
|
||||
}
|
||||
@@ -2666,16 +2666,16 @@ load_allowed_modes_context_step (LoadAllowedModesContext *ctx)
|
||||
ctx->result,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_UNSUPPORTED,
|
||||
"Loading allowed modes is not supported by this device");
|
||||
load_allowed_modes_context_complete_and_free (ctx);
|
||||
"Loading current modes is not supported by this device");
|
||||
load_current_modes_context_complete_and_free (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
load_allowed_modes (MMIfaceModem *self,
|
||||
load_current_modes (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
LoadAllowedModesContext *ctx;
|
||||
LoadCurrentModesContext *ctx;
|
||||
QmiClient *client = NULL;
|
||||
|
||||
if (!ensure_qmi_client (MM_BROADBAND_MODEM_QMI (self),
|
||||
@@ -2683,13 +2683,13 @@ load_allowed_modes (MMIfaceModem *self,
|
||||
callback, user_data))
|
||||
return;
|
||||
|
||||
ctx = g_new0 (LoadAllowedModesContext, 1);
|
||||
ctx = g_new0 (LoadCurrentModesContext, 1);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->client = g_object_ref (client);
|
||||
ctx->result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
load_allowed_modes);
|
||||
load_current_modes);
|
||||
|
||||
/* System selection preference introduced in NAS 1.1 */
|
||||
ctx->run_get_system_selection_preference = qmi_client_check_version (client, 1, 1);
|
||||
@@ -2697,7 +2697,7 @@ load_allowed_modes (MMIfaceModem *self,
|
||||
/* Technology preference introduced in NAS 1.0, so always available */
|
||||
ctx->run_get_technology_preference = TRUE;
|
||||
|
||||
load_allowed_modes_context_step (ctx);
|
||||
load_current_modes_context_step (ctx);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -2711,10 +2711,10 @@ typedef struct {
|
||||
MMModemMode preferred;
|
||||
gboolean run_set_system_selection_preference;
|
||||
gboolean run_set_technology_preference;
|
||||
} SetAllowedModesContext;
|
||||
} SetCurrentModesContext;
|
||||
|
||||
static void
|
||||
set_allowed_modes_context_complete_and_free (SetAllowedModesContext *ctx)
|
||||
set_current_modes_context_complete_and_free (SetCurrentModesContext *ctx)
|
||||
{
|
||||
g_simple_async_result_complete_in_idle (ctx->result);
|
||||
g_object_unref (ctx->result);
|
||||
@@ -2724,19 +2724,19 @@ set_allowed_modes_context_complete_and_free (SetAllowedModesContext *ctx)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
set_allowed_modes_finish (MMIfaceModem *self,
|
||||
set_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
|
||||
}
|
||||
|
||||
static void set_allowed_modes_context_step (SetAllowedModesContext *ctx);
|
||||
static void set_current_modes_context_step (SetCurrentModesContext *ctx);
|
||||
|
||||
static void
|
||||
set_technology_preference_ready (QmiClientNas *client,
|
||||
GAsyncResult *res,
|
||||
SetAllowedModesContext *ctx)
|
||||
SetCurrentModesContext *ctx)
|
||||
{
|
||||
QmiMessageNasSetTechnologyPreferenceOutput *output = NULL;
|
||||
GError *error = NULL;
|
||||
@@ -2756,19 +2756,19 @@ set_technology_preference_ready (QmiClientNas *client,
|
||||
if (error)
|
||||
g_error_free (error);
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
qmi_message_nas_set_technology_preference_output_unref (output);
|
||||
return;
|
||||
}
|
||||
|
||||
ctx->run_set_technology_preference = FALSE;
|
||||
set_allowed_modes_context_step (ctx);
|
||||
set_current_modes_context_step (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
allowed_modes_set_system_selection_preference_ready (QmiClientNas *client,
|
||||
GAsyncResult *res,
|
||||
SetAllowedModesContext *ctx)
|
||||
SetCurrentModesContext *ctx)
|
||||
{
|
||||
QmiMessageNasSetSystemSelectionPreferenceOutput *output = NULL;
|
||||
GError *error = NULL;
|
||||
@@ -2784,18 +2784,18 @@ allowed_modes_set_system_selection_preference_ready (QmiClientNas *client,
|
||||
} else {
|
||||
/* Good! TODO: do we really need to wait for the indication? */
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
qmi_message_nas_set_system_selection_preference_output_unref (output);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Try with the deprecated command */
|
||||
ctx->run_set_system_selection_preference = FALSE;
|
||||
set_allowed_modes_context_step (ctx);
|
||||
set_current_modes_context_step (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_modes_context_step (SetAllowedModesContext *ctx)
|
||||
set_current_modes_context_step (SetCurrentModesContext *ctx)
|
||||
{
|
||||
if (ctx->run_set_system_selection_preference) {
|
||||
QmiMessageNasSetSystemSelectionPreferenceInput *input;
|
||||
@@ -2814,7 +2814,7 @@ set_allowed_modes_context_step (SetAllowedModesContext *ctx)
|
||||
"Unhandled allowed mode setting: '%s'",
|
||||
str);
|
||||
g_free (str);
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2853,7 +2853,7 @@ set_allowed_modes_context_step (SetAllowedModesContext *ctx)
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
"Cannot set specific preferred mode");
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2869,7 +2869,7 @@ set_allowed_modes_context_step (SetAllowedModesContext *ctx)
|
||||
"Unhandled allowed mode setting: '%s'",
|
||||
str);
|
||||
g_free (str);
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2892,17 +2892,17 @@ set_allowed_modes_context_step (SetAllowedModesContext *ctx)
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_UNSUPPORTED,
|
||||
"Setting allowed modes is not supported by this device");
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_modes (MMIfaceModem *self,
|
||||
set_current_modes (MMIfaceModem *self,
|
||||
MMModemMode allowed,
|
||||
MMModemMode preferred,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
SetAllowedModesContext *ctx;
|
||||
SetCurrentModesContext *ctx;
|
||||
QmiClient *client = NULL;
|
||||
|
||||
if (!ensure_qmi_client (MM_BROADBAND_MODEM_QMI (self),
|
||||
@@ -2910,13 +2910,13 @@ set_allowed_modes (MMIfaceModem *self,
|
||||
callback, user_data))
|
||||
return;
|
||||
|
||||
ctx = g_new0 (SetAllowedModesContext, 1);
|
||||
ctx = g_new0 (SetCurrentModesContext, 1);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->client = g_object_ref (client);
|
||||
ctx->result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
set_allowed_modes);
|
||||
set_current_modes);
|
||||
|
||||
if (allowed == MM_MODEM_MODE_ANY && ctx->preferred == MM_MODEM_MODE_NONE) {
|
||||
ctx->allowed = (MM_MODEM_MODE_2G | MM_MODEM_MODE_3G);
|
||||
@@ -2934,7 +2934,7 @@ set_allowed_modes (MMIfaceModem *self,
|
||||
/* Technology preference introduced in NAS 1.0, so always available */
|
||||
ctx->run_set_technology_preference = TRUE;
|
||||
|
||||
set_allowed_modes_context_step (ctx);
|
||||
set_current_modes_context_step (ctx);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -8222,10 +8222,10 @@ iface_modem_init (MMIfaceModem *iface)
|
||||
iface->load_supported_charsets_finish = NULL;
|
||||
iface->setup_charset = NULL;
|
||||
iface->setup_charset_finish = NULL;
|
||||
iface->load_allowed_modes = load_allowed_modes;
|
||||
iface->load_allowed_modes_finish = load_allowed_modes_finish;
|
||||
iface->set_allowed_modes = set_allowed_modes;
|
||||
iface->set_allowed_modes_finish = set_allowed_modes_finish;
|
||||
iface->load_current_modes = load_current_modes;
|
||||
iface->load_current_modes_finish = load_current_modes_finish;
|
||||
iface->set_current_modes = set_current_modes;
|
||||
iface->set_current_modes_finish = set_current_modes_finish;
|
||||
iface->load_signal_quality = load_signal_quality;
|
||||
iface->load_signal_quality_finish = load_signal_quality_finish;
|
||||
iface->load_current_bands = modem_load_current_bands;
|
||||
|
@@ -174,7 +174,7 @@ typedef enum {
|
||||
CONNECTION_STEP_WAIT_FOR_INITIALIZED,
|
||||
CONNECTION_STEP_ENABLE,
|
||||
CONNECTION_STEP_WAIT_FOR_ENABLED,
|
||||
CONNECTION_STEP_ALLOWED_MODES,
|
||||
CONNECTION_STEP_CURRENT_MODES,
|
||||
CONNECTION_STEP_CURRENT_BANDS,
|
||||
CONNECTION_STEP_REGISTER,
|
||||
CONNECTION_STEP_BEARER,
|
||||
@@ -275,7 +275,7 @@ register_in_3gpp_or_cdma_network_ready (MMIfaceModemSimple *self,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
after_set_allowed_modes_timeout_cb (ConnectionContext *ctx)
|
||||
after_set_current_modes_timeout_cb (ConnectionContext *ctx)
|
||||
{
|
||||
/* Allowed modes set... almost there! */
|
||||
ctx->step++;
|
||||
@@ -284,13 +284,13 @@ after_set_allowed_modes_timeout_cb (ConnectionContext *ctx)
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_modes_ready (MMBaseModem *self,
|
||||
set_current_modes_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
ConnectionContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_iface_modem_set_allowed_modes_finish (MM_IFACE_MODEM (self), res, &error)) {
|
||||
if (!mm_iface_modem_set_current_modes_finish (MM_IFACE_MODEM (self), res, &error)) {
|
||||
if (g_error_matches (error,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_UNSUPPORTED)) {
|
||||
@@ -309,7 +309,7 @@ set_allowed_modes_ready (MMBaseModem *self,
|
||||
* a couple of seconds to settle down. This sleep time just makes sure that
|
||||
* the modem has enough time to report being unregistered. */
|
||||
mm_dbg ("Will wait to settle down after updating allowed modes");
|
||||
g_timeout_add_seconds (2, (GSourceFunc)after_set_allowed_modes_timeout_cb, ctx);
|
||||
g_timeout_add_seconds (2, (GSourceFunc)after_set_current_modes_timeout_cb, ctx);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -556,21 +556,21 @@ connection_step (ConnectionContext *ctx)
|
||||
ctx);
|
||||
return;
|
||||
|
||||
case CONNECTION_STEP_ALLOWED_MODES: {
|
||||
case CONNECTION_STEP_CURRENT_MODES: {
|
||||
MMModemMode allowed_modes = MM_MODEM_MODE_ANY;
|
||||
MMModemMode preferred_mode = MM_MODEM_MODE_NONE;
|
||||
|
||||
mm_info ("Simple connect state (%d/%d): Allowed mode",
|
||||
mm_info ("Simple connect state (%d/%d): Current modes",
|
||||
ctx->step, CONNECTION_STEP_LAST);
|
||||
|
||||
/* Don't set modes unless explicitly requested to do so */
|
||||
if (mm_simple_connect_properties_get_allowed_modes (ctx->properties,
|
||||
if (mm_simple_connect_properties_get_current_modes (ctx->properties,
|
||||
&allowed_modes,
|
||||
&preferred_mode)) {
|
||||
mm_iface_modem_set_allowed_modes (MM_IFACE_MODEM (ctx->self),
|
||||
mm_iface_modem_set_current_modes (MM_IFACE_MODEM (ctx->self),
|
||||
allowed_modes,
|
||||
preferred_mode,
|
||||
(GAsyncReadyCallback)set_allowed_modes_ready,
|
||||
(GAsyncReadyCallback)set_current_modes_ready,
|
||||
ctx);
|
||||
return;
|
||||
}
|
||||
@@ -790,7 +790,7 @@ connect_auth_ready (MMBaseModem *self,
|
||||
|
||||
mm_dbg (" PIN: %s", VALIDATE_UNSPECIFIED (mm_simple_connect_properties_get_pin (ctx->properties)));
|
||||
|
||||
if (mm_simple_connect_properties_get_allowed_modes (ctx->properties, &allowed, &preferred)) {
|
||||
if (mm_simple_connect_properties_get_current_modes (ctx->properties, &allowed, &preferred)) {
|
||||
str = mm_modem_mode_build_string_from_mask (allowed);
|
||||
mm_dbg (" Allowed mode: %s", str);
|
||||
g_free (str);
|
||||
|
@@ -2124,7 +2124,7 @@ handle_set_current_bands (MmGdbusModem *skeleton,
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ALLOWED MODES */
|
||||
/* Set current modes */
|
||||
|
||||
typedef struct {
|
||||
MMIfaceModem *self;
|
||||
@@ -2132,10 +2132,10 @@ typedef struct {
|
||||
GSimpleAsyncResult *result;
|
||||
MMModemMode allowed;
|
||||
MMModemMode preferred;
|
||||
} SetAllowedModesContext;
|
||||
} SetCurrentModesContext;
|
||||
|
||||
static void
|
||||
set_allowed_modes_context_complete_and_free (SetAllowedModesContext *ctx)
|
||||
set_current_modes_context_complete_and_free (SetCurrentModesContext *ctx)
|
||||
{
|
||||
g_simple_async_result_complete_in_idle (ctx->result);
|
||||
g_object_unref (ctx->result);
|
||||
@@ -2146,7 +2146,7 @@ set_allowed_modes_context_complete_and_free (SetAllowedModesContext *ctx)
|
||||
}
|
||||
|
||||
gboolean
|
||||
mm_iface_modem_set_allowed_modes_finish (MMIfaceModem *self,
|
||||
mm_iface_modem_set_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
@@ -2154,39 +2154,87 @@ mm_iface_modem_set_allowed_modes_finish (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
set_allowed_modes_ready (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
SetAllowedModesContext *ctx)
|
||||
after_set_load_current_modes_ready (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
SetCurrentModesContext *ctx)
|
||||
{
|
||||
MMModemMode allowed = MM_MODEM_MODE_NONE;
|
||||
MMModemMode preferred = MM_MODEM_MODE_NONE;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_allowed_modes_finish (self, res, &error))
|
||||
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->load_current_modes_finish (self,
|
||||
res,
|
||||
&allowed,
|
||||
&preferred,
|
||||
&error)) {
|
||||
/* Errors when getting allowed/preferred won't be critical */
|
||||
mm_warn ("couldn't load current allowed/preferred modes: '%s'", error->message);
|
||||
g_error_free (error);
|
||||
|
||||
/* If errors getting allowed modes, default to the ones we asked for */
|
||||
mm_gdbus_modem_set_current_modes (ctx->skeleton, g_variant_new ("(uu)", ctx->allowed, ctx->preferred));
|
||||
} else
|
||||
mm_gdbus_modem_set_current_modes (ctx->skeleton, g_variant_new ("(uu)", allowed, preferred));
|
||||
|
||||
/* Done */
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
set_current_modes_ready (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
SetCurrentModesContext *ctx)
|
||||
{
|
||||
MMModemState modem_state;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_current_modes_finish (self, res, &error)) {
|
||||
g_simple_async_result_take_error (ctx->result, error);
|
||||
else {
|
||||
mm_gdbus_modem_set_allowed_modes (ctx->skeleton, ctx->allowed);
|
||||
mm_gdbus_modem_set_preferred_mode (ctx->skeleton, ctx->preferred);
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
/* If modem is not enabled, avoid updating the current modes */
|
||||
modem_state = MM_MODEM_STATE_UNKNOWN;
|
||||
g_object_get (ctx->self,
|
||||
MM_IFACE_MODEM_STATE, &modem_state,
|
||||
NULL);
|
||||
if (modem_state >= MM_MODEM_STATE_ENABLING) {
|
||||
if (MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_current_modes &&
|
||||
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_current_modes_finish) {
|
||||
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_current_modes (
|
||||
ctx->self,
|
||||
(GAsyncReadyCallback)after_set_load_current_modes_ready,
|
||||
ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
mm_gdbus_modem_set_current_modes (ctx->skeleton,
|
||||
g_variant_new ("(uu)",
|
||||
ctx->allowed,
|
||||
ctx->preferred));
|
||||
}
|
||||
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
}
|
||||
|
||||
void
|
||||
mm_iface_modem_set_allowed_modes (MMIfaceModem *self,
|
||||
mm_iface_modem_set_current_modes (MMIfaceModem *self,
|
||||
MMModemMode allowed,
|
||||
MMModemMode preferred,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
GArray *supported;
|
||||
SetAllowedModesContext *ctx;
|
||||
MMModemMode current_allowed;
|
||||
MMModemMode current_preferred;
|
||||
SetCurrentModesContext *ctx;
|
||||
MMModemMode current_allowed = MM_MODEM_MODE_ANY;
|
||||
MMModemMode current_preferred = MM_MODEM_MODE_NONE;
|
||||
guint i;
|
||||
|
||||
/* If setting allowed modes is not implemented, report an error */
|
||||
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_allowed_modes ||
|
||||
!MM_IFACE_MODEM_GET_INTERFACE (self)->set_allowed_modes_finish) {
|
||||
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_current_modes ||
|
||||
!MM_IFACE_MODEM_GET_INTERFACE (self)->set_current_modes_finish) {
|
||||
g_simple_async_report_error_in_idle (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
@@ -2197,12 +2245,12 @@ mm_iface_modem_set_allowed_modes (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
/* Setup context */
|
||||
ctx = g_new0 (SetAllowedModesContext, 1);
|
||||
ctx = g_new0 (SetCurrentModesContext, 1);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->result = g_simple_async_result_new (G_OBJECT (self),
|
||||
callback,
|
||||
user_data,
|
||||
mm_iface_modem_set_allowed_modes);
|
||||
mm_iface_modem_set_current_modes);
|
||||
ctx->allowed = allowed;
|
||||
ctx->preferred = preferred;
|
||||
g_object_get (self,
|
||||
@@ -2213,7 +2261,7 @@ mm_iface_modem_set_allowed_modes (MMIfaceModem *self,
|
||||
MM_CORE_ERROR,
|
||||
MM_CORE_ERROR_FAILED,
|
||||
"Couldn't get interface skeleton");
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2228,7 +2276,7 @@ mm_iface_modem_set_allowed_modes (MMIfaceModem *self,
|
||||
MM_CORE_ERROR_UNSUPPORTED,
|
||||
"Cannot change modes: only one combination supported");
|
||||
g_array_unref (supported);
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2257,7 +2305,7 @@ mm_iface_modem_set_allowed_modes (MMIfaceModem *self,
|
||||
MM_CORE_ERROR_UNSUPPORTED,
|
||||
"The given combination of allowed and preferred modes is not supported");
|
||||
g_array_unref (supported);
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2265,12 +2313,14 @@ mm_iface_modem_set_allowed_modes (MMIfaceModem *self,
|
||||
g_array_unref (supported);
|
||||
|
||||
/* Check if we already are in the requested setup */
|
||||
current_allowed = mm_gdbus_modem_get_allowed_modes (ctx->skeleton);
|
||||
current_preferred = mm_gdbus_modem_get_preferred_mode (ctx->skeleton);
|
||||
g_variant_get (mm_gdbus_modem_get_current_modes (ctx->skeleton),
|
||||
"(uu)",
|
||||
¤t_allowed,
|
||||
¤t_preferred);
|
||||
if (current_allowed == allowed &&
|
||||
current_preferred == preferred) {
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2290,16 +2340,16 @@ mm_iface_modem_set_allowed_modes (MMIfaceModem *self,
|
||||
g_free (preferred_str);
|
||||
g_free (allowed_str);
|
||||
|
||||
set_allowed_modes_context_complete_and_free (ctx);
|
||||
set_current_modes_context_complete_and_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
ctx->allowed = allowed;
|
||||
ctx->preferred = preferred;
|
||||
MM_IFACE_MODEM_GET_INTERFACE (self)->set_allowed_modes (self,
|
||||
MM_IFACE_MODEM_GET_INTERFACE (self)->set_current_modes (self,
|
||||
allowed,
|
||||
preferred,
|
||||
(GAsyncReadyCallback)set_allowed_modes_ready,
|
||||
(GAsyncReadyCallback)set_current_modes_ready,
|
||||
ctx);
|
||||
}
|
||||
|
||||
@@ -2309,10 +2359,10 @@ typedef struct {
|
||||
MMIfaceModem *self;
|
||||
MMModemMode allowed;
|
||||
MMModemMode preferred;
|
||||
} HandleSetAllowedModesContext;
|
||||
} HandleSetCurrentModesContext;
|
||||
|
||||
static void
|
||||
handle_set_allowed_modes_context_free (HandleSetAllowedModesContext *ctx)
|
||||
handle_set_current_modes_context_free (HandleSetCurrentModesContext *ctx)
|
||||
{
|
||||
g_object_unref (ctx->skeleton);
|
||||
g_object_unref (ctx->invocation);
|
||||
@@ -2321,31 +2371,31 @@ handle_set_allowed_modes_context_free (HandleSetAllowedModesContext *ctx)
|
||||
}
|
||||
|
||||
static void
|
||||
handle_set_allowed_modes_ready (MMIfaceModem *self,
|
||||
handle_set_current_modes_ready (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
HandleSetAllowedModesContext *ctx)
|
||||
HandleSetCurrentModesContext *ctx)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_iface_modem_set_allowed_modes_finish (self, res, &error))
|
||||
if (!mm_iface_modem_set_current_modes_finish (self, res, &error))
|
||||
g_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
else
|
||||
mm_gdbus_modem_complete_set_allowed_modes (ctx->skeleton, ctx->invocation);
|
||||
mm_gdbus_modem_complete_set_current_modes (ctx->skeleton, ctx->invocation);
|
||||
|
||||
handle_set_allowed_modes_context_free (ctx);
|
||||
handle_set_current_modes_context_free (ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
handle_set_allowed_modes_auth_ready (MMBaseModem *self,
|
||||
handle_set_current_modes_auth_ready (MMBaseModem *self,
|
||||
GAsyncResult *res,
|
||||
HandleSetAllowedModesContext *ctx)
|
||||
HandleSetCurrentModesContext *ctx)
|
||||
{
|
||||
MMModemState modem_state;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!mm_base_modem_authorize_finish (self, res, &error)) {
|
||||
g_dbus_method_invocation_take_error (ctx->invocation, error);
|
||||
handle_set_allowed_modes_context_free (ctx);
|
||||
handle_set_current_modes_context_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2360,37 +2410,39 @@ handle_set_allowed_modes_auth_ready (MMBaseModem *self,
|
||||
MM_CORE_ERROR_WRONG_STATE,
|
||||
"Cannot set allowed modes: "
|
||||
"not initialized/unlocked yet");
|
||||
handle_set_allowed_modes_context_free (ctx);
|
||||
handle_set_current_modes_context_free (ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
mm_iface_modem_set_allowed_modes (MM_IFACE_MODEM (self),
|
||||
mm_iface_modem_set_current_modes (MM_IFACE_MODEM (self),
|
||||
ctx->allowed,
|
||||
ctx->preferred,
|
||||
(GAsyncReadyCallback)handle_set_allowed_modes_ready,
|
||||
(GAsyncReadyCallback)handle_set_current_modes_ready,
|
||||
ctx);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
handle_set_allowed_modes (MmGdbusModem *skeleton,
|
||||
handle_set_current_modes (MmGdbusModem *skeleton,
|
||||
GDBusMethodInvocation *invocation,
|
||||
guint allowed,
|
||||
guint preferred,
|
||||
GVariant *variant,
|
||||
MMIfaceModem *self)
|
||||
{
|
||||
HandleSetAllowedModesContext *ctx;
|
||||
HandleSetCurrentModesContext *ctx;
|
||||
|
||||
ctx = g_new (HandleSetAllowedModesContext, 1);
|
||||
ctx = g_new (HandleSetCurrentModesContext, 1);
|
||||
ctx->skeleton = g_object_ref (skeleton);
|
||||
ctx->invocation = g_object_ref (invocation);
|
||||
ctx->self = g_object_ref (self);
|
||||
ctx->allowed = allowed;
|
||||
ctx->preferred = preferred;
|
||||
|
||||
g_variant_get (variant,
|
||||
"(uu)",
|
||||
&ctx->allowed,
|
||||
&ctx->preferred);
|
||||
|
||||
mm_base_modem_authorize (MM_BASE_MODEM (self),
|
||||
invocation,
|
||||
MM_AUTHORIZATION_DEVICE_CONTROL,
|
||||
(GAsyncReadyCallback)handle_set_allowed_modes_auth_ready,
|
||||
(GAsyncReadyCallback)handle_set_current_modes_auth_ready,
|
||||
ctx);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -2982,7 +3034,7 @@ static void interface_disabling_step (DisablingContext *ctx);
|
||||
typedef enum {
|
||||
DISABLING_STEP_FIRST,
|
||||
DISABLING_STEP_CURRENT_BANDS,
|
||||
DISABLING_STEP_ALLOWED_MODES,
|
||||
DISABLING_STEP_CURRENT_MODES,
|
||||
DISABLING_STEP_LAST
|
||||
} DisablingStep;
|
||||
|
||||
@@ -3027,10 +3079,9 @@ interface_disabling_step (DisablingContext *ctx)
|
||||
/* Fall down to next step */
|
||||
ctx->step++;
|
||||
|
||||
case DISABLING_STEP_ALLOWED_MODES:
|
||||
case DISABLING_STEP_CURRENT_MODES:
|
||||
/* Clear allowed/preferred modes */
|
||||
mm_gdbus_modem_set_allowed_modes (ctx->skeleton, MM_MODEM_MODE_NONE);
|
||||
mm_gdbus_modem_set_preferred_mode (ctx->skeleton, MM_MODEM_MODE_NONE);
|
||||
mm_gdbus_modem_set_current_modes (ctx->skeleton, g_variant_new ("(uu)", MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE));
|
||||
/* Fall down to next step */
|
||||
ctx->step++;
|
||||
|
||||
@@ -3086,7 +3137,7 @@ typedef enum {
|
||||
ENABLING_STEP_FLOW_CONTROL,
|
||||
ENABLING_STEP_SUPPORTED_CHARSETS,
|
||||
ENABLING_STEP_CHARSET,
|
||||
ENABLING_STEP_ALLOWED_MODES,
|
||||
ENABLING_STEP_CURRENT_MODES,
|
||||
ENABLING_STEP_CURRENT_BANDS,
|
||||
ENABLING_STEP_LAST
|
||||
} EnablingStep;
|
||||
@@ -3213,7 +3264,7 @@ setup_charset_ready (MMIfaceModem *self,
|
||||
}
|
||||
|
||||
static void
|
||||
load_allowed_modes_ready (MMIfaceModem *self,
|
||||
load_current_modes_ready (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
EnablingContext *ctx)
|
||||
{
|
||||
@@ -3221,7 +3272,7 @@ load_allowed_modes_ready (MMIfaceModem *self,
|
||||
MMModemMode preferred = MM_MODEM_MODE_NONE;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->load_allowed_modes_finish (self,
|
||||
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->load_current_modes_finish (self,
|
||||
res,
|
||||
&allowed,
|
||||
&preferred,
|
||||
@@ -3231,12 +3282,9 @@ load_allowed_modes_ready (MMIfaceModem *self,
|
||||
g_error_free (error);
|
||||
|
||||
/* If errors getting allowed modes, assume ANY/NONE */
|
||||
allowed = MM_MODEM_MODE_ANY;
|
||||
preferred = MM_MODEM_MODE_NONE;
|
||||
}
|
||||
|
||||
mm_gdbus_modem_set_allowed_modes (ctx->skeleton, allowed);
|
||||
mm_gdbus_modem_set_preferred_mode (ctx->skeleton, preferred);
|
||||
mm_gdbus_modem_set_current_modes (ctx->skeleton, g_variant_new ("(uu)", MM_MODEM_MODE_ANY, MM_MODEM_MODE_NONE));
|
||||
} else
|
||||
mm_gdbus_modem_set_current_modes (ctx->skeleton, g_variant_new ("(uu)", allowed, preferred));
|
||||
|
||||
/* Done, Go on to next step */
|
||||
ctx->step++;
|
||||
@@ -3374,20 +3422,19 @@ interface_enabling_step (EnablingContext *ctx)
|
||||
/* Fall down to next step */
|
||||
ctx->step++;
|
||||
|
||||
case ENABLING_STEP_ALLOWED_MODES:
|
||||
if (MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_allowed_modes &&
|
||||
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_allowed_modes_finish) {
|
||||
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_allowed_modes (
|
||||
case ENABLING_STEP_CURRENT_MODES:
|
||||
if (MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_current_modes &&
|
||||
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_current_modes_finish) {
|
||||
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_current_modes (
|
||||
ctx->self,
|
||||
(GAsyncReadyCallback)load_allowed_modes_ready,
|
||||
(GAsyncReadyCallback)load_current_modes_ready,
|
||||
ctx);
|
||||
return;
|
||||
}
|
||||
|
||||
/* If no way to get allowed modes, assume allowed=any,
|
||||
* and none preferred */
|
||||
mm_gdbus_modem_set_allowed_modes (ctx->skeleton, MM_MODEM_MODE_ANY);
|
||||
mm_gdbus_modem_set_preferred_mode (ctx->skeleton, MM_MODEM_MODE_NONE);
|
||||
/* If no way to get modes, assume ANY/NONE */
|
||||
mm_gdbus_modem_set_current_modes (ctx->skeleton, g_variant_new ("(uu)", MM_MODEM_MODE_ANY, MM_MODEM_MODE_NONE));
|
||||
|
||||
/* Fall down to next step */
|
||||
ctx->step++;
|
||||
|
||||
@@ -4227,8 +4274,8 @@ interface_initialization_step (InitializationContext *ctx)
|
||||
G_CALLBACK (handle_set_current_bands),
|
||||
ctx->self);
|
||||
g_signal_connect (ctx->skeleton,
|
||||
"handle-set-allowed-modes",
|
||||
G_CALLBACK (handle_set_allowed_modes),
|
||||
"handle-set-current-modes",
|
||||
G_CALLBACK (handle_set_current_modes),
|
||||
ctx->self);
|
||||
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE);
|
||||
}
|
||||
@@ -4289,8 +4336,7 @@ mm_iface_modem_initialize (MMIfaceModem *self,
|
||||
mm_gdbus_modem_set_access_technologies (skeleton, MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN);
|
||||
mm_gdbus_modem_set_signal_quality (skeleton, g_variant_new ("(ub)", 0, FALSE));
|
||||
mm_gdbus_modem_set_supported_modes (skeleton, mm_common_build_mode_combinations_default ());
|
||||
mm_gdbus_modem_set_allowed_modes (skeleton, MM_MODEM_MODE_NONE);
|
||||
mm_gdbus_modem_set_preferred_mode (skeleton, MM_MODEM_MODE_NONE);
|
||||
mm_gdbus_modem_set_current_modes (skeleton,g_variant_new ("(uu)", MM_MODEM_MODE_NONE, MM_MODEM_MODE_NONE));
|
||||
mm_gdbus_modem_set_supported_bands (skeleton, mm_common_build_bands_unknown ());
|
||||
mm_gdbus_modem_set_current_bands (skeleton, mm_common_build_bands_unknown ());
|
||||
mm_gdbus_modem_set_supported_ip_families (skeleton, MM_BEARER_IP_FAMILY_NONE);
|
||||
|
@@ -130,11 +130,11 @@ struct _MMIfaceModem {
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
/* Loading of the AllowedModes and PreferredMode properties */
|
||||
void (*load_allowed_modes) (MMIfaceModem *self,
|
||||
/* Loading of the Modes property */
|
||||
void (*load_current_modes) (MMIfaceModem *self,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean (*load_allowed_modes_finish) (MMIfaceModem *self,
|
||||
gboolean (*load_current_modes_finish) (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
MMModemMode *allowed,
|
||||
MMModemMode *preferred,
|
||||
@@ -226,13 +226,13 @@ struct _MMIfaceModem {
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
/* Asynchronous allowed mode setting operation */
|
||||
void (*set_allowed_modes) (MMIfaceModem *self,
|
||||
/* Asynchronous current mode setting operation */
|
||||
void (*set_current_modes) (MMIfaceModem *self,
|
||||
MMModemMode modes,
|
||||
MMModemMode preferred,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean (*set_allowed_modes_finish) (MMIfaceModem *self,
|
||||
gboolean (*set_current_modes_finish) (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
@@ -417,12 +417,12 @@ void mm_iface_modem_update_signal_quality (MMIfaceModem *self,
|
||||
guint signal_quality);
|
||||
|
||||
/* Allow setting allowed modes */
|
||||
void mm_iface_modem_set_allowed_modes (MMIfaceModem *self,
|
||||
void mm_iface_modem_set_current_modes (MMIfaceModem *self,
|
||||
MMModemMode allowed,
|
||||
MMModemMode preferred,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean mm_iface_modem_set_allowed_modes_finish (MMIfaceModem *self,
|
||||
gboolean mm_iface_modem_set_current_modes_finish (MMIfaceModem *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
|
Reference in New Issue
Block a user