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:
Aleksander Morgado
2013-05-29 13:42:14 +02:00
parent 45ceba7692
commit 1c67d050cb
24 changed files with 482 additions and 447 deletions

View File

@@ -241,8 +241,10 @@ print_modem_info (void)
MMModemModeCombination *modes = NULL; MMModemModeCombination *modes = NULL;
guint n_modes = 0; guint n_modes = 0;
gchar *supported_modes_string; gchar *supported_modes_string;
gchar *allowed_modes_string; MMModemMode allowed_modes;
gchar *preferred_mode_string; gchar *allowed_modes_string = NULL;
MMModemMode preferred_mode;
gchar *preferred_mode_string = NULL;
gchar *supported_bands_string; gchar *supported_bands_string;
gchar *current_bands_string; gchar *current_bands_string;
gchar *supported_ip_families_string; gchar *supported_ip_families_string;
@@ -277,10 +279,10 @@ print_modem_info (void)
mm_modem_get_supported_bands (ctx->modem, &bands, &n_bands); mm_modem_get_supported_bands (ctx->modem, &bands, &n_bands);
supported_bands_string = mm_common_build_bands_string (bands, n_bands); supported_bands_string = mm_common_build_bands_string (bands, n_bands);
g_free (bands); g_free (bands);
allowed_modes_string = mm_modem_mode_build_string_from_mask ( if (mm_modem_get_current_modes (ctx->modem, &allowed_modes, &preferred_mode)) {
mm_modem_get_allowed_modes (ctx->modem)); allowed_modes_string = mm_modem_mode_build_string_from_mask (allowed_modes);
preferred_mode_string = mm_modem_mode_build_string_from_mask ( preferred_mode_string = mm_modem_mode_build_string_from_mask (preferred_mode);
mm_modem_get_preferred_mode (ctx->modem)); }
supported_ip_families_string = mm_bearer_ip_family_build_string_from_mask ( supported_ip_families_string = mm_bearer_ip_family_build_string_from_mask (
mm_modem_get_supported_ip_families (ctx->modem)); mm_modem_get_supported_ip_families (ctx->modem));
@@ -385,8 +387,7 @@ print_modem_info (void)
/* Modes */ /* Modes */
g_print (" -------------------------\n" g_print (" -------------------------\n"
" Modes | supported: '%s'\n" " Modes | supported: '%s'\n"
" | allowed: '%s'\n" " | current: 'allowed: %s; preferred: %s'\n",
" | preferred: '%s'\n",
VALIDATE_UNKNOWN (supported_modes_string), VALIDATE_UNKNOWN (supported_modes_string),
VALIDATE_UNKNOWN (allowed_modes_string), VALIDATE_UNKNOWN (allowed_modes_string),
VALIDATE_UNKNOWN (preferred_mode_string)); VALIDATE_UNKNOWN (preferred_mode_string));
@@ -763,28 +764,28 @@ delete_bearer_ready (MMModem *modem,
} }
static void static void
set_allowed_modes_process_reply (gboolean result, set_current_modes_process_reply (gboolean result,
const GError *error) const GError *error)
{ {
if (!result) { 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"); error ? error->message : "unknown error");
exit (EXIT_FAILURE); 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 static void
set_allowed_modes_ready (MMModem *modem, set_current_modes_ready (MMModem *modem,
GAsyncResult *result, GAsyncResult *result,
gpointer nothing) gpointer nothing)
{ {
gboolean operation_result; gboolean operation_result;
GError *error = NULL; GError *error = NULL;
operation_result = mm_modem_set_allowed_modes_finish (modem, result, &error); operation_result = mm_modem_set_current_modes_finish (modem, result, &error);
set_allowed_modes_process_reply (operation_result, error); set_current_modes_process_reply (operation_result, error);
mmcli_async_operation_done (); mmcli_async_operation_done ();
} }
@@ -1041,11 +1042,11 @@ get_modem_ready (GObject *source,
MMModemMode preferred; MMModemMode preferred;
parse_modes (&allowed, &preferred); parse_modes (&allowed, &preferred);
mm_modem_set_allowed_modes (ctx->modem, mm_modem_set_current_modes (ctx->modem,
allowed, allowed,
preferred, preferred,
ctx->cancellable, ctx->cancellable,
(GAsyncReadyCallback)set_allowed_modes_ready, (GAsyncReadyCallback)set_current_modes_ready,
NULL); NULL);
return; return;
} }
@@ -1254,13 +1255,13 @@ mmcli_modem_run_synchronous (GDBusConnection *connection)
gboolean result; gboolean result;
parse_modes (&allowed, &preferred); parse_modes (&allowed, &preferred);
result = mm_modem_set_allowed_modes_sync (ctx->modem, result = mm_modem_set_current_modes_sync (ctx->modem,
allowed, allowed,
preferred, preferred,
NULL, NULL,
&error); &error);
set_allowed_modes_process_reply (result, error); set_current_modes_process_reply (result, error);
return; return;
} }

View File

@@ -109,8 +109,7 @@ mm_modem_get_own_numbers
mm_modem_dup_own_numbers mm_modem_dup_own_numbers
mm_modem_peek_supported_modes mm_modem_peek_supported_modes
mm_modem_get_supported_modes mm_modem_get_supported_modes
mm_modem_get_allowed_modes mm_modem_get_current_modes
mm_modem_get_preferred_mode
mm_modem_peek_supported_bands mm_modem_peek_supported_bands
mm_modem_get_supported_bands mm_modem_get_supported_bands
mm_modem_peek_current_bands mm_modem_peek_current_bands
@@ -134,9 +133,9 @@ mm_modem_disable_sync
mm_modem_set_power_state mm_modem_set_power_state
mm_modem_set_power_state_finish mm_modem_set_power_state_finish
mm_modem_set_power_state_sync mm_modem_set_power_state_sync
mm_modem_set_allowed_modes mm_modem_set_current_modes
mm_modem_set_allowed_modes_finish mm_modem_set_current_modes_finish
mm_modem_set_allowed_modes_sync mm_modem_set_current_modes_sync
mm_modem_set_current_bands mm_modem_set_current_bands
mm_modem_set_current_bands_finish mm_modem_set_current_bands_finish
mm_modem_set_current_bands_sync 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_set_operator_id
mm_simple_connect_properties_get_current_bands mm_simple_connect_properties_get_current_bands
mm_simple_connect_properties_set_current_bands mm_simple_connect_properties_set_current_bands
mm_simple_connect_properties_get_allowed_modes mm_simple_connect_properties_get_current_modes
mm_simple_connect_properties_set_allowed_modes mm_simple_connect_properties_set_current_modes
mm_simple_connect_properties_get_apn mm_simple_connect_properties_get_apn
mm_simple_connect_properties_set_apn mm_simple_connect_properties_set_apn
mm_simple_connect_properties_get_allowed_auth mm_simple_connect_properties_get_allowed_auth
@@ -1418,7 +1417,8 @@ MmGdbusModem
MmGdbusModemIface MmGdbusModemIface
<SUBSECTION Getters> <SUBSECTION Getters>
mm_gdbus_modem_get_access_technologies 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_get_current_bands
mm_gdbus_modem_dup_current_bands mm_gdbus_modem_dup_current_bands
mm_gdbus_modem_get_current_capabilities 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_power_state
mm_gdbus_modem_get_primary_port mm_gdbus_modem_get_primary_port
mm_gdbus_modem_dup_primary_port mm_gdbus_modem_dup_primary_port
mm_gdbus_modem_get_preferred_mode
mm_gdbus_modem_get_revision mm_gdbus_modem_get_revision
mm_gdbus_modem_dup_revision mm_gdbus_modem_dup_revision
mm_gdbus_modem_get_signal_quality 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
mm_gdbus_modem_call_factory_reset_finish mm_gdbus_modem_call_factory_reset_finish
mm_gdbus_modem_call_factory_reset_sync mm_gdbus_modem_call_factory_reset_sync
mm_gdbus_modem_call_set_allowed_modes mm_gdbus_modem_call_set_current_modes
mm_gdbus_modem_call_set_allowed_modes_finish mm_gdbus_modem_call_set_current_modes_finish
mm_gdbus_modem_call_set_allowed_modes_sync mm_gdbus_modem_call_set_current_modes_sync
mm_gdbus_modem_call_set_current_bands mm_gdbus_modem_call_set_current_bands
mm_gdbus_modem_call_set_current_bands_finish mm_gdbus_modem_call_set_current_bands_finish
mm_gdbus_modem_call_set_current_bands_sync mm_gdbus_modem_call_set_current_bands_sync
@@ -1494,7 +1493,7 @@ mm_gdbus_modem_call_command_finish
mm_gdbus_modem_call_command_sync mm_gdbus_modem_call_command_sync
<SUBSECTION Private> <SUBSECTION Private>
mm_gdbus_modem_set_access_technologies 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_bands
mm_gdbus_modem_set_current_capabilities mm_gdbus_modem_set_current_capabilities
mm_gdbus_modem_set_device 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_own_numbers
mm_gdbus_modem_set_plugin mm_gdbus_modem_set_plugin
mm_gdbus_modem_set_primary_port mm_gdbus_modem_set_primary_port
mm_gdbus_modem_set_preferred_mode
mm_gdbus_modem_set_revision mm_gdbus_modem_set_revision
mm_gdbus_modem_set_signal_quality mm_gdbus_modem_set_signal_quality
mm_gdbus_modem_set_sim 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_factory_reset
mm_gdbus_modem_complete_list_bearers mm_gdbus_modem_complete_list_bearers
mm_gdbus_modem_complete_reset 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_complete_set_current_bands
mm_gdbus_modem_interface_info mm_gdbus_modem_interface_info
mm_gdbus_modem_override_properties mm_gdbus_modem_override_properties

View File

@@ -137,16 +137,17 @@
</method> </method>
<!-- <!--
SetAllowedModes: SetCurrentModes:
@modes: Bitmask of <link linkend="MMModemMode">MMModemMode</link> values, to specify all the modes allowed in the modem. @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.
@preferred: Specific <link linkend="MMModemMode">MMModemMode</link> preferred among the ones allowed, 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. 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"> <method name="SetCurrentModes">
<arg name="modes" type="u" direction="in" /> <arg name="modes" type="(uu)" direction="in" />
<arg name="preferred" type="u" direction="in" />
</method> </method>
<!-- <!--
@@ -431,31 +432,17 @@
<property name="SupportedModes" type="a(uu)" access="read" /> <property name="SupportedModes" type="a(uu)" access="read" />
<!-- <!--
AllowedModes: CurrentModes:
Bitmask of <link linkend="MMModemMode">MMModemMode</link> values, A pair of <link linkend="MMModemMode">MMModemMode</link> values, where the first one
specifying the access technologies (eg 2G/3G/4G preference) the device is a bitmask specifying the access technologies (eg 2G/3G/4G) the device
is currently allowed to use when connecting to a network. 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. The pair must be one of those specified in
#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.
--> -->
<property name="AllowedModes" type="u" access="read" /> <property name="CurrentModes" type="(uu)" 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" />
<!-- <!--
SupportedBands: SupportedBands:

View File

@@ -1034,41 +1034,39 @@ mm_modem_peek_supported_modes (MMModem *self,
/*****************************************************************************/ /*****************************************************************************/
/** /**
* mm_modem_get_allowed_modes: * mm_modem_get_current_modes:
* @self: A #MMModem. * @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) * 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. * 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: %TRUE if @allowed and @preferred are set, %FALSE otherwise.
*
* Returns: A bitmask of #MMModemMode values.
*/ */
MMModemMode gboolean
mm_modem_get_allowed_modes (MMModem *self) 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;
} }
/*****************************************************************************/ return FALSE;
/**
* 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));
} }
/*****************************************************************************/ /*****************************************************************************/
@@ -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. * @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. * @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. * Returns: %TRUE if the allowed modes were successfully set, %FALSE if @error is set.
*/ */
gboolean gboolean
mm_modem_set_allowed_modes_finish (MMModem *self, mm_modem_set_current_modes_finish (MMModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
g_return_val_if_fail (MM_IS_MODEM (self), FALSE); 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. * @self: A #MMModem.
* @modes: Mask of #MMModemMode values specifying which modes are allowed. * @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. * @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. * 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. * 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 void
mm_modem_set_allowed_modes (MMModem *self, mm_modem_set_current_modes (MMModem *self,
MMModemMode modes, MMModemMode modes,
MMModemMode preferred, MMModemMode preferred,
GCancellable *cancellable, GCancellable *cancellable,
@@ -2364,11 +2362,15 @@ mm_modem_set_allowed_modes (MMModem *self,
{ {
g_return_if_fail (MM_IS_MODEM (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. * @self: A #MMModem.
* @modes: Mask of #MMModemMode values specifying which modes are allowed. * @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. * @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 * Synchronously sets the access technologies (e.g. 2G/3G/4G preference) the device is
* currently allowed to use when connecting to a network. * 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. * for the asynchronous version of this method.
* *
* Returns: %TRUE if the allowed modes were successfully set, %FALSE if @error is set. * Returns: %TRUE if the allowed modes were successfully set, %FALSE if @error is set.
*/ */
gboolean gboolean
mm_modem_set_allowed_modes_sync (MMModem *self, mm_modem_set_current_modes_sync (MMModem *self,
MMModemMode modes, MMModemMode modes,
MMModemMode preferred, MMModemMode preferred,
GCancellable *cancellable, GCancellable *cancellable,
@@ -2392,7 +2394,10 @@ mm_modem_set_allowed_modes_sync (MMModem *self,
{ {
g_return_val_if_fail (MM_IS_MODEM (self), FALSE); 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);
} }
/*****************************************************************************/ /*****************************************************************************/

View File

@@ -135,9 +135,9 @@ gboolean mm_modem_get_supported_modes (MMModem *self,
MMModemModeCombination **modes, MMModemModeCombination **modes,
guint *n_modes); guint *n_modes);
MMModemMode mm_modem_get_allowed_modes (MMModem *self); gboolean mm_modem_get_current_modes (MMModem *self,
MMModemMode *allowed,
MMModemMode mm_modem_get_preferred_mode (MMModem *self); MMModemMode *preferred);
gboolean mm_modem_peek_supported_bands (MMModem *self, gboolean mm_modem_peek_supported_bands (MMModem *self,
const MMModemBand **bands, const MMModemBand **bands,
@@ -266,16 +266,16 @@ gboolean mm_modem_set_power_state_sync (MMModem *self,
GCancellable *cancellable, GCancellable *cancellable,
GError **error); GError **error);
void mm_modem_set_allowed_modes (MMModem *self, void mm_modem_set_current_modes (MMModem *self,
MMModemMode modes, MMModemMode modes,
MMModemMode preferred, MMModemMode preferred,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
gboolean mm_modem_set_allowed_modes_finish (MMModem *self, gboolean mm_modem_set_current_modes_finish (MMModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error); GError **error);
gboolean mm_modem_set_allowed_modes_sync (MMModem *self, gboolean mm_modem_set_current_modes_sync (MMModem *self,
MMModemMode modes, MMModemMode modes,
MMModemMode preferred, MMModemMode preferred,
GCancellable *cancellable, GCancellable *cancellable,

View File

@@ -49,7 +49,7 @@ struct _MMSimpleConnectPropertiesPrivate {
MMModemBand *current_bands; MMModemBand *current_bands;
guint n_current_bands; guint n_current_bands;
/* Modes */ /* Modes */
gboolean allowed_modes_set; gboolean current_modes_set;
MMModemMode allowed_modes; MMModemMode allowed_modes;
MMModemMode preferred_mode; MMModemMode preferred_mode;
/* Bearer properties */ /* 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. * @self: a #MMSimpleConnectProperties.
* @allowed: bitmask of #MMModemMode values specifying which are allowed. * @allowed: bitmask of #MMModemMode values specifying which are allowed.
* @preferred: a #MMModemMode value, specifying which of the ones in @allowed is preferred, if any. * @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. * Sets the modes allowed to use, and which of them is preferred.
*/ */
void void
mm_simple_connect_properties_set_allowed_modes (MMSimpleConnectProperties *self, mm_simple_connect_properties_set_current_modes (MMSimpleConnectProperties *self,
MMModemMode allowed, MMModemMode allowed,
MMModemMode preferred) MMModemMode preferred)
{ {
@@ -199,11 +199,11 @@ mm_simple_connect_properties_set_allowed_modes (MMSimpleConnectProperties *self,
self->priv->allowed_modes = allowed; self->priv->allowed_modes = allowed;
self->priv->preferred_mode = preferred; 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. * @self: a #MMSimpleConnectProperties.
* @allowed: (out): location for the bitmask of #MMModemMode values specifying which are allowed. * @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. * @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. * Returns: %TRUE if @allowed and @preferred are set, %FALSE otherwise.
*/ */
gboolean gboolean
mm_simple_connect_properties_get_allowed_modes (MMSimpleConnectProperties *self, mm_simple_connect_properties_get_current_modes (MMSimpleConnectProperties *self,
MMModemMode *allowed, MMModemMode *allowed,
MMModemMode *preferred) 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 (allowed != NULL, FALSE);
g_return_val_if_fail (preferred != 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; *allowed = self->priv->allowed_modes;
*preferred = self->priv->preferred_mode; *preferred = self->priv->preferred_mode;
return TRUE; return TRUE;
@@ -524,7 +524,7 @@ mm_simple_connect_properties_get_dictionary (MMSimpleConnectProperties *self)
mm_common_bands_array_to_variant (self->priv->current_bands, mm_common_bands_array_to_variant (self->priv->current_bands,
self->priv->n_current_bands)); self->priv->n_current_bands));
if (self->priv->allowed_modes_set) { if (self->priv->current_modes_set) {
g_variant_builder_add (&builder, g_variant_builder_add (&builder,
"{sv}", "{sv}",
PROPERTY_ALLOWED_MODES, PROPERTY_ALLOWED_MODES,
@@ -639,7 +639,7 @@ mm_simple_connect_properties_new_from_string (const gchar *str,
g_object_unref (ctx.self); g_object_unref (ctx.self);
ctx.self = NULL; ctx.self = NULL;
} else { } else {
mm_simple_connect_properties_set_allowed_modes ( mm_simple_connect_properties_set_current_modes (
ctx.self, ctx.self,
allowed_modes, allowed_modes,
preferred_mode); 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 */ /* If we got allowed modes variant, check if we got preferred mode */
else if (allowed_modes_variant) { else if (allowed_modes_variant) {
mm_simple_connect_properties_set_allowed_modes ( mm_simple_connect_properties_set_current_modes (
self, self,
g_variant_get_uint32 (allowed_modes_variant), g_variant_get_uint32 (allowed_modes_variant),
(preferred_mode_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 */ /* If we only got preferred mode, assume allowed is ANY */
else if (preferred_mode_variant) { else if (preferred_mode_variant) {
mm_simple_connect_properties_set_allowed_modes ( mm_simple_connect_properties_set_current_modes (
self, self,
MM_MODEM_MODE_ANY, MM_MODEM_MODE_ANY,
g_variant_get_uint32 (preferred_mode_variant)); g_variant_get_uint32 (preferred_mode_variant));

View File

@@ -66,7 +66,7 @@ void mm_simple_connect_properties_set_operator_id (MMSimpleConnectProperties *
void mm_simple_connect_properties_set_current_bands (MMSimpleConnectProperties *self, void mm_simple_connect_properties_set_current_bands (MMSimpleConnectProperties *self,
const MMModemBand *bands, const MMModemBand *bands,
guint n_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 allowed,
MMModemMode preferred); MMModemMode preferred);
void mm_simple_connect_properties_set_apn (MMSimpleConnectProperties *self, 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, gboolean mm_simple_connect_properties_get_current_bands (MMSimpleConnectProperties *self,
const MMModemBand **bands, const MMModemBand **bands,
guint *n_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 *allowed,
MMModemMode *preferred); MMModemMode *preferred);
const gchar *mm_simple_connect_properties_get_apn (MMSimpleConnectProperties *self); const gchar *mm_simple_connect_properties_get_apn (MMSimpleConnectProperties *self);

View File

@@ -590,10 +590,10 @@ load_supported_modes (MMIfaceModem *self,
} }
/*****************************************************************************/ /*****************************************************************************/
/* ALLOWED MODES */ /* Set current modes (Modem interface) */
static gboolean static gboolean
set_allowed_modes_finish (MMIfaceModem *self, set_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -618,7 +618,7 @@ allowed_access_technology_update_ready (MMBroadbandModemCinterion *self,
} }
static void static void
set_allowed_modes (MMIfaceModem *self, set_current_modes (MMIfaceModem *self,
MMModemMode allowed, MMModemMode allowed,
MMModemMode preferred, MMModemMode preferred,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
@@ -629,7 +629,7 @@ set_allowed_modes (MMIfaceModem *self,
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
set_allowed_modes); set_current_modes);
/* For dual 2G/3G devices... */ /* For dual 2G/3G devices... */
if (mm_iface_modem_is_2g (self) && 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. * which is based on the quality of the connection.
*/ */
cmd = g_string_new ("+COPS=,,,"); cmd = g_string_new ("+COPS=,,,");
if (allowed == MM_MODEM_MODE_3G && if (allowed == MM_MODEM_MODE_3G) {
preferred == MM_MODEM_MODE_NONE) {
g_string_append (cmd, "2"); g_string_append (cmd, "2");
} else if (allowed == MM_MODEM_MODE_2G && } else if (allowed == MM_MODEM_MODE_2G) {
preferred == MM_MODEM_MODE_NONE) {
g_string_append (cmd, "0"); g_string_append (cmd, "0");
} else { } else {
gchar *allowed_str; gchar *allowed_str;
@@ -1271,8 +1269,8 @@ iface_modem_init (MMIfaceModem *iface)
iface->load_supported_modes = load_supported_modes; iface->load_supported_modes = load_supported_modes;
iface->load_supported_modes_finish = load_supported_modes_finish; iface->load_supported_modes_finish = load_supported_modes_finish;
iface->set_allowed_modes = set_allowed_modes; iface->set_current_modes = set_current_modes;
iface->set_allowed_modes_finish = set_allowed_modes_finish; iface->set_current_modes_finish = set_current_modes_finish;
iface->load_supported_bands = load_supported_bands; iface->load_supported_bands = load_supported_bands;
iface->load_supported_bands_finish = load_supported_bands_finish; iface->load_supported_bands_finish = load_supported_bands_finish;
iface->load_current_bands = load_current_bands; iface->load_current_bands = load_current_bands;

View File

@@ -1187,7 +1187,7 @@ parse_prefmode (const gchar *response, MMModemMode *preferred, GError **error)
} }
static gboolean static gboolean
load_allowed_modes_finish (MMIfaceModem *self, load_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
MMModemMode *allowed, MMModemMode *allowed,
MMModemMode *preferred, MMModemMode *preferred,
@@ -1208,7 +1208,7 @@ load_allowed_modes_finish (MMIfaceModem *self,
} }
static void static void
load_allowed_modes (MMIfaceModem *self, load_current_modes (MMIfaceModem *self,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
@@ -1226,7 +1226,7 @@ load_allowed_modes (MMIfaceModem *self,
} }
/*****************************************************************************/ /*****************************************************************************/
/* Set allowed modes (Modem interface) */ /* Set current modes (Modem interface) */
static gboolean static gboolean
allowed_mode_to_prefmode (MMModemMode allowed, guint *huawei_mode, GError **error) 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 static gboolean
set_allowed_modes_finish (MMIfaceModem *self, set_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -1281,7 +1281,7 @@ allowed_mode_update_ready (MMBroadbandModemHuawei *self,
} }
static void static void
set_allowed_modes (MMIfaceModem *self, set_current_modes (MMIfaceModem *self,
MMModemMode allowed, MMModemMode allowed,
MMModemMode preferred, MMModemMode preferred,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
@@ -1296,7 +1296,7 @@ set_allowed_modes (MMIfaceModem *self,
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
set_allowed_modes); set_current_modes);
if (mm_iface_modem_is_cdma_only (self)) { if (mm_iface_modem_is_cdma_only (self)) {
if (allowed_mode_to_prefmode (allowed, &mode, &error)) 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->set_current_bands_finish = set_current_bands_finish;
iface->load_supported_modes = load_supported_modes; iface->load_supported_modes = load_supported_modes;
iface->load_supported_modes_finish = load_supported_modes_finish; iface->load_supported_modes_finish = load_supported_modes_finish;
iface->load_allowed_modes = load_allowed_modes; iface->load_current_modes = load_current_modes;
iface->load_allowed_modes_finish = load_allowed_modes_finish; iface->load_current_modes_finish = load_current_modes_finish;
iface->set_allowed_modes = set_allowed_modes; iface->set_current_modes = set_current_modes;
iface->set_allowed_modes_finish = set_allowed_modes_finish; iface->set_current_modes_finish = set_current_modes_finish;
iface->load_signal_quality = modem_load_signal_quality; iface->load_signal_quality = modem_load_signal_quality;
iface->load_signal_quality_finish = modem_load_signal_quality_finish; iface->load_signal_quality_finish = modem_load_signal_quality_finish;
iface->create_bearer = huawei_modem_create_bearer; iface->create_bearer = huawei_modem_create_bearer;

View File

@@ -153,7 +153,7 @@ load_supported_modes (MMIfaceModem *self,
/* Load initial allowed/preferred modes (Modem interface) */ /* Load initial allowed/preferred modes (Modem interface) */
static gboolean static gboolean
modem_load_allowed_modes_finish (MMIfaceModem *self, modem_load_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
MMModemMode *allowed, MMModemMode *allowed,
MMModemMode *preferred, MMModemMode *preferred,
@@ -212,7 +212,7 @@ modem_load_allowed_modes_finish (MMIfaceModem *self,
} }
static void static void
modem_load_allowed_modes (MMIfaceModem *self, modem_load_current_modes (MMIfaceModem *self,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
@@ -228,7 +228,7 @@ modem_load_allowed_modes (MMIfaceModem *self,
/* Set allowed modes (Modem interface) */ /* Set allowed modes (Modem interface) */
static gboolean static gboolean
modem_set_allowed_modes_finish (MMIfaceModem *self, modem_set_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -253,7 +253,7 @@ allowed_mode_update_ready (MMBaseModem *self,
} }
static void static void
modem_set_allowed_modes (MMIfaceModem *self, modem_set_current_modes (MMIfaceModem *self,
MMModemMode allowed, MMModemMode allowed,
MMModemMode preferred, MMModemMode preferred,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
@@ -266,7 +266,7 @@ modem_set_allowed_modes (MMIfaceModem *self,
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
modem_set_allowed_modes); modem_set_current_modes);
/* /*
* The core has checked the following: * 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 = load_supported_modes;
iface->load_supported_modes_finish = load_supported_modes_finish; iface->load_supported_modes_finish = load_supported_modes_finish;
iface->load_allowed_modes = modem_load_allowed_modes; iface->load_current_modes = modem_load_current_modes;
iface->load_allowed_modes_finish = modem_load_allowed_modes_finish; iface->load_current_modes_finish = modem_load_current_modes_finish;
iface->set_allowed_modes = modem_set_allowed_modes; iface->set_current_modes = modem_set_current_modes;
iface->set_allowed_modes_finish = modem_set_allowed_modes_finish; iface->set_current_modes_finish = modem_set_current_modes_finish;
iface->load_access_technologies = modem_load_access_technologies; iface->load_access_technologies = modem_load_access_technologies;
iface->load_access_technologies_finish = modem_load_access_technologies_finish; iface->load_access_technologies_finish = modem_load_access_technologies_finish;
iface->load_unlock_retries = modem_load_unlock_retries; iface->load_unlock_retries = modem_load_unlock_retries;

View File

@@ -123,7 +123,7 @@ load_supported_modes (MMIfaceModem *self,
/* Load initial allowed/preferred modes (Modem interface) */ /* Load initial allowed/preferred modes (Modem interface) */
static gboolean static gboolean
load_allowed_modes_finish (MMIfaceModem *self, load_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
MMModemMode *allowed, MMModemMode *allowed,
MMModemMode *preferred, MMModemMode *preferred,
@@ -173,7 +173,7 @@ load_allowed_modes_finish (MMIfaceModem *self,
} }
static void static void
load_allowed_modes (MMIfaceModem *self, load_current_modes (MMIfaceModem *self,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
@@ -189,7 +189,7 @@ load_allowed_modes (MMIfaceModem *self,
/* Set allowed modes (Modem interface) */ /* Set allowed modes (Modem interface) */
static gboolean static gboolean
set_allowed_modes_finish (MMIfaceModem *self, set_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -214,7 +214,7 @@ allowed_mode_update_ready (MMBroadbandModemLinktop *self,
} }
static void static void
set_allowed_modes (MMIfaceModem *self, set_current_modes (MMIfaceModem *self,
MMModemMode allowed, MMModemMode allowed,
MMModemMode preferred, MMModemMode preferred,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
@@ -227,7 +227,7 @@ set_allowed_modes (MMIfaceModem *self,
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
set_allowed_modes); set_current_modes);
if (allowed == MM_MODEM_MODE_2G) if (allowed == MM_MODEM_MODE_2G)
linktop_mode = LINKTOP_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 = load_supported_modes;
iface->load_supported_modes_finish = load_supported_modes_finish; iface->load_supported_modes_finish = load_supported_modes_finish;
iface->load_allowed_modes = load_allowed_modes; iface->load_current_modes = load_current_modes;
iface->load_allowed_modes_finish = load_allowed_modes_finish; iface->load_current_modes_finish = load_current_modes_finish;
iface->set_allowed_modes = set_allowed_modes; iface->set_current_modes = set_current_modes;
iface->set_allowed_modes_finish = set_allowed_modes_finish; iface->set_current_modes_finish = set_current_modes_finish;
} }
static void static void

View File

@@ -120,7 +120,7 @@ load_supported_modes (MMIfaceModem *self,
/* Load initial allowed/preferred modes (Modem interface) */ /* Load initial allowed/preferred modes (Modem interface) */
static gboolean static gboolean
load_allowed_modes_finish (MMIfaceModem *self, load_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
MMModemMode *allowed, MMModemMode *allowed,
MMModemMode *preferred, MMModemMode *preferred,
@@ -179,7 +179,7 @@ load_allowed_modes_finish (MMIfaceModem *self,
} }
static void static void
load_allowed_modes (MMIfaceModem *self, load_current_modes (MMIfaceModem *self,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
@@ -195,7 +195,7 @@ load_allowed_modes (MMIfaceModem *self,
/* Set allowed modes (Modem interface) */ /* Set allowed modes (Modem interface) */
static gboolean static gboolean
set_allowed_modes_finish (MMIfaceModem *self, set_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -220,7 +220,7 @@ allowed_mode_update_ready (MMBroadbandModemLongcheer *self,
} }
static void static void
set_allowed_modes (MMIfaceModem *self, set_current_modes (MMIfaceModem *self,
MMModemMode allowed, MMModemMode allowed,
MMModemMode preferred, MMModemMode preferred,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
@@ -233,7 +233,7 @@ set_allowed_modes (MMIfaceModem *self,
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
set_allowed_modes); set_current_modes);
if (allowed == MM_MODEM_MODE_2G) if (allowed == MM_MODEM_MODE_2G)
mododr = 3; mododr = 3;
@@ -424,10 +424,10 @@ iface_modem_init (MMIfaceModem *iface)
iface->load_access_technologies_finish = load_access_technologies_finish; iface->load_access_technologies_finish = load_access_technologies_finish;
iface->load_supported_modes = load_supported_modes; iface->load_supported_modes = load_supported_modes;
iface->load_supported_modes_finish = load_supported_modes_finish; iface->load_supported_modes_finish = load_supported_modes_finish;
iface->load_allowed_modes = load_allowed_modes; iface->load_current_modes = load_current_modes;
iface->load_allowed_modes_finish = load_allowed_modes_finish; iface->load_current_modes_finish = load_current_modes_finish;
iface->set_allowed_modes = set_allowed_modes; iface->set_current_modes = set_current_modes;
iface->set_allowed_modes_finish = set_allowed_modes_finish; iface->set_current_modes_finish = set_current_modes_finish;
iface->load_unlock_retries = load_unlock_retries; iface->load_unlock_retries = load_unlock_retries;
iface->load_unlock_retries_finish = load_unlock_retries_finish; iface->load_unlock_retries_finish = load_unlock_retries_finish;
} }

View File

@@ -269,7 +269,7 @@ load_supported_modes (MMIfaceModem *self,
/* Load initial allowed/preferred modes (Modem interface) */ /* Load initial allowed/preferred modes (Modem interface) */
static gboolean static gboolean
load_allowed_modes_finish (MMIfaceModem *_self, load_current_modes_finish (MMIfaceModem *_self,
GAsyncResult *res, GAsyncResult *res,
MMModemMode *allowed, MMModemMode *allowed,
MMModemMode *preferred, MMModemMode *preferred,
@@ -319,7 +319,7 @@ load_allowed_modes_finish (MMIfaceModem *_self,
} }
static void static void
load_allowed_modes (MMIfaceModem *self, load_current_modes (MMIfaceModem *self,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
@@ -338,19 +338,19 @@ typedef struct {
MMBroadbandModemMbm *self; MMBroadbandModemMbm *self;
GSimpleAsyncResult *result; GSimpleAsyncResult *result;
gint mbm_mode; gint mbm_mode;
} SetAllowedModesContext; } SetCurrentModesContext;
static void 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_simple_async_result_complete_in_idle (ctx->result);
g_object_unref (ctx->result); g_object_unref (ctx->result);
g_object_unref (ctx->self); g_object_unref (ctx->self);
g_slice_free (SetAllowedModesContext, ctx); g_slice_free (SetCurrentModesContext, ctx);
} }
static gboolean static gboolean
set_allowed_modes_finish (MMIfaceModem *self, set_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -360,7 +360,7 @@ set_allowed_modes_finish (MMIfaceModem *self,
static void static void
allowed_mode_update_ready (MMBaseModem *self, allowed_mode_update_ready (MMBaseModem *self,
GAsyncResult *res, GAsyncResult *res,
SetAllowedModesContext *ctx) SetCurrentModesContext *ctx)
{ {
GError *error = NULL; GError *error = NULL;
@@ -373,25 +373,25 @@ allowed_mode_update_ready (MMBaseModem *self,
ctx->self->priv->mbm_mode = ctx->mbm_mode; ctx->self->priv->mbm_mode = ctx->mbm_mode;
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); 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 static void
set_allowed_modes (MMIfaceModem *self, set_current_modes (MMIfaceModem *self,
MMModemMode allowed, MMModemMode allowed,
MMModemMode preferred, MMModemMode preferred,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
SetAllowedModesContext *ctx; SetCurrentModesContext *ctx;
gchar *command; gchar *command;
ctx = g_slice_new (SetAllowedModesContext); ctx = g_slice_new (SetCurrentModesContext);
ctx->self = g_object_ref (self); ctx->self = g_object_ref (self);
ctx->result = g_simple_async_result_new (G_OBJECT (self), ctx->result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
set_allowed_modes); set_current_modes);
ctx->mbm_mode = -1; ctx->mbm_mode = -1;
if (allowed == MM_MODEM_MODE_2G) if (allowed == MM_MODEM_MODE_2G)
@@ -419,7 +419,7 @@ set_allowed_modes (MMIfaceModem *self,
g_free (allowed_str); g_free (allowed_str);
g_free (preferred_str); g_free (preferred_str);
set_allowed_modes_context_complete_and_free (ctx); set_current_modes_context_complete_and_free (ctx);
return; return;
} }
@@ -1322,10 +1322,10 @@ iface_modem_init (MMIfaceModem *iface)
iface->modem_after_sim_unlock_finish = modem_after_sim_unlock_finish; iface->modem_after_sim_unlock_finish = modem_after_sim_unlock_finish;
iface->load_supported_modes = load_supported_modes; iface->load_supported_modes = load_supported_modes;
iface->load_supported_modes_finish = load_supported_modes_finish; iface->load_supported_modes_finish = load_supported_modes_finish;
iface->load_allowed_modes = load_allowed_modes; iface->load_current_modes = load_current_modes;
iface->load_allowed_modes_finish = load_allowed_modes_finish; iface->load_current_modes_finish = load_current_modes_finish;
iface->set_allowed_modes = set_allowed_modes; iface->set_current_modes = set_current_modes;
iface->set_allowed_modes_finish = set_allowed_modes_finish; iface->set_current_modes_finish = set_current_modes_finish;
iface->reset = reset; iface->reset = reset;
iface->reset_finish = reset_finish; iface->reset_finish = reset_finish;
iface->factory_reset = factory_reset; iface->factory_reset = factory_reset;

View File

@@ -138,16 +138,16 @@ load_supported_modes (MMIfaceModem *self,
typedef struct { typedef struct {
MMModemMode allowed; MMModemMode allowed;
MMModemMode preferred; MMModemMode preferred;
} LoadAllowedModesResult; } LoadCurrentModesResult;
static gboolean static gboolean
load_allowed_modes_finish (MMIfaceModem *self, load_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
MMModemMode *allowed, MMModemMode *allowed,
MMModemMode *preferred, MMModemMode *preferred,
GError **error) GError **error)
{ {
LoadAllowedModesResult *result; LoadCurrentModesResult *result;
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error)) if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
return FALSE; return FALSE;
@@ -164,7 +164,7 @@ nwrat_query_ready (MMBaseModem *self,
GAsyncResult *res, GAsyncResult *res,
GSimpleAsyncResult *simple) GSimpleAsyncResult *simple)
{ {
LoadAllowedModesResult result; LoadCurrentModesResult result;
GError *error = NULL; GError *error = NULL;
const gchar *response; const gchar *response;
GRegex *r; GRegex *r;
@@ -255,7 +255,7 @@ nwrat_query_ready (MMBaseModem *self,
} }
static void static void
load_allowed_modes (MMIfaceModem *self, load_current_modes (MMIfaceModem *self,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
@@ -264,7 +264,7 @@ load_allowed_modes (MMIfaceModem *self,
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
load_allowed_modes); load_current_modes);
/* Load allowed modes only in 3GPP modems */ /* Load allowed modes only in 3GPP modems */
if (!mm_iface_modem_is_3gpp (self)) { if (!mm_iface_modem_is_3gpp (self)) {
@@ -290,7 +290,7 @@ load_allowed_modes (MMIfaceModem *self,
/* Set allowed modes (Modem interface) */ /* Set allowed modes (Modem interface) */
static gboolean static gboolean
set_allowed_modes_finish (MMIfaceModem *self, set_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -315,7 +315,7 @@ allowed_mode_update_ready (MMBroadbandModemNovatel *self,
} }
static void static void
set_allowed_modes (MMIfaceModem *self, set_current_modes (MMIfaceModem *self,
MMModemMode allowed, MMModemMode allowed,
MMModemMode preferred, MMModemMode preferred,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
@@ -329,7 +329,7 @@ set_allowed_modes (MMIfaceModem *self,
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
set_allowed_modes); set_current_modes);
/* Setting allowed modes only in 3GPP modems */ /* Setting allowed modes only in 3GPP modems */
if (!mm_iface_modem_is_3gpp (self)) { 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 = load_supported_modes;
iface->load_supported_modes_finish = load_supported_modes_finish; iface->load_supported_modes_finish = load_supported_modes_finish;
iface->load_allowed_modes = load_allowed_modes; iface->load_current_modes = load_current_modes;
iface->load_allowed_modes_finish = load_allowed_modes_finish; iface->load_current_modes_finish = load_current_modes_finish;
iface->set_allowed_modes = set_allowed_modes; iface->set_current_modes = set_current_modes;
iface->set_allowed_modes_finish = set_allowed_modes_finish; iface->set_current_modes_finish = set_current_modes_finish;
iface->load_access_technologies_finish = modem_load_access_technologies_finish; iface->load_access_technologies_finish = modem_load_access_technologies_finish;
iface->load_access_technologies = modem_load_access_technologies; iface->load_access_technologies = modem_load_access_technologies;
iface->load_signal_quality = modem_load_signal_quality; iface->load_signal_quality = modem_load_signal_quality;

View File

@@ -143,7 +143,7 @@ load_supported_modes (MMIfaceModem *self,
/* Load initial allowed/preferred modes (Modem interface) */ /* Load initial allowed/preferred modes (Modem interface) */
static gboolean static gboolean
load_allowed_modes_finish (MMIfaceModem *self, load_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
MMModemMode *allowed, MMModemMode *allowed,
MMModemMode *preferred, MMModemMode *preferred,
@@ -202,7 +202,7 @@ load_allowed_modes_finish (MMIfaceModem *self,
} }
static void static void
load_allowed_modes (MMIfaceModem *self, load_current_modes (MMIfaceModem *self,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
@@ -218,7 +218,7 @@ load_allowed_modes (MMIfaceModem *self,
/* Set allowed modes (Modem interface) */ /* Set allowed modes (Modem interface) */
static gboolean static gboolean
set_allowed_modes_finish (MMIfaceModem *self, set_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -243,7 +243,7 @@ allowed_mode_update_ready (MMBroadbandModemOption *self,
} }
static void static void
set_allowed_modes (MMIfaceModem *self, set_current_modes (MMIfaceModem *self,
MMModemMode allowed, MMModemMode allowed,
MMModemMode preferred, MMModemMode preferred,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
@@ -256,7 +256,7 @@ set_allowed_modes (MMIfaceModem *self,
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
set_allowed_modes); set_current_modes);
if (allowed == MM_MODEM_MODE_2G) if (allowed == MM_MODEM_MODE_2G)
option_mode = 0; option_mode = 0;
@@ -1232,10 +1232,10 @@ iface_modem_init (MMIfaceModem *iface)
iface->load_access_technologies_finish = load_access_technologies_finish; iface->load_access_technologies_finish = load_access_technologies_finish;
iface->load_supported_modes = load_supported_modes; iface->load_supported_modes = load_supported_modes;
iface->load_supported_modes_finish = load_supported_modes_finish; iface->load_supported_modes_finish = load_supported_modes_finish;
iface->load_allowed_modes = load_allowed_modes; iface->load_current_modes = load_current_modes;
iface->load_allowed_modes_finish = load_allowed_modes_finish; iface->load_current_modes_finish = load_current_modes_finish;
iface->set_allowed_modes = set_allowed_modes; iface->set_current_modes = set_current_modes;
iface->set_allowed_modes_finish = set_allowed_modes_finish; iface->set_current_modes_finish = set_current_modes_finish;
} }
static void static void

View File

@@ -622,16 +622,16 @@ load_supported_modes (MMIfaceModem *self,
typedef struct { typedef struct {
MMModemMode allowed; MMModemMode allowed;
MMModemMode preferred; MMModemMode preferred;
} LoadAllowedModesResult; } LoadCurrentModesResult;
static gboolean static gboolean
load_allowed_modes_finish (MMIfaceModem *self, load_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
MMModemMode *allowed, MMModemMode *allowed,
MMModemMode *preferred, MMModemMode *preferred,
GError **error) GError **error)
{ {
LoadAllowedModesResult *result; LoadCurrentModesResult *result;
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error)) if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
return FALSE; return FALSE;
@@ -648,7 +648,7 @@ selrat_query_ready (MMBaseModem *self,
GAsyncResult *res, GAsyncResult *res,
GSimpleAsyncResult *simple) GSimpleAsyncResult *simple)
{ {
LoadAllowedModesResult result; LoadCurrentModesResult result;
const gchar *response; const gchar *response;
GError *error = NULL; GError *error = NULL;
GRegex *r = NULL; GRegex *r = NULL;
@@ -746,7 +746,7 @@ selrat_query_ready (MMBaseModem *self,
} }
static void static void
load_allowed_modes (MMIfaceModem *self, load_current_modes (MMIfaceModem *self,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
@@ -756,7 +756,7 @@ load_allowed_modes (MMIfaceModem *self,
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
load_allowed_modes); load_current_modes);
if (!mm_iface_modem_is_3gpp (self)) { if (!mm_iface_modem_is_3gpp (self)) {
/* Cannot do this in CDMA modems */ /* 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 static gboolean
set_allowed_modes_finish (MMIfaceModem *self, set_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -821,7 +821,7 @@ selrat_set_ready (MMBaseModem *self,
} }
static void static void
set_allowed_modes (MMIfaceModem *self, set_current_modes (MMIfaceModem *self,
MMModemMode allowed, MMModemMode allowed,
MMModemMode preferred, MMModemMode preferred,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
@@ -835,7 +835,7 @@ set_allowed_modes (MMIfaceModem *self,
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
load_allowed_modes); set_current_modes);
if (!mm_iface_modem_is_3gpp (self)) { if (!mm_iface_modem_is_3gpp (self)) {
/* Cannot do this in CDMA modems */ /* 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 = load_supported_modes;
iface->load_supported_modes_finish = load_supported_modes_finish; iface->load_supported_modes_finish = load_supported_modes_finish;
iface->load_allowed_modes = load_allowed_modes; iface->load_current_modes = load_current_modes;
iface->load_allowed_modes_finish = load_allowed_modes_finish; iface->load_current_modes_finish = load_current_modes_finish;
iface->set_allowed_modes = set_allowed_modes; iface->set_current_modes = set_current_modes;
iface->set_allowed_modes_finish = set_allowed_modes_finish; iface->set_current_modes_finish = set_current_modes_finish;
iface->load_access_technologies = load_access_technologies; iface->load_access_technologies = load_access_technologies;
iface->load_access_technologies_finish = load_access_technologies_finish; iface->load_access_technologies_finish = load_access_technologies_finish;
iface->load_own_numbers = modem_load_own_numbers; iface->load_own_numbers = modem_load_own_numbers;

View File

@@ -532,17 +532,17 @@ load_supported_modes (MMIfaceModem *self,
typedef struct { typedef struct {
MMModemMode allowed; MMModemMode allowed;
MMModemMode preferred; MMModemMode preferred;
} LoadAllowedModesResult; } LoadCurrentModesResult;
typedef struct { typedef struct {
MMBroadbandModemSimtech *self; MMBroadbandModemSimtech *self;
GSimpleAsyncResult *result; GSimpleAsyncResult *result;
gint acqord; gint acqord;
gint modepref; gint modepref;
} LoadAllowedModesContext; } LoadCurrentModesContext;
static void 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_simple_async_result_complete (ctx->result);
g_object_unref (ctx->result); g_object_unref (ctx->result);
@@ -551,13 +551,13 @@ load_allowed_modes_context_complete_and_free (LoadAllowedModesContext *ctx)
} }
static gboolean static gboolean
load_allowed_modes_finish (MMIfaceModem *self, load_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
MMModemMode *allowed, MMModemMode *allowed,
MMModemMode *preferred, MMModemMode *preferred,
GError **error) GError **error)
{ {
LoadAllowedModesResult *result; LoadCurrentModesResult *result;
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error)) if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
return FALSE; return FALSE;
@@ -571,9 +571,9 @@ load_allowed_modes_finish (MMIfaceModem *self,
static void static void
cnmp_query_ready (MMBroadbandModemSimtech *self, cnmp_query_ready (MMBroadbandModemSimtech *self,
GAsyncResult *res, GAsyncResult *res,
LoadAllowedModesContext *ctx) LoadCurrentModesContext *ctx)
{ {
LoadAllowedModesResult *result; LoadCurrentModesResult *result;
const gchar *response, *p; const gchar *response, *p;
GError *error = NULL; GError *error = NULL;
@@ -581,7 +581,7 @@ cnmp_query_ready (MMBroadbandModemSimtech *self,
if (!response) { if (!response) {
/* Let the error be critical. */ /* Let the error be critical. */
g_simple_async_result_take_error (ctx->result, error); 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; return;
} }
@@ -593,11 +593,11 @@ cnmp_query_ready (MMBroadbandModemSimtech *self,
MM_CORE_ERROR_FAILED, MM_CORE_ERROR_FAILED,
"Failed to parse the mode preference response: '%s'", "Failed to parse the mode preference response: '%s'",
response); response);
load_allowed_modes_context_complete_and_free (ctx); load_current_modes_context_complete_and_free (ctx);
return; return;
} }
result = g_new (LoadAllowedModesResult, 1); result = g_new (LoadCurrentModesResult, 1);
result->allowed = MM_MODEM_MODE_NONE; result->allowed = MM_MODEM_MODE_NONE;
result->preferred = MM_MODEM_MODE_NONE; result->preferred = MM_MODEM_MODE_NONE;
@@ -625,7 +625,7 @@ cnmp_query_ready (MMBroadbandModemSimtech *self,
MM_CORE_ERROR_FAILED, MM_CORE_ERROR_FAILED,
"Unknown acquisition order preference: '%d'", "Unknown acquisition order preference: '%d'",
ctx->acqord); ctx->acqord);
load_allowed_modes_context_complete_and_free (ctx); load_current_modes_context_complete_and_free (ctx);
return; return;
} }
break; break;
@@ -649,7 +649,7 @@ cnmp_query_ready (MMBroadbandModemSimtech *self,
MM_CORE_ERROR_FAILED, MM_CORE_ERROR_FAILED,
"Unknown mode preference: '%d'", "Unknown mode preference: '%d'",
ctx->modepref); ctx->modepref);
load_allowed_modes_context_complete_and_free (ctx); load_current_modes_context_complete_and_free (ctx);
return; return;
} }
@@ -657,13 +657,13 @@ cnmp_query_ready (MMBroadbandModemSimtech *self,
g_simple_async_result_set_op_res_gpointer (ctx->result, g_simple_async_result_set_op_res_gpointer (ctx->result,
result, result,
g_free); g_free);
load_allowed_modes_context_complete_and_free (ctx); load_current_modes_context_complete_and_free (ctx);
} }
static void static void
cnaop_query_ready (MMBroadbandModemSimtech *self, cnaop_query_ready (MMBroadbandModemSimtech *self,
GAsyncResult *res, GAsyncResult *res,
LoadAllowedModesContext *ctx) LoadCurrentModesContext *ctx)
{ {
const gchar *response, *p; const gchar *response, *p;
GError *error = NULL; GError *error = NULL;
@@ -672,7 +672,7 @@ cnaop_query_ready (MMBroadbandModemSimtech *self,
if (!response) { if (!response) {
/* Let the error be critical. */ /* Let the error be critical. */
g_simple_async_result_take_error (ctx->result, error); 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; return;
} }
@@ -687,7 +687,7 @@ cnaop_query_ready (MMBroadbandModemSimtech *self,
MM_CORE_ERROR_FAILED, MM_CORE_ERROR_FAILED,
"Failed to parse the acquisition order response: '%s'", "Failed to parse the acquisition order response: '%s'",
response); response);
load_allowed_modes_context_complete_and_free (ctx); load_current_modes_context_complete_and_free (ctx);
return; return;
} }
@@ -701,18 +701,18 @@ cnaop_query_ready (MMBroadbandModemSimtech *self,
} }
static void static void
load_allowed_modes (MMIfaceModem *self, load_current_modes (MMIfaceModem *self,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
LoadAllowedModesContext *ctx; LoadCurrentModesContext *ctx;
ctx = g_new (LoadAllowedModesContext, 1); ctx = g_new (LoadCurrentModesContext, 1);
ctx->self = g_object_ref (self); ctx->self = g_object_ref (self);
ctx->result = g_simple_async_result_new (G_OBJECT (self), ctx->result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
load_allowed_modes); load_current_modes);
ctx->acqord = -1; ctx->acqord = -1;
ctx->modepref = -1; ctx->modepref = -1;
@@ -733,10 +733,10 @@ typedef struct {
GSimpleAsyncResult *result; GSimpleAsyncResult *result;
guint nmp; /* mode preference */ guint nmp; /* mode preference */
guint naop; /* acquisition order */ guint naop; /* acquisition order */
} SetAllowedModesContext; } SetCurrentModesContext;
static void 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_simple_async_result_complete_in_idle (ctx->result);
g_object_unref (ctx->result); g_object_unref (ctx->result);
@@ -745,7 +745,7 @@ set_allowed_modes_context_complete_and_free (SetAllowedModesContext *ctx)
} }
static gboolean static gboolean
set_allowed_modes_finish (MMIfaceModem *self, set_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -755,7 +755,7 @@ set_allowed_modes_finish (MMIfaceModem *self,
static void static void
cnaop_set_ready (MMBaseModem *self, cnaop_set_ready (MMBaseModem *self,
GAsyncResult *res, GAsyncResult *res,
SetAllowedModesContext *ctx) SetCurrentModesContext *ctx)
{ {
GError *error = NULL; GError *error = NULL;
@@ -766,13 +766,13 @@ cnaop_set_ready (MMBaseModem *self,
else else
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); 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 static void
cnmp_set_ready (MMBaseModem *self, cnmp_set_ready (MMBaseModem *self,
GAsyncResult *res, GAsyncResult *res,
SetAllowedModesContext *ctx) SetCurrentModesContext *ctx)
{ {
GError *error = NULL; GError *error = NULL;
gchar *command; gchar *command;
@@ -781,7 +781,7 @@ cnmp_set_ready (MMBaseModem *self,
if (error) { if (error) {
/* Let the error be critical. */ /* Let the error be critical. */
g_simple_async_result_take_error (ctx->result, error); 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; return;
} }
@@ -797,21 +797,21 @@ cnmp_set_ready (MMBaseModem *self,
} }
static void static void
set_allowed_modes (MMIfaceModem *self, set_current_modes (MMIfaceModem *self,
MMModemMode allowed, MMModemMode allowed,
MMModemMode preferred, MMModemMode preferred,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
SetAllowedModesContext *ctx; SetCurrentModesContext *ctx;
gchar *command; gchar *command;
ctx = g_new (SetAllowedModesContext, 1); ctx = g_new (SetCurrentModesContext, 1);
ctx->self = g_object_ref (self); ctx->self = g_object_ref (self);
ctx->result = g_simple_async_result_new (G_OBJECT (self), ctx->result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
set_allowed_modes); set_current_modes);
/* Defaults: automatic search */ /* Defaults: automatic search */
ctx->nmp = 2; ctx->nmp = 2;
@@ -851,7 +851,7 @@ set_allowed_modes (MMIfaceModem *self,
g_free (allowed_str); g_free (allowed_str);
g_free (preferred_str); g_free (preferred_str);
set_allowed_modes_context_complete_and_free (ctx); set_current_modes_context_complete_and_free (ctx);
return; return;
} }
@@ -927,10 +927,10 @@ iface_modem_init (MMIfaceModem *iface)
iface->load_access_technologies_finish = load_access_technologies_finish; iface->load_access_technologies_finish = load_access_technologies_finish;
iface->load_supported_modes = load_supported_modes; iface->load_supported_modes = load_supported_modes;
iface->load_supported_modes_finish = load_supported_modes_finish; iface->load_supported_modes_finish = load_supported_modes_finish;
iface->load_allowed_modes = load_allowed_modes; iface->load_current_modes = load_current_modes;
iface->load_allowed_modes_finish = load_allowed_modes_finish; iface->load_current_modes_finish = load_current_modes_finish;
iface->set_allowed_modes = set_allowed_modes; iface->set_current_modes = set_current_modes;
iface->set_allowed_modes_finish = set_allowed_modes_finish; iface->set_current_modes_finish = set_current_modes_finish;
} }
static void static void

View File

@@ -212,16 +212,16 @@ load_supported_modes (MMIfaceModem *self,
typedef struct { typedef struct {
MMModemMode allowed; MMModemMode allowed;
MMModemMode preferred; MMModemMode preferred;
} LoadAllowedModesResult; } LoadCurrentModesResult;
static gboolean static gboolean
load_allowed_modes_finish (MMIfaceModem *self, load_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
MMModemMode *allowed, MMModemMode *allowed,
MMModemMode *preferred, MMModemMode *preferred,
GError **error) GError **error)
{ {
LoadAllowedModesResult *result; LoadCurrentModesResult *result;
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error)) if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
return FALSE; return FALSE;
@@ -240,7 +240,7 @@ wwsm_read_ready (MMBaseModem *self,
{ {
GRegex *r; GRegex *r;
GMatchInfo *match_info = NULL; GMatchInfo *match_info = NULL;
LoadAllowedModesResult result; LoadCurrentModesResult result;
const gchar *response; const gchar *response;
GError *error = NULL; GError *error = NULL;
@@ -330,7 +330,7 @@ current_ms_class_ready (MMBaseModem *self,
GAsyncResult *res, GAsyncResult *res,
GSimpleAsyncResult *simple) GSimpleAsyncResult *simple)
{ {
LoadAllowedModesResult result; LoadCurrentModesResult result;
const gchar *response; const gchar *response;
GError *error = NULL; GError *error = NULL;
@@ -394,7 +394,7 @@ current_ms_class_ready (MMBaseModem *self,
} }
static void static void
load_allowed_modes (MMIfaceModem *self, load_current_modes (MMIfaceModem *self,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
@@ -403,7 +403,7 @@ load_allowed_modes (MMIfaceModem *self,
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
load_allowed_modes); load_current_modes);
mm_base_modem_at_command (MM_BASE_MODEM (self), mm_base_modem_at_command (MM_BASE_MODEM (self),
"+CGCLASS?", "+CGCLASS?",
@@ -421,10 +421,10 @@ typedef struct {
GSimpleAsyncResult *result; GSimpleAsyncResult *result;
gchar *cgclass_command; gchar *cgclass_command;
gchar *wwsm_command; gchar *wwsm_command;
} SetAllowedModesContext; } SetCurrentModesContext;
static void 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_simple_async_result_complete_in_idle (ctx->result);
g_object_unref (ctx->result); g_object_unref (ctx->result);
@@ -435,7 +435,7 @@ set_allowed_modes_context_complete_and_free (SetAllowedModesContext *ctx)
} }
static gboolean static gboolean
set_allowed_modes_finish (MMIfaceModem *self, set_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -445,7 +445,7 @@ set_allowed_modes_finish (MMIfaceModem *self,
static void static void
wwsm_update_ready (MMBaseModem *self, wwsm_update_ready (MMBaseModem *self,
GAsyncResult *res, GAsyncResult *res,
SetAllowedModesContext *ctx) SetCurrentModesContext *ctx)
{ {
GError *error = NULL; GError *error = NULL;
@@ -456,13 +456,13 @@ wwsm_update_ready (MMBaseModem *self,
else else
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); 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 static void
cgclass_update_ready (MMBaseModem *self, cgclass_update_ready (MMBaseModem *self,
GAsyncResult *res, GAsyncResult *res,
SetAllowedModesContext *ctx) SetCurrentModesContext *ctx)
{ {
GError *error = NULL; GError *error = NULL;
@@ -470,13 +470,13 @@ cgclass_update_ready (MMBaseModem *self,
if (error) { if (error) {
/* Let the error be critical. */ /* Let the error be critical. */
g_simple_async_result_take_error (ctx->result, error); 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; return;
} }
if (!ctx->wwsm_command) { if (!ctx->wwsm_command) {
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); 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; return;
} }
@@ -489,20 +489,20 @@ cgclass_update_ready (MMBaseModem *self,
} }
static void static void
set_allowed_modes (MMIfaceModem *self, set_current_modes (MMIfaceModem *self,
MMModemMode allowed, MMModemMode allowed,
MMModemMode preferred, MMModemMode preferred,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
SetAllowedModesContext *ctx; SetCurrentModesContext *ctx;
ctx = g_new0 (SetAllowedModesContext, 1); ctx = g_new0 (SetCurrentModesContext, 1);
ctx->self = g_object_ref (self); ctx->self = g_object_ref (self);
ctx->result = g_simple_async_result_new (G_OBJECT (self), ctx->result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
set_allowed_modes); set_current_modes);
/* Handle ANY/NONE */ /* Handle ANY/NONE */
if (allowed == MM_MODEM_MODE_ANY && preferred == MM_MODEM_MODE_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 (allowed_str);
g_free (preferred_str); g_free (preferred_str);
set_allowed_modes_context_complete_and_free (ctx); set_current_modes_context_complete_and_free (ctx);
return; return;
} }
@@ -1186,10 +1186,10 @@ iface_modem_init (MMIfaceModem *iface)
iface->load_supported_modes = load_supported_modes; iface->load_supported_modes = load_supported_modes;
iface->load_supported_modes_finish = load_supported_modes_finish; iface->load_supported_modes_finish = load_supported_modes_finish;
iface->load_allowed_modes = load_allowed_modes; iface->load_current_modes = load_current_modes;
iface->load_allowed_modes_finish = load_allowed_modes_finish; iface->load_current_modes_finish = load_current_modes_finish;
iface->set_allowed_modes = set_allowed_modes; iface->set_current_modes = set_current_modes;
iface->set_allowed_modes_finish = set_allowed_modes_finish; iface->set_current_modes_finish = set_current_modes_finish;
iface->load_supported_bands = load_supported_bands; iface->load_supported_bands = load_supported_bands;
iface->load_supported_bands_finish = load_supported_bands_finish; iface->load_supported_bands_finish = load_supported_bands_finish;
iface->load_current_bands = load_current_bands; iface->load_current_bands = load_current_bands;

View File

@@ -115,7 +115,7 @@ load_supported_modes (MMIfaceModem *self,
/* Load initial allowed/preferred modes (Modem interface) */ /* Load initial allowed/preferred modes (Modem interface) */
static gboolean static gboolean
load_allowed_modes_finish (MMIfaceModem *self, load_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
MMModemMode *allowed, MMModemMode *allowed,
MMModemMode *preferred, MMModemMode *preferred,
@@ -180,7 +180,7 @@ load_allowed_modes_finish (MMIfaceModem *self,
} }
static void static void
load_allowed_modes (MMIfaceModem *self, load_current_modes (MMIfaceModem *self,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
@@ -196,7 +196,7 @@ load_allowed_modes (MMIfaceModem *self,
/* Set allowed modes (Modem interface) */ /* Set allowed modes (Modem interface) */
static gboolean static gboolean
set_allowed_modes_finish (MMIfaceModem *self, set_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -221,7 +221,7 @@ allowed_mode_update_ready (MMBroadbandModemX22x *self,
} }
static void static void
set_allowed_modes (MMIfaceModem *self, set_current_modes (MMIfaceModem *self,
MMModemMode allowed, MMModemMode allowed,
MMModemMode preferred, MMModemMode preferred,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
@@ -234,7 +234,7 @@ set_allowed_modes (MMIfaceModem *self,
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
set_allowed_modes); set_current_modes);
if (allowed == MM_MODEM_MODE_2G) if (allowed == MM_MODEM_MODE_2G)
syssel = 1; syssel = 1;
@@ -346,10 +346,10 @@ iface_modem_init (MMIfaceModem *iface)
iface->load_access_technologies_finish = load_access_technologies_finish; iface->load_access_technologies_finish = load_access_technologies_finish;
iface->load_supported_modes = load_supported_modes; iface->load_supported_modes = load_supported_modes;
iface->load_supported_modes_finish = load_supported_modes_finish; iface->load_supported_modes_finish = load_supported_modes_finish;
iface->load_allowed_modes = load_allowed_modes; iface->load_current_modes = load_current_modes;
iface->load_allowed_modes_finish = load_allowed_modes_finish; iface->load_current_modes_finish = load_current_modes_finish;
iface->set_allowed_modes = set_allowed_modes; iface->set_current_modes = set_current_modes;
iface->set_allowed_modes_finish = set_allowed_modes_finish; iface->set_current_modes_finish = set_current_modes_finish;
} }
static void static void

View File

@@ -347,7 +347,7 @@ load_supported_modes (MMIfaceModem *self,
/* Load initial allowed/preferred modes (Modem interface) */ /* Load initial allowed/preferred modes (Modem interface) */
static gboolean static gboolean
load_allowed_modes_finish (MMIfaceModem *self, load_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
MMModemMode *allowed, MMModemMode *allowed,
MMModemMode *preferred, MMModemMode *preferred,
@@ -434,7 +434,7 @@ done:
} }
static void static void
load_allowed_modes (MMIfaceModem *self, load_current_modes (MMIfaceModem *self,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
@@ -450,7 +450,7 @@ load_allowed_modes (MMIfaceModem *self,
/* Set allowed modes (Modem interface) */ /* Set allowed modes (Modem interface) */
static gboolean static gboolean
set_allowed_modes_finish (MMIfaceModem *self, set_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -476,7 +476,7 @@ allowed_mode_update_ready (MMBroadbandModemZte *self,
} }
static void static void
set_allowed_modes (MMIfaceModem *self, set_current_modes (MMIfaceModem *self,
MMModemMode allowed, MMModemMode allowed,
MMModemMode preferred, MMModemMode preferred,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
@@ -490,7 +490,7 @@ set_allowed_modes (MMIfaceModem *self,
result = g_simple_async_result_new (G_OBJECT (self), result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
set_allowed_modes); set_current_modes);
if (allowed == MM_MODEM_MODE_2G) { if (allowed == MM_MODEM_MODE_2G) {
cm_mode = 1; cm_mode = 1;
@@ -780,10 +780,10 @@ iface_modem_init (MMIfaceModem *iface)
iface->load_access_technologies_finish = load_access_technologies_finish; iface->load_access_technologies_finish = load_access_technologies_finish;
iface->load_supported_modes = load_supported_modes; iface->load_supported_modes = load_supported_modes;
iface->load_supported_modes_finish = load_supported_modes_finish; iface->load_supported_modes_finish = load_supported_modes_finish;
iface->load_allowed_modes = load_allowed_modes; iface->load_current_modes = load_current_modes;
iface->load_allowed_modes_finish = load_allowed_modes_finish; iface->load_current_modes_finish = load_current_modes_finish;
iface->set_allowed_modes = set_allowed_modes; iface->set_current_modes = set_current_modes;
iface->set_allowed_modes_finish = set_allowed_modes_finish; iface->set_current_modes_finish = set_current_modes_finish;
iface->load_unlock_retries = load_unlock_retries; iface->load_unlock_retries = load_unlock_retries;
iface->load_unlock_retries_finish = load_unlock_retries_finish; iface->load_unlock_retries_finish = load_unlock_retries_finish;
} }

View File

@@ -2468,7 +2468,7 @@ modem_factory_reset (MMIfaceModem *self,
} }
/*****************************************************************************/ /*****************************************************************************/
/* Load allowed modes (Modem interface) */ /* Load current modes (Modem interface) */
typedef struct { typedef struct {
MMBroadbandModemQmi *self; MMBroadbandModemQmi *self;
@@ -2476,15 +2476,15 @@ typedef struct {
GSimpleAsyncResult *result; GSimpleAsyncResult *result;
gboolean run_get_system_selection_preference; gboolean run_get_system_selection_preference;
gboolean run_get_technology_preference; gboolean run_get_technology_preference;
} LoadAllowedModesContext; } LoadCurrentModesContext;
typedef struct { typedef struct {
MMModemMode allowed; MMModemMode allowed;
MMModemMode preferred; MMModemMode preferred;
} LoadAllowedModesResult; } LoadCurrentModesResult;
static void 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_simple_async_result_complete_in_idle (ctx->result);
g_object_unref (ctx->result); g_object_unref (ctx->result);
@@ -2494,13 +2494,13 @@ load_allowed_modes_context_complete_and_free (LoadAllowedModesContext *ctx)
} }
static gboolean static gboolean
load_allowed_modes_finish (MMIfaceModem *self, load_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
MMModemMode *allowed, MMModemMode *allowed,
MMModemMode *preferred, MMModemMode *preferred,
GError **error) GError **error)
{ {
LoadAllowedModesResult *result; LoadCurrentModesResult *result;
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error)) if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error))
return FALSE; return FALSE;
@@ -2511,14 +2511,14 @@ load_allowed_modes_finish (MMIfaceModem *self,
return TRUE; return TRUE;
} }
static void load_allowed_modes_context_step (LoadAllowedModesContext *ctx); static void load_current_modes_context_step (LoadCurrentModesContext *ctx);
static void static void
get_technology_preference_ready (QmiClientNas *client, get_technology_preference_ready (QmiClientNas *client,
GAsyncResult *res, GAsyncResult *res,
LoadAllowedModesContext *ctx) LoadCurrentModesContext *ctx)
{ {
LoadAllowedModesResult *result = NULL; LoadCurrentModesResult *result = NULL;
QmiMessageNasGetTechnologyPreferenceOutput *output = NULL; QmiMessageNasGetTechnologyPreferenceOutput *output = NULL;
GError *error = NULL; GError *error = NULL;
@@ -2547,7 +2547,7 @@ get_technology_preference_ready (QmiClientNas *client,
g_free (str); g_free (str);
} else { } else {
/* We got a valid value from here */ /* We got a valid value from here */
result = g_new (LoadAllowedModesResult, 1); result = g_new (LoadCurrentModesResult, 1);
result->allowed = allowed; result->allowed = allowed;
result->preferred = MM_MODEM_MODE_NONE; result->preferred = MM_MODEM_MODE_NONE;
} }
@@ -2558,7 +2558,7 @@ get_technology_preference_ready (QmiClientNas *client,
if (!result) { if (!result) {
ctx->run_get_technology_preference = FALSE; ctx->run_get_technology_preference = FALSE;
load_allowed_modes_context_step (ctx); load_current_modes_context_step (ctx);
return; return;
} }
@@ -2566,15 +2566,15 @@ get_technology_preference_ready (QmiClientNas *client,
ctx->result, ctx->result,
result, result,
(GDestroyNotify)g_free); (GDestroyNotify)g_free);
load_allowed_modes_context_complete_and_free (ctx); load_current_modes_context_complete_and_free (ctx);
} }
static void static void
allowed_modes_get_system_selection_preference_ready (QmiClientNas *client, current_modes_get_system_selection_preference_ready (QmiClientNas *client,
GAsyncResult *res, GAsyncResult *res,
LoadAllowedModesContext *ctx) LoadCurrentModesContext *ctx)
{ {
LoadAllowedModesResult *result = NULL; LoadCurrentModesResult *result = NULL;
QmiMessageNasGetSystemSelectionPreferenceOutput *output = NULL; QmiMessageNasGetSystemSelectionPreferenceOutput *output = NULL;
GError *error = NULL; GError *error = NULL;
QmiNasRatModePreference mode_preference_mask = 0; QmiNasRatModePreference mode_preference_mask = 0;
@@ -2605,7 +2605,7 @@ allowed_modes_get_system_selection_preference_ready (QmiClientNas *client,
QmiNasGsmWcdmaAcquisitionOrderPreference gsm_or_wcdma; QmiNasGsmWcdmaAcquisitionOrderPreference gsm_or_wcdma;
/* We got a valid value from here */ /* We got a valid value from here */
result = g_new (LoadAllowedModesResult, 1); result = g_new (LoadCurrentModesResult, 1);
result->allowed = allowed; result->allowed = allowed;
result->preferred = MM_MODEM_MODE_NONE; result->preferred = MM_MODEM_MODE_NONE;
@@ -2626,7 +2626,7 @@ allowed_modes_get_system_selection_preference_ready (QmiClientNas *client,
if (!result) { if (!result) {
/* Try with the deprecated command */ /* Try with the deprecated command */
ctx->run_get_system_selection_preference = FALSE; ctx->run_get_system_selection_preference = FALSE;
load_allowed_modes_context_step (ctx); load_current_modes_context_step (ctx);
return; return;
} }
@@ -2634,11 +2634,11 @@ allowed_modes_get_system_selection_preference_ready (QmiClientNas *client,
ctx->result, ctx->result,
result, result,
(GDestroyNotify)g_free); (GDestroyNotify)g_free);
load_allowed_modes_context_complete_and_free (ctx); load_current_modes_context_complete_and_free (ctx);
} }
static void static void
load_allowed_modes_context_step (LoadAllowedModesContext *ctx) load_current_modes_context_step (LoadCurrentModesContext *ctx)
{ {
if (ctx->run_get_system_selection_preference) { if (ctx->run_get_system_selection_preference) {
qmi_client_nas_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 */ NULL, /* no input */
5, 5,
NULL, /* cancellable */ NULL, /* cancellable */
(GAsyncReadyCallback)allowed_modes_get_system_selection_preference_ready, (GAsyncReadyCallback)current_modes_get_system_selection_preference_ready,
ctx); ctx);
return; return;
} }
@@ -2666,16 +2666,16 @@ load_allowed_modes_context_step (LoadAllowedModesContext *ctx)
ctx->result, ctx->result,
MM_CORE_ERROR, MM_CORE_ERROR,
MM_CORE_ERROR_UNSUPPORTED, MM_CORE_ERROR_UNSUPPORTED,
"Loading allowed modes is not supported by this device"); "Loading current modes is not supported by this device");
load_allowed_modes_context_complete_and_free (ctx); load_current_modes_context_complete_and_free (ctx);
} }
static void static void
load_allowed_modes (MMIfaceModem *self, load_current_modes (MMIfaceModem *self,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
LoadAllowedModesContext *ctx; LoadCurrentModesContext *ctx;
QmiClient *client = NULL; QmiClient *client = NULL;
if (!ensure_qmi_client (MM_BROADBAND_MODEM_QMI (self), if (!ensure_qmi_client (MM_BROADBAND_MODEM_QMI (self),
@@ -2683,13 +2683,13 @@ load_allowed_modes (MMIfaceModem *self,
callback, user_data)) callback, user_data))
return; return;
ctx = g_new0 (LoadAllowedModesContext, 1); ctx = g_new0 (LoadCurrentModesContext, 1);
ctx->self = g_object_ref (self); ctx->self = g_object_ref (self);
ctx->client = g_object_ref (client); ctx->client = g_object_ref (client);
ctx->result = g_simple_async_result_new (G_OBJECT (self), ctx->result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
load_allowed_modes); load_current_modes);
/* System selection preference introduced in NAS 1.1 */ /* System selection preference introduced in NAS 1.1 */
ctx->run_get_system_selection_preference = qmi_client_check_version (client, 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 */ /* Technology preference introduced in NAS 1.0, so always available */
ctx->run_get_technology_preference = TRUE; 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; MMModemMode preferred;
gboolean run_set_system_selection_preference; gboolean run_set_system_selection_preference;
gboolean run_set_technology_preference; gboolean run_set_technology_preference;
} SetAllowedModesContext; } SetCurrentModesContext;
static void 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_simple_async_result_complete_in_idle (ctx->result);
g_object_unref (ctx->result); g_object_unref (ctx->result);
@@ -2724,19 +2724,19 @@ set_allowed_modes_context_complete_and_free (SetAllowedModesContext *ctx)
} }
static gboolean static gboolean
set_allowed_modes_finish (MMIfaceModem *self, set_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), 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 static void
set_technology_preference_ready (QmiClientNas *client, set_technology_preference_ready (QmiClientNas *client,
GAsyncResult *res, GAsyncResult *res,
SetAllowedModesContext *ctx) SetCurrentModesContext *ctx)
{ {
QmiMessageNasSetTechnologyPreferenceOutput *output = NULL; QmiMessageNasSetTechnologyPreferenceOutput *output = NULL;
GError *error = NULL; GError *error = NULL;
@@ -2756,19 +2756,19 @@ set_technology_preference_ready (QmiClientNas *client,
if (error) if (error)
g_error_free (error); g_error_free (error);
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); 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); qmi_message_nas_set_technology_preference_output_unref (output);
return; return;
} }
ctx->run_set_technology_preference = FALSE; ctx->run_set_technology_preference = FALSE;
set_allowed_modes_context_step (ctx); set_current_modes_context_step (ctx);
} }
static void static void
allowed_modes_set_system_selection_preference_ready (QmiClientNas *client, allowed_modes_set_system_selection_preference_ready (QmiClientNas *client,
GAsyncResult *res, GAsyncResult *res,
SetAllowedModesContext *ctx) SetCurrentModesContext *ctx)
{ {
QmiMessageNasSetSystemSelectionPreferenceOutput *output = NULL; QmiMessageNasSetSystemSelectionPreferenceOutput *output = NULL;
GError *error = NULL; GError *error = NULL;
@@ -2784,18 +2784,18 @@ allowed_modes_set_system_selection_preference_ready (QmiClientNas *client,
} else { } else {
/* Good! TODO: do we really need to wait for the indication? */ /* Good! TODO: do we really need to wait for the indication? */
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); 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); qmi_message_nas_set_system_selection_preference_output_unref (output);
return; return;
} }
/* Try with the deprecated command */ /* Try with the deprecated command */
ctx->run_set_system_selection_preference = FALSE; ctx->run_set_system_selection_preference = FALSE;
set_allowed_modes_context_step (ctx); set_current_modes_context_step (ctx);
} }
static void static void
set_allowed_modes_context_step (SetAllowedModesContext *ctx) set_current_modes_context_step (SetCurrentModesContext *ctx)
{ {
if (ctx->run_set_system_selection_preference) { if (ctx->run_set_system_selection_preference) {
QmiMessageNasSetSystemSelectionPreferenceInput *input; QmiMessageNasSetSystemSelectionPreferenceInput *input;
@@ -2814,7 +2814,7 @@ set_allowed_modes_context_step (SetAllowedModesContext *ctx)
"Unhandled allowed mode setting: '%s'", "Unhandled allowed mode setting: '%s'",
str); str);
g_free (str); g_free (str);
set_allowed_modes_context_complete_and_free (ctx); set_current_modes_context_complete_and_free (ctx);
return; return;
} }
@@ -2853,7 +2853,7 @@ set_allowed_modes_context_step (SetAllowedModesContext *ctx)
MM_CORE_ERROR, MM_CORE_ERROR,
MM_CORE_ERROR_FAILED, MM_CORE_ERROR_FAILED,
"Cannot set specific preferred mode"); "Cannot set specific preferred mode");
set_allowed_modes_context_complete_and_free (ctx); set_current_modes_context_complete_and_free (ctx);
return; return;
} }
@@ -2869,7 +2869,7 @@ set_allowed_modes_context_step (SetAllowedModesContext *ctx)
"Unhandled allowed mode setting: '%s'", "Unhandled allowed mode setting: '%s'",
str); str);
g_free (str); g_free (str);
set_allowed_modes_context_complete_and_free (ctx); set_current_modes_context_complete_and_free (ctx);
return; return;
} }
@@ -2892,17 +2892,17 @@ set_allowed_modes_context_step (SetAllowedModesContext *ctx)
MM_CORE_ERROR, MM_CORE_ERROR,
MM_CORE_ERROR_UNSUPPORTED, MM_CORE_ERROR_UNSUPPORTED,
"Setting allowed modes is not supported by this device"); "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 static void
set_allowed_modes (MMIfaceModem *self, set_current_modes (MMIfaceModem *self,
MMModemMode allowed, MMModemMode allowed,
MMModemMode preferred, MMModemMode preferred,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
SetAllowedModesContext *ctx; SetCurrentModesContext *ctx;
QmiClient *client = NULL; QmiClient *client = NULL;
if (!ensure_qmi_client (MM_BROADBAND_MODEM_QMI (self), if (!ensure_qmi_client (MM_BROADBAND_MODEM_QMI (self),
@@ -2910,13 +2910,13 @@ set_allowed_modes (MMIfaceModem *self,
callback, user_data)) callback, user_data))
return; return;
ctx = g_new0 (SetAllowedModesContext, 1); ctx = g_new0 (SetCurrentModesContext, 1);
ctx->self = g_object_ref (self); ctx->self = g_object_ref (self);
ctx->client = g_object_ref (client); ctx->client = g_object_ref (client);
ctx->result = g_simple_async_result_new (G_OBJECT (self), ctx->result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
set_allowed_modes); set_current_modes);
if (allowed == MM_MODEM_MODE_ANY && ctx->preferred == MM_MODEM_MODE_NONE) { if (allowed == MM_MODEM_MODE_ANY && ctx->preferred == MM_MODEM_MODE_NONE) {
ctx->allowed = (MM_MODEM_MODE_2G | MM_MODEM_MODE_3G); 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 */ /* Technology preference introduced in NAS 1.0, so always available */
ctx->run_set_technology_preference = TRUE; 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->load_supported_charsets_finish = NULL;
iface->setup_charset = NULL; iface->setup_charset = NULL;
iface->setup_charset_finish = NULL; iface->setup_charset_finish = NULL;
iface->load_allowed_modes = load_allowed_modes; iface->load_current_modes = load_current_modes;
iface->load_allowed_modes_finish = load_allowed_modes_finish; iface->load_current_modes_finish = load_current_modes_finish;
iface->set_allowed_modes = set_allowed_modes; iface->set_current_modes = set_current_modes;
iface->set_allowed_modes_finish = set_allowed_modes_finish; iface->set_current_modes_finish = set_current_modes_finish;
iface->load_signal_quality = load_signal_quality; iface->load_signal_quality = load_signal_quality;
iface->load_signal_quality_finish = load_signal_quality_finish; iface->load_signal_quality_finish = load_signal_quality_finish;
iface->load_current_bands = modem_load_current_bands; iface->load_current_bands = modem_load_current_bands;

View File

@@ -174,7 +174,7 @@ typedef enum {
CONNECTION_STEP_WAIT_FOR_INITIALIZED, CONNECTION_STEP_WAIT_FOR_INITIALIZED,
CONNECTION_STEP_ENABLE, CONNECTION_STEP_ENABLE,
CONNECTION_STEP_WAIT_FOR_ENABLED, CONNECTION_STEP_WAIT_FOR_ENABLED,
CONNECTION_STEP_ALLOWED_MODES, CONNECTION_STEP_CURRENT_MODES,
CONNECTION_STEP_CURRENT_BANDS, CONNECTION_STEP_CURRENT_BANDS,
CONNECTION_STEP_REGISTER, CONNECTION_STEP_REGISTER,
CONNECTION_STEP_BEARER, CONNECTION_STEP_BEARER,
@@ -275,7 +275,7 @@ register_in_3gpp_or_cdma_network_ready (MMIfaceModemSimple *self,
} }
static gboolean static gboolean
after_set_allowed_modes_timeout_cb (ConnectionContext *ctx) after_set_current_modes_timeout_cb (ConnectionContext *ctx)
{ {
/* Allowed modes set... almost there! */ /* Allowed modes set... almost there! */
ctx->step++; ctx->step++;
@@ -284,13 +284,13 @@ after_set_allowed_modes_timeout_cb (ConnectionContext *ctx)
} }
static void static void
set_allowed_modes_ready (MMBaseModem *self, set_current_modes_ready (MMBaseModem *self,
GAsyncResult *res, GAsyncResult *res,
ConnectionContext *ctx) ConnectionContext *ctx)
{ {
GError *error = NULL; 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, if (g_error_matches (error,
MM_CORE_ERROR, MM_CORE_ERROR,
MM_CORE_ERROR_UNSUPPORTED)) { 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 * a couple of seconds to settle down. This sleep time just makes sure that
* the modem has enough time to report being unregistered. */ * the modem has enough time to report being unregistered. */
mm_dbg ("Will wait to settle down after updating allowed modes"); 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 static gboolean
@@ -556,21 +556,21 @@ connection_step (ConnectionContext *ctx)
ctx); ctx);
return; return;
case CONNECTION_STEP_ALLOWED_MODES: { case CONNECTION_STEP_CURRENT_MODES: {
MMModemMode allowed_modes = MM_MODEM_MODE_ANY; MMModemMode allowed_modes = MM_MODEM_MODE_ANY;
MMModemMode preferred_mode = MM_MODEM_MODE_NONE; 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); ctx->step, CONNECTION_STEP_LAST);
/* Don't set modes unless explicitly requested to do so */ /* 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, &allowed_modes,
&preferred_mode)) { &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, allowed_modes,
preferred_mode, preferred_mode,
(GAsyncReadyCallback)set_allowed_modes_ready, (GAsyncReadyCallback)set_current_modes_ready,
ctx); ctx);
return; return;
} }
@@ -790,7 +790,7 @@ connect_auth_ready (MMBaseModem *self,
mm_dbg (" PIN: %s", VALIDATE_UNSPECIFIED (mm_simple_connect_properties_get_pin (ctx->properties))); 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); str = mm_modem_mode_build_string_from_mask (allowed);
mm_dbg (" Allowed mode: %s", str); mm_dbg (" Allowed mode: %s", str);
g_free (str); g_free (str);

View File

@@ -2124,7 +2124,7 @@ handle_set_current_bands (MmGdbusModem *skeleton,
} }
/*****************************************************************************/ /*****************************************************************************/
/* ALLOWED MODES */ /* Set current modes */
typedef struct { typedef struct {
MMIfaceModem *self; MMIfaceModem *self;
@@ -2132,10 +2132,10 @@ typedef struct {
GSimpleAsyncResult *result; GSimpleAsyncResult *result;
MMModemMode allowed; MMModemMode allowed;
MMModemMode preferred; MMModemMode preferred;
} SetAllowedModesContext; } SetCurrentModesContext;
static void 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_simple_async_result_complete_in_idle (ctx->result);
g_object_unref (ctx->result); g_object_unref (ctx->result);
@@ -2146,7 +2146,7 @@ set_allowed_modes_context_complete_and_free (SetAllowedModesContext *ctx)
} }
gboolean gboolean
mm_iface_modem_set_allowed_modes_finish (MMIfaceModem *self, mm_iface_modem_set_current_modes_finish (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
@@ -2154,39 +2154,87 @@ mm_iface_modem_set_allowed_modes_finish (MMIfaceModem *self,
} }
static void static void
set_allowed_modes_ready (MMIfaceModem *self, after_set_load_current_modes_ready (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
SetAllowedModesContext *ctx) SetCurrentModesContext *ctx)
{ {
MMModemMode allowed = MM_MODEM_MODE_NONE;
MMModemMode preferred = MM_MODEM_MODE_NONE;
GError *error = NULL; 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,
g_simple_async_result_take_error (ctx->result, error); res,
else { &allowed,
mm_gdbus_modem_set_allowed_modes (ctx->skeleton, ctx->allowed); &preferred,
mm_gdbus_modem_set_preferred_mode (ctx->skeleton, ctx->preferred); &error)) {
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); /* 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);
} }
set_allowed_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);
set_current_modes_context_complete_and_free (ctx);
return;
}
/* 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 void
mm_iface_modem_set_allowed_modes (MMIfaceModem *self, mm_iface_modem_set_current_modes (MMIfaceModem *self,
MMModemMode allowed, MMModemMode allowed,
MMModemMode preferred, MMModemMode preferred,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GArray *supported; GArray *supported;
SetAllowedModesContext *ctx; SetCurrentModesContext *ctx;
MMModemMode current_allowed; MMModemMode current_allowed = MM_MODEM_MODE_ANY;
MMModemMode current_preferred; MMModemMode current_preferred = MM_MODEM_MODE_NONE;
guint i; guint i;
/* If setting allowed modes is not implemented, report an error */ /* If setting allowed modes is not implemented, report an error */
if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_allowed_modes || if (!MM_IFACE_MODEM_GET_INTERFACE (self)->set_current_modes ||
!MM_IFACE_MODEM_GET_INTERFACE (self)->set_allowed_modes_finish) { !MM_IFACE_MODEM_GET_INTERFACE (self)->set_current_modes_finish) {
g_simple_async_report_error_in_idle (G_OBJECT (self), g_simple_async_report_error_in_idle (G_OBJECT (self),
callback, callback,
user_data, user_data,
@@ -2197,12 +2245,12 @@ mm_iface_modem_set_allowed_modes (MMIfaceModem *self,
} }
/* Setup context */ /* Setup context */
ctx = g_new0 (SetAllowedModesContext, 1); ctx = g_new0 (SetCurrentModesContext, 1);
ctx->self = g_object_ref (self); ctx->self = g_object_ref (self);
ctx->result = g_simple_async_result_new (G_OBJECT (self), ctx->result = g_simple_async_result_new (G_OBJECT (self),
callback, callback,
user_data, user_data,
mm_iface_modem_set_allowed_modes); mm_iface_modem_set_current_modes);
ctx->allowed = allowed; ctx->allowed = allowed;
ctx->preferred = preferred; ctx->preferred = preferred;
g_object_get (self, g_object_get (self,
@@ -2213,7 +2261,7 @@ mm_iface_modem_set_allowed_modes (MMIfaceModem *self,
MM_CORE_ERROR, MM_CORE_ERROR,
MM_CORE_ERROR_FAILED, MM_CORE_ERROR_FAILED,
"Couldn't get interface skeleton"); "Couldn't get interface skeleton");
set_allowed_modes_context_complete_and_free (ctx); set_current_modes_context_complete_and_free (ctx);
return; return;
} }
@@ -2228,7 +2276,7 @@ mm_iface_modem_set_allowed_modes (MMIfaceModem *self,
MM_CORE_ERROR_UNSUPPORTED, MM_CORE_ERROR_UNSUPPORTED,
"Cannot change modes: only one combination supported"); "Cannot change modes: only one combination supported");
g_array_unref (supported); g_array_unref (supported);
set_allowed_modes_context_complete_and_free (ctx); set_current_modes_context_complete_and_free (ctx);
return; return;
} }
@@ -2257,7 +2305,7 @@ mm_iface_modem_set_allowed_modes (MMIfaceModem *self,
MM_CORE_ERROR_UNSUPPORTED, MM_CORE_ERROR_UNSUPPORTED,
"The given combination of allowed and preferred modes is not supported"); "The given combination of allowed and preferred modes is not supported");
g_array_unref (supported); g_array_unref (supported);
set_allowed_modes_context_complete_and_free (ctx); set_current_modes_context_complete_and_free (ctx);
return; return;
} }
} }
@@ -2265,12 +2313,14 @@ mm_iface_modem_set_allowed_modes (MMIfaceModem *self,
g_array_unref (supported); g_array_unref (supported);
/* Check if we already are in the requested setup */ /* Check if we already are in the requested setup */
current_allowed = mm_gdbus_modem_get_allowed_modes (ctx->skeleton); g_variant_get (mm_gdbus_modem_get_current_modes (ctx->skeleton),
current_preferred = mm_gdbus_modem_get_preferred_mode (ctx->skeleton); "(uu)",
&current_allowed,
&current_preferred);
if (current_allowed == allowed && if (current_allowed == allowed &&
current_preferred == preferred) { current_preferred == preferred) {
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); 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; return;
} }
@@ -2290,16 +2340,16 @@ mm_iface_modem_set_allowed_modes (MMIfaceModem *self,
g_free (preferred_str); g_free (preferred_str);
g_free (allowed_str); g_free (allowed_str);
set_allowed_modes_context_complete_and_free (ctx); set_current_modes_context_complete_and_free (ctx);
return; return;
} }
ctx->allowed = allowed; ctx->allowed = allowed;
ctx->preferred = preferred; ctx->preferred = preferred;
MM_IFACE_MODEM_GET_INTERFACE (self)->set_allowed_modes (self, MM_IFACE_MODEM_GET_INTERFACE (self)->set_current_modes (self,
allowed, allowed,
preferred, preferred,
(GAsyncReadyCallback)set_allowed_modes_ready, (GAsyncReadyCallback)set_current_modes_ready,
ctx); ctx);
} }
@@ -2309,10 +2359,10 @@ typedef struct {
MMIfaceModem *self; MMIfaceModem *self;
MMModemMode allowed; MMModemMode allowed;
MMModemMode preferred; MMModemMode preferred;
} HandleSetAllowedModesContext; } HandleSetCurrentModesContext;
static void 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->skeleton);
g_object_unref (ctx->invocation); g_object_unref (ctx->invocation);
@@ -2321,31 +2371,31 @@ handle_set_allowed_modes_context_free (HandleSetAllowedModesContext *ctx)
} }
static void static void
handle_set_allowed_modes_ready (MMIfaceModem *self, handle_set_current_modes_ready (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
HandleSetAllowedModesContext *ctx) HandleSetCurrentModesContext *ctx)
{ {
GError *error = NULL; 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); g_dbus_method_invocation_take_error (ctx->invocation, error);
else 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 static void
handle_set_allowed_modes_auth_ready (MMBaseModem *self, handle_set_current_modes_auth_ready (MMBaseModem *self,
GAsyncResult *res, GAsyncResult *res,
HandleSetAllowedModesContext *ctx) HandleSetCurrentModesContext *ctx)
{ {
MMModemState modem_state; MMModemState modem_state;
GError *error = NULL; GError *error = NULL;
if (!mm_base_modem_authorize_finish (self, res, &error)) { if (!mm_base_modem_authorize_finish (self, res, &error)) {
g_dbus_method_invocation_take_error (ctx->invocation, 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; return;
} }
@@ -2360,37 +2410,39 @@ handle_set_allowed_modes_auth_ready (MMBaseModem *self,
MM_CORE_ERROR_WRONG_STATE, MM_CORE_ERROR_WRONG_STATE,
"Cannot set allowed modes: " "Cannot set allowed modes: "
"not initialized/unlocked yet"); "not initialized/unlocked yet");
handle_set_allowed_modes_context_free (ctx); handle_set_current_modes_context_free (ctx);
return; return;
} }
mm_iface_modem_set_allowed_modes (MM_IFACE_MODEM (self), mm_iface_modem_set_current_modes (MM_IFACE_MODEM (self),
ctx->allowed, ctx->allowed,
ctx->preferred, ctx->preferred,
(GAsyncReadyCallback)handle_set_allowed_modes_ready, (GAsyncReadyCallback)handle_set_current_modes_ready,
ctx); ctx);
} }
static gboolean static gboolean
handle_set_allowed_modes (MmGdbusModem *skeleton, handle_set_current_modes (MmGdbusModem *skeleton,
GDBusMethodInvocation *invocation, GDBusMethodInvocation *invocation,
guint allowed, GVariant *variant,
guint preferred,
MMIfaceModem *self) MMIfaceModem *self)
{ {
HandleSetAllowedModesContext *ctx; HandleSetCurrentModesContext *ctx;
ctx = g_new (HandleSetAllowedModesContext, 1); ctx = g_new (HandleSetCurrentModesContext, 1);
ctx->skeleton = g_object_ref (skeleton); ctx->skeleton = g_object_ref (skeleton);
ctx->invocation = g_object_ref (invocation); ctx->invocation = g_object_ref (invocation);
ctx->self = g_object_ref (self); 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), mm_base_modem_authorize (MM_BASE_MODEM (self),
invocation, invocation,
MM_AUTHORIZATION_DEVICE_CONTROL, MM_AUTHORIZATION_DEVICE_CONTROL,
(GAsyncReadyCallback)handle_set_allowed_modes_auth_ready, (GAsyncReadyCallback)handle_set_current_modes_auth_ready,
ctx); ctx);
return TRUE; return TRUE;
} }
@@ -2982,7 +3034,7 @@ static void interface_disabling_step (DisablingContext *ctx);
typedef enum { typedef enum {
DISABLING_STEP_FIRST, DISABLING_STEP_FIRST,
DISABLING_STEP_CURRENT_BANDS, DISABLING_STEP_CURRENT_BANDS,
DISABLING_STEP_ALLOWED_MODES, DISABLING_STEP_CURRENT_MODES,
DISABLING_STEP_LAST DISABLING_STEP_LAST
} DisablingStep; } DisablingStep;
@@ -3027,10 +3079,9 @@ interface_disabling_step (DisablingContext *ctx)
/* Fall down to next step */ /* Fall down to next step */
ctx->step++; ctx->step++;
case DISABLING_STEP_ALLOWED_MODES: case DISABLING_STEP_CURRENT_MODES:
/* Clear allowed/preferred modes */ /* Clear allowed/preferred modes */
mm_gdbus_modem_set_allowed_modes (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));
mm_gdbus_modem_set_preferred_mode (ctx->skeleton, MM_MODEM_MODE_NONE);
/* Fall down to next step */ /* Fall down to next step */
ctx->step++; ctx->step++;
@@ -3086,7 +3137,7 @@ typedef enum {
ENABLING_STEP_FLOW_CONTROL, ENABLING_STEP_FLOW_CONTROL,
ENABLING_STEP_SUPPORTED_CHARSETS, ENABLING_STEP_SUPPORTED_CHARSETS,
ENABLING_STEP_CHARSET, ENABLING_STEP_CHARSET,
ENABLING_STEP_ALLOWED_MODES, ENABLING_STEP_CURRENT_MODES,
ENABLING_STEP_CURRENT_BANDS, ENABLING_STEP_CURRENT_BANDS,
ENABLING_STEP_LAST ENABLING_STEP_LAST
} EnablingStep; } EnablingStep;
@@ -3213,7 +3264,7 @@ setup_charset_ready (MMIfaceModem *self,
} }
static void static void
load_allowed_modes_ready (MMIfaceModem *self, load_current_modes_ready (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
EnablingContext *ctx) EnablingContext *ctx)
{ {
@@ -3221,7 +3272,7 @@ load_allowed_modes_ready (MMIfaceModem *self,
MMModemMode preferred = MM_MODEM_MODE_NONE; MMModemMode preferred = MM_MODEM_MODE_NONE;
GError *error = NULL; 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, res,
&allowed, &allowed,
&preferred, &preferred,
@@ -3231,12 +3282,9 @@ load_allowed_modes_ready (MMIfaceModem *self,
g_error_free (error); g_error_free (error);
/* If errors getting allowed modes, assume ANY/NONE */ /* If errors getting allowed modes, assume ANY/NONE */
allowed = MM_MODEM_MODE_ANY; mm_gdbus_modem_set_current_modes (ctx->skeleton, g_variant_new ("(uu)", MM_MODEM_MODE_ANY, MM_MODEM_MODE_NONE));
preferred = MM_MODEM_MODE_NONE; } else
} mm_gdbus_modem_set_current_modes (ctx->skeleton, g_variant_new ("(uu)", allowed, preferred));
mm_gdbus_modem_set_allowed_modes (ctx->skeleton, allowed);
mm_gdbus_modem_set_preferred_mode (ctx->skeleton, preferred);
/* Done, Go on to next step */ /* Done, Go on to next step */
ctx->step++; ctx->step++;
@@ -3374,20 +3422,19 @@ interface_enabling_step (EnablingContext *ctx)
/* Fall down to next step */ /* Fall down to next step */
ctx->step++; ctx->step++;
case ENABLING_STEP_ALLOWED_MODES: case ENABLING_STEP_CURRENT_MODES:
if (MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_allowed_modes && if (MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_current_modes &&
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_allowed_modes_finish) { MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_current_modes_finish) {
MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_allowed_modes ( MM_IFACE_MODEM_GET_INTERFACE (ctx->self)->load_current_modes (
ctx->self, ctx->self,
(GAsyncReadyCallback)load_allowed_modes_ready, (GAsyncReadyCallback)load_current_modes_ready,
ctx); ctx);
return; return;
} }
/* If no way to get allowed modes, assume allowed=any, /* If no way to get modes, assume ANY/NONE */
* and none preferred */ mm_gdbus_modem_set_current_modes (ctx->skeleton, g_variant_new ("(uu)", MM_MODEM_MODE_ANY, MM_MODEM_MODE_NONE));
mm_gdbus_modem_set_allowed_modes (ctx->skeleton, MM_MODEM_MODE_ANY);
mm_gdbus_modem_set_preferred_mode (ctx->skeleton, MM_MODEM_MODE_NONE);
/* Fall down to next step */ /* Fall down to next step */
ctx->step++; ctx->step++;
@@ -4227,8 +4274,8 @@ interface_initialization_step (InitializationContext *ctx)
G_CALLBACK (handle_set_current_bands), G_CALLBACK (handle_set_current_bands),
ctx->self); ctx->self);
g_signal_connect (ctx->skeleton, g_signal_connect (ctx->skeleton,
"handle-set-allowed-modes", "handle-set-current-modes",
G_CALLBACK (handle_set_allowed_modes), G_CALLBACK (handle_set_current_modes),
ctx->self); ctx->self);
g_simple_async_result_set_op_res_gboolean (ctx->result, TRUE); 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_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_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_supported_modes (skeleton, mm_common_build_mode_combinations_default ());
mm_gdbus_modem_set_allowed_modes (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_preferred_mode (skeleton, MM_MODEM_MODE_NONE);
mm_gdbus_modem_set_supported_bands (skeleton, mm_common_build_bands_unknown ()); 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_current_bands (skeleton, mm_common_build_bands_unknown ());
mm_gdbus_modem_set_supported_ip_families (skeleton, MM_BEARER_IP_FAMILY_NONE); mm_gdbus_modem_set_supported_ip_families (skeleton, MM_BEARER_IP_FAMILY_NONE);

View File

@@ -130,11 +130,11 @@ struct _MMIfaceModem {
GAsyncResult *res, GAsyncResult *res,
GError **error); GError **error);
/* Loading of the AllowedModes and PreferredMode properties */ /* Loading of the Modes property */
void (*load_allowed_modes) (MMIfaceModem *self, void (*load_current_modes) (MMIfaceModem *self,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
gboolean (*load_allowed_modes_finish) (MMIfaceModem *self, gboolean (*load_current_modes_finish) (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
MMModemMode *allowed, MMModemMode *allowed,
MMModemMode *preferred, MMModemMode *preferred,
@@ -226,13 +226,13 @@ struct _MMIfaceModem {
GAsyncResult *res, GAsyncResult *res,
GError **error); GError **error);
/* Asynchronous allowed mode setting operation */ /* Asynchronous current mode setting operation */
void (*set_allowed_modes) (MMIfaceModem *self, void (*set_current_modes) (MMIfaceModem *self,
MMModemMode modes, MMModemMode modes,
MMModemMode preferred, MMModemMode preferred,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); gpointer user_data);
gboolean (*set_allowed_modes_finish) (MMIfaceModem *self, gboolean (*set_current_modes_finish) (MMIfaceModem *self,
GAsyncResult *res, GAsyncResult *res,
GError **error); GError **error);
@@ -417,12 +417,12 @@ void mm_iface_modem_update_signal_quality (MMIfaceModem *self,
guint signal_quality); guint signal_quality);
/* Allow setting allowed modes */ /* 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 allowed,
MMModemMode preferred, MMModemMode preferred,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data); 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, GAsyncResult *res,
GError **error); GError **error);