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
This commit is contained in:
Aleksander Morgado
2018-08-05 14:24:25 +02:00
parent ab0133445c
commit ae9efa05c8

View File

@@ -113,35 +113,40 @@ load_values_ready (MMIfaceModemSignal *self,
mm_gdbus_modem_signal_set_cdma (skeleton, dictionary);
g_variant_unref (dictionary);
g_object_unref (cdma);
}
} else
mm_gdbus_modem_signal_set_cdma (skeleton, NULL);
if (evdo) {
dictionary = mm_signal_get_dictionary (evdo);
mm_gdbus_modem_signal_set_evdo (skeleton, dictionary);
g_variant_unref (dictionary);
g_object_unref (evdo);
}
} else
mm_gdbus_modem_signal_set_evdo (skeleton, NULL);
if (gsm) {
dictionary = mm_signal_get_dictionary (gsm);
mm_gdbus_modem_signal_set_gsm (skeleton, dictionary);
g_variant_unref (dictionary);
g_object_unref (gsm);
}
} else
mm_gdbus_modem_signal_set_gsm (skeleton, NULL);
if (umts) {
dictionary = mm_signal_get_dictionary (umts);
mm_gdbus_modem_signal_set_umts (skeleton, dictionary);
g_variant_unref (dictionary);
g_object_unref (umts);
}
} else
mm_gdbus_modem_signal_set_umts (skeleton, NULL);
if (lte) {
dictionary = mm_signal_get_dictionary (lte);
mm_gdbus_modem_signal_set_lte (skeleton, dictionary);
g_variant_unref (dictionary);
g_object_unref (lte);
}
} else
mm_gdbus_modem_signal_set_lte (skeleton, NULL);
/* Flush right away */
g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (skeleton));