libmm-glib,mmcli: add support for 'error-rate' measurements in signal info
Includes updates by Aleksander Morgado to fix mostly coding style issues.
This commit is contained in:

committed by
Aleksander Morgado

parent
296b5185f5
commit
9537261651
@@ -141,21 +141,27 @@ print_signal_info (void)
|
||||
gchar *refresh_rate;
|
||||
gchar *cdma1x_rssi = NULL;
|
||||
gchar *cdma1x_ecio = NULL;
|
||||
gchar *cdma1x_error_rate = NULL;
|
||||
gchar *evdo_rssi = NULL;
|
||||
gchar *evdo_ecio = NULL;
|
||||
gchar *evdo_sinr = NULL;
|
||||
gchar *evdo_io = NULL;
|
||||
gchar *evdo_error_rate = NULL;
|
||||
gchar *gsm_rssi = NULL;
|
||||
gchar *gsm_error_rate = NULL;
|
||||
gchar *umts_rssi = NULL;
|
||||
gchar *umts_rscp = NULL;
|
||||
gchar *umts_ecio = NULL;
|
||||
gchar *umts_error_rate = NULL;
|
||||
gchar *lte_rssi = NULL;
|
||||
gchar *lte_rsrp = NULL;
|
||||
gchar *lte_rsrq = NULL;
|
||||
gchar *lte_snr = NULL;
|
||||
gchar *lte_error_rate = NULL;
|
||||
gchar *nr5g_rsrp = NULL;
|
||||
gchar *nr5g_rsrq = NULL;
|
||||
gchar *nr5g_snr = NULL;
|
||||
gchar *nr5g_error_rate = NULL;
|
||||
|
||||
refresh_rate = g_strdup_printf ("%u", mm_modem_signal_get_rate (ctx->modem_signal));
|
||||
|
||||
@@ -165,6 +171,8 @@ print_signal_info (void)
|
||||
cdma1x_rssi = g_strdup_printf ("%.2lf", value);
|
||||
if ((value = mm_signal_get_ecio (signal)) != MM_SIGNAL_UNKNOWN)
|
||||
cdma1x_ecio = g_strdup_printf ("%.2lf", value);
|
||||
if ((value = mm_signal_get_error_rate (signal)) != MM_SIGNAL_UNKNOWN)
|
||||
cdma1x_error_rate = g_strdup_printf ("%.2lf", value);
|
||||
}
|
||||
|
||||
signal = mm_modem_signal_peek_evdo (ctx->modem_signal);
|
||||
@@ -177,12 +185,16 @@ print_signal_info (void)
|
||||
evdo_sinr = g_strdup_printf ("%.2lf", value);
|
||||
if ((value = mm_signal_get_io (signal)) != MM_SIGNAL_UNKNOWN)
|
||||
evdo_io = g_strdup_printf ("%.2lf", value);
|
||||
if ((value = mm_signal_get_error_rate (signal)) != MM_SIGNAL_UNKNOWN)
|
||||
evdo_error_rate = g_strdup_printf ("%.2lf", value);
|
||||
}
|
||||
|
||||
signal = mm_modem_signal_peek_gsm (ctx->modem_signal);
|
||||
if (signal) {
|
||||
if ((value = mm_signal_get_rssi (signal)) != MM_SIGNAL_UNKNOWN)
|
||||
gsm_rssi = g_strdup_printf ("%.2lf", value);
|
||||
if ((value = mm_signal_get_error_rate (signal)) != MM_SIGNAL_UNKNOWN)
|
||||
gsm_error_rate = g_strdup_printf ("%.2lf", value);
|
||||
}
|
||||
|
||||
signal = mm_modem_signal_peek_umts (ctx->modem_signal);
|
||||
@@ -193,6 +205,8 @@ print_signal_info (void)
|
||||
umts_rscp = g_strdup_printf ("%.2lf", value);
|
||||
if ((value = mm_signal_get_ecio (signal)) != MM_SIGNAL_UNKNOWN)
|
||||
umts_ecio = g_strdup_printf ("%.2lf", value);
|
||||
if ((value = mm_signal_get_error_rate (signal)) != MM_SIGNAL_UNKNOWN)
|
||||
umts_error_rate = g_strdup_printf ("%.2lf", value);
|
||||
}
|
||||
|
||||
signal = mm_modem_signal_peek_lte (ctx->modem_signal);
|
||||
@@ -205,6 +219,8 @@ print_signal_info (void)
|
||||
lte_rsrp = g_strdup_printf ("%.2lf", value);
|
||||
if ((value = mm_signal_get_snr (signal)) != MM_SIGNAL_UNKNOWN)
|
||||
lte_snr = g_strdup_printf ("%.2lf", value);
|
||||
if ((value = mm_signal_get_error_rate (signal)) != MM_SIGNAL_UNKNOWN)
|
||||
lte_error_rate = g_strdup_printf ("%.2lf", value);
|
||||
}
|
||||
|
||||
signal = mm_modem_signal_peek_nr5g (ctx->modem_signal);
|
||||
@@ -215,26 +231,34 @@ print_signal_info (void)
|
||||
nr5g_rsrp = g_strdup_printf ("%.2lf", value);
|
||||
if ((value = mm_signal_get_snr (signal)) != MM_SIGNAL_UNKNOWN)
|
||||
nr5g_snr = g_strdup_printf ("%.2lf", value);
|
||||
if ((value = mm_signal_get_error_rate (signal)) != MM_SIGNAL_UNKNOWN)
|
||||
nr5g_error_rate = g_strdup_printf ("%.2lf", value);
|
||||
}
|
||||
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_REFRESH_RATE, refresh_rate, "seconds");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_CDMA1X_RSSI, cdma1x_rssi, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_CDMA1X_ECIO, cdma1x_ecio, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_EVDO_RSSI, evdo_rssi, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_EVDO_ECIO, evdo_ecio, "dB");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_EVDO_SINR, evdo_sinr, "dB");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_EVDO_IO, evdo_io, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_GSM_RSSI, gsm_rssi, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_UMTS_RSSI, umts_rssi, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_UMTS_RSCP, umts_rscp, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_UMTS_ECIO, umts_ecio, "dB");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_LTE_RSSI, lte_rssi, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_LTE_RSRQ, lte_rsrq, "dB");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_LTE_RSRP, lte_rsrp, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_LTE_SNR, lte_snr, "dB");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_5G_RSRQ, nr5g_rsrq, "dB");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_5G_RSRP, nr5g_rsrp, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_5G_SNR, nr5g_snr, "dB");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_REFRESH_RATE, refresh_rate, "seconds");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_CDMA1X_RSSI, cdma1x_rssi, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_CDMA1X_ECIO, cdma1x_ecio, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_CDMA1X_ERROR_RATE, cdma1x_error_rate, "%%");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_EVDO_RSSI, evdo_rssi, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_EVDO_ECIO, evdo_ecio, "dB");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_EVDO_SINR, evdo_sinr, "dB");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_EVDO_IO, evdo_io, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_EVDO_ERROR_RATE, evdo_error_rate, "%%");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_GSM_RSSI, gsm_rssi, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_GSM_ERROR_RATE, gsm_error_rate, "%%");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_UMTS_RSSI, umts_rssi, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_UMTS_RSCP, umts_rscp, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_UMTS_ECIO, umts_ecio, "dB");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_UMTS_ERROR_RATE, umts_error_rate, "%%");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_LTE_RSSI, lte_rssi, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_LTE_RSRQ, lte_rsrq, "dB");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_LTE_RSRP, lte_rsrp, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_LTE_SNR, lte_snr, "dB");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_LTE_ERROR_RATE, lte_error_rate, "%%");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_5G_RSRQ, nr5g_rsrq, "dB");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_5G_RSRP, nr5g_rsrp, "dBm");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_5G_SNR, nr5g_snr, "dB");
|
||||
mmcli_output_string_take_typed (MMC_F_SIGNAL_5G_ERROR_RATE, nr5g_error_rate, "%%");
|
||||
mmcli_output_dump ();
|
||||
}
|
||||
|
||||
@@ -243,12 +267,12 @@ setup_process_reply (gboolean result,
|
||||
const GError *error)
|
||||
{
|
||||
if (!result) {
|
||||
g_printerr ("error: couldn't setup extended signal information retrieval: '%s'\n",
|
||||
g_printerr ("error: couldn't setup signal quality information polling: '%s'\n",
|
||||
error ? error->message : "unknown error");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
g_print ("Successfully setup extended signal information retrieval\n");
|
||||
g_print ("Successfully setup signal quality information polling\n");
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user