Commit Graph

22 Commits

Author SHA1 Message Date
Aleksander Morgado
45102fcd60 iface-modem-signal: polling and thresholds only in effect if modem enabled
If the modem is disabled:
 * Polling is completely halted.
 * Thresholds are disabled.
 * The user is allowed to call Setup() or SetupThresholds() to change
   the settings, even if the actual polling or thresholds setup isn't
   in effect.

When the modem is enabled:
 * Polling will be started if there is a existing polling rate.
 * Thresholds will be setup based on the existing threshold settings.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/504
2022-02-16 11:28:03 +00:00
Aleksander Morgado
e8c4b88493 libmm-glib: new 'MMSignalThresholdProperties' helper object
To avoid needing to work with GVariants directly.
2021-10-20 22:14:57 +02:00
Aleksander Morgado
f27d7f9362 iface-modem-signal: bind together polling and threshold based setups
The values exposed in the Signal interface must not be cleared every
time polling is disabled, because the user may have also enabled
threshold based loading. And viceversa; if the user disables threshold
based polling, we should not unconditionally clear the values as
polling may still be enabled.

We setup a common Private context associated to the interface, and we
keep the current state there, which is also in sync with the DBus
interface.

We will only clear the signal values if both polling-based and
threshold-based setups are disabled.

Following the same reasoning, the mm_iface_modem_signal_update()
method used by implementations to report new signal quality details
is updated so that it's a no-op if no polling-based or threshold-based
setup has been enabled.
2021-10-20 22:14:04 +02:00
Som_SP
92539fa71f iface-modem-signal: implement support for SetupThresholds()
Also allow updating the per-access technology signal quality
information via indications.

Includes updates by Aleksander Morgado to fix coding style issues and
some other GTask related problems.
2021-10-20 22:09:57 +02:00
Aleksander Morgado
bdbd0fc049 iface-modem-signal: port skeleton update logic to use g_autoptr 2020-07-04 06:37:07 +02:00
Aleksander Morgado
3d138f9f80 iface-modem-signal: remove unneeded skeleton clear attempt
It won't do anything because clear_values() tries to get the skeleton
from the modem object, and the skeleton hasn't been set at that point.
2020-07-04 06:37:07 +02:00
Walter Hagstrom
88923ffe39 iface-modem-signal: added 5G signal information
Extended the ModemManager Signal interface to include 5G signal
information for RSRP, RSRQ and SINR via libqmi.  Also extended mmci
to print 5G signal info.
2020-07-04 05:50:41 +02:00
Aleksander Morgado
695a1003a1 iface-modem-signal: port to use object logging 2020-04-08 16:35:08 +02:00
Aleksander Morgado
fee1ff66f7 iface-modem-signal: fix warnings with -Wimplicit-fallthrough
mm-iface-modem-signal.c:447:18: error: this statement may fall through [-Werror=implicit-fallthrough=]
    447 |         ctx->step++;
        |         ~~~~~~~~~^~
  mm-iface-modem-signal.c:449:5: note: here
    449 |     case INITIALIZATION_STEP_CHECK_SUPPORT:
        |     ^~~~
  ...
2020-01-30 11:59:14 +01:00
Aleksander Morgado
8602e97e1c iface-modem-signal: fix warnings with -Wswitch-default
mm-iface-modem-signal.c: In function ‘interface_initialization_step’:
  mm-iface-modem-signal.c:436:5: error: switch missing default case [-Werror=switch-default]
    436 |     switch (ctx->step) {
        |     ^~~~~~
2020-01-30 11:59:14 +01:00
Aleksander Morgado
d27b108efb iface-modem-signal: avoid logging about signal refresh context if not enabled 2019-11-28 14:47:21 +01:00
Paul Bartell
fe3665b18e iface-modem-signal: Tear down refresh context upon shutdown. 2018-09-13 07:17:51 +00:00
Aleksander Morgado
ae9efa05c8 signal: cleanup previous extended info if no new one given
E.g. if the modem switches from 4G to 3G while the extended signal
information is enabled, we should no longer expose LTE specific signal
quality values, only the UMTS specific ones.

E.g. to avoid this:

    $ mmcli -m 1 --signal-get
      -------------------------
      UMTS   | RSSI: '0,00' dBm
             | RSCP: '-92,00' dBm
             | EcIo: '-13,00' dB
      -------------------------
      LTE    | RSSI: '0,00' dBm
             | RSRQ: '-6,50' dB
             | RSRP: '-96,00' dBm
             |  SNR: '0,00' dB
2018-08-05 14:29:42 +02:00
Aleksander Morgado
4fe464f5f7 core: prefer g_task_return_error_if_cancelled() than custom errors
When the GCancellable is added to the GTask, we can use a single
method call to check for the task being cancelled, and complete it
right away if so.

This patch also clears up the logic in the Novatel plugin, where the
code was trying to return "TRUE" when the task was cancelled, but
wouldn't work as the check-cancellable flag in the GTask is TRUE by
default (i.e. when completing the GTask, if it was cancelled, a
G_IO_ERROR_CANCELLED would be returned by default, regardless of any
other return value set).

This patch also introduces a small variation of the logic in the
Cinterion plugin: instead of running SWWAN=0 before completing the
async action, the command is now sent just after completion of the
async action. This shouldn't be an issue, as the SWWAN result itself
is ignored.
2017-04-18 19:31:02 +02:00
Ben Chan
01cba808e4 iface-modem-signal: port mm_iface_modem_signal_initialize to use GTask 2017-04-15 23:05:32 +02:00
Ben Chan
ed8bea8a3c iface-modem-signal: port mm_iface_modem_signal_enable to use GTask 2017-04-15 23:00:10 +02:00
Ben Chan
ca89a4c038 iface-modem-signal: port mm_modem_iface_signal_disable to use GTask 2017-04-15 22:59:32 +02:00
Aleksander Morgado
ffde429843 core: use G_SOURCE_REMOVE and G_SOURCE_CONTINUE in GSourceFuncs 2015-12-02 17:07:39 +01:00
Aleksander Morgado
71c60fc6eb iface-modem-signal: use the new 'MMSignal' in the interface implementation
Also modify the QMI-specific implementation to act as a state machine, as we'll
add more steps afterwards.
2013-08-21 12:34:54 +02:00
Aleksander Morgado
1340896b50 iface-modem-signal: explicitly check support for the Signal interface 2013-08-21 12:34:54 +02:00
Aleksander Morgado
0502646f9f api,introspection: use per-technology dictionaries in the 'Signal' interface 2013-08-21 12:34:51 +02:00
Aleksander Morgado
d368d30c53 iface-modem-signal: new implementation for the 'Signal' interface 2013-08-21 12:33:10 +02:00