xmm: port to use object logging
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ModemManager.h"
|
||||
#include "mm-log.h"
|
||||
#include "mm-iface-modem.h"
|
||||
#include "mm-iface-modem-location.h"
|
||||
#include "mm-broadband-modem-mbim-xmm.h"
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ModemManager.h"
|
||||
#include "mm-log.h"
|
||||
#include "mm-iface-modem.h"
|
||||
#include "mm-iface-modem-location.h"
|
||||
#include "mm-broadband-modem-xmm.h"
|
||||
|
||||
@@ -172,7 +172,7 @@ static const MMModemMode xmm_modes[] = {
|
||||
|
||||
gboolean
|
||||
mm_xmm_parse_xact_test_response (const gchar *response,
|
||||
gpointer logger,
|
||||
gpointer log_object,
|
||||
GArray **modes_out,
|
||||
GArray **bands_out,
|
||||
GError **error)
|
||||
@@ -232,7 +232,7 @@ mm_xmm_parse_xact_test_response (const gchar *response,
|
||||
supported_value = g_array_index (supported, guint, i);
|
||||
|
||||
if (supported_value >= G_N_ELEMENTS (xmm_modes)) {
|
||||
mm_warn ("Unexpected AcT supported value: %u", supported_value);
|
||||
mm_obj_warn (log_object, "unexpected AcT supported value: %u", supported_value);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -252,12 +252,12 @@ mm_xmm_parse_xact_test_response (const gchar *response,
|
||||
|
||||
preferred_value = g_array_index (preferred, guint, j);
|
||||
if (preferred_value >= G_N_ELEMENTS (xmm_modes)) {
|
||||
mm_warn ("Unexpected AcT preferred value: %u", preferred_value);
|
||||
mm_obj_warn (log_object, "unexpected AcT preferred value: %u", preferred_value);
|
||||
continue;
|
||||
}
|
||||
combination.preferred = xmm_modes[preferred_value];
|
||||
if (mm_count_bits_set (combination.preferred) != 1) {
|
||||
mm_warn ("AcT preferred value should be a single AcT: %u", preferred_value);
|
||||
mm_obj_warn (log_object, "AcT preferred value should be a single AcT: %u", preferred_value);
|
||||
continue;
|
||||
}
|
||||
if (!(combination.allowed & combination.preferred))
|
||||
@@ -284,7 +284,7 @@ mm_xmm_parse_xact_test_response (const gchar *response,
|
||||
guint num;
|
||||
|
||||
if (!mm_get_uint_from_str (split[i], &num)) {
|
||||
mm_warn ("Unexpected band value: %s", split[i]);
|
||||
mm_obj_warn (log_object, "unexpected band value: %s", split[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ mm_xmm_parse_xact_test_response (const gchar *response,
|
||||
|
||||
band = xact_num_to_band (num);
|
||||
if (band == MM_MODEM_BAND_UNKNOWN) {
|
||||
mm_warn ("Unsupported band value: %s", split[i]);
|
||||
mm_obj_warn (log_object, "unsupported band value: %s", split[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ mm_xmm_parse_xact_test_response (const gchar *response,
|
||||
all_modes = g_array_sized_new (FALSE, FALSE, sizeof (MMModemModeCombination), 1);
|
||||
g_array_append_val (all_modes, all);
|
||||
|
||||
filtered = mm_filter_supported_modes (all_modes, modes, logger);
|
||||
filtered = mm_filter_supported_modes (all_modes, modes, log_object);
|
||||
if (!filtered || filtered->len == 0) {
|
||||
inner_error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
|
||||
"Empty supported mode list after frequency band filtering");
|
||||
@@ -697,8 +697,9 @@ out:
|
||||
}
|
||||
|
||||
static gboolean
|
||||
rssnr_level_to_rssnr (gint rssnr_level,
|
||||
gdouble *out_rssnr)
|
||||
rssnr_level_to_rssnr (gint rssnr_level,
|
||||
gpointer log_object,
|
||||
gdouble *out_rssnr)
|
||||
{
|
||||
if (rssnr_level <= 100 &&
|
||||
rssnr_level >= -100) {
|
||||
@@ -707,7 +708,7 @@ rssnr_level_to_rssnr (gint rssnr_level,
|
||||
}
|
||||
|
||||
if (rssnr_level != 255)
|
||||
mm_warn ("unexpected RSSNR level: %u", rssnr_level);
|
||||
mm_obj_warn (log_object, "unexpected RSSNR level: %u", rssnr_level);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -786,7 +787,7 @@ mm_xmm_xcesq_response_to_signal_info (const gchar *response,
|
||||
}
|
||||
|
||||
/* LTE RSSNR */
|
||||
if (rssnr_level_to_rssnr (rssnr_level, &rssnr)) {
|
||||
if (rssnr_level_to_rssnr (rssnr_level, log_object, &rssnr)) {
|
||||
if (!lte)
|
||||
lte = mm_signal_new ();
|
||||
mm_signal_set_snr (lte, rssnr);
|
||||
|
||||
+19
-18
@@ -22,7 +22,7 @@
|
||||
#define _LIBMM_INSIDE_MM
|
||||
#include <libmm-glib.h>
|
||||
|
||||
#include "mm-log.h"
|
||||
#include "mm-log-object.h"
|
||||
#include "mm-iface-modem.h"
|
||||
#include "mm-iface-modem-signal.h"
|
||||
#include "mm-iface-modem-location.h"
|
||||
@@ -420,7 +420,8 @@ xact_set_bands_ready (MMBaseModem *self,
|
||||
}
|
||||
|
||||
static gchar *
|
||||
validate_and_build_command_set_current_bands (const GArray *bands_array,
|
||||
validate_and_build_command_set_current_bands (MMSharedXmm *self,
|
||||
const GArray *bands_array,
|
||||
const GArray *supported_modes,
|
||||
MMModemMode allowed_modes,
|
||||
GError **error)
|
||||
@@ -445,11 +446,10 @@ validate_and_build_command_set_current_bands (const GArray *bands_array,
|
||||
*/
|
||||
unapplied = mm_xmm_get_modem_mode_any (supported_modes) & ~(allowed_modes);
|
||||
if (unapplied != MM_MODEM_MODE_NONE) {
|
||||
gchar *str;
|
||||
g_autofree gchar *str = NULL;
|
||||
|
||||
str = mm_modem_mode_build_string_from_mask (unapplied);
|
||||
mm_warn ("Automatic band selection not applied to non-current modes %s", str);
|
||||
g_free (str);
|
||||
mm_obj_warn (self, "automatic band selection not applied to non-current modes %s", str);
|
||||
}
|
||||
|
||||
/* Nothing else to validate, go build the command right away */
|
||||
@@ -550,7 +550,8 @@ mm_shared_xmm_set_current_bands (MMIfaceModem *self,
|
||||
goto out;
|
||||
}
|
||||
|
||||
command = validate_and_build_command_set_current_bands (bands_array,
|
||||
command = validate_and_build_command_set_current_bands (MM_SHARED_XMM (self),
|
||||
bands_array,
|
||||
priv->supported_modes,
|
||||
priv->allowed_modes,
|
||||
&error);
|
||||
@@ -840,28 +841,28 @@ xlcslsr_test_ready (MMBaseModem *self,
|
||||
&loc_response_type_nmea_supported,
|
||||
&gnss_type_gps_glonass_supported,
|
||||
&error)) {
|
||||
mm_dbg ("XLCSLSR based GPS control unsupported: %s", error->message);
|
||||
mm_obj_dbg (self, "XLCSLSR based GPS control unsupported: %s", error->message);
|
||||
g_clear_error (&error);
|
||||
} else if (!transport_protocol_invalid_supported ||
|
||||
!standalone_position_mode_supported ||
|
||||
!loc_response_type_nmea_supported ||
|
||||
!gnss_type_gps_glonass_supported) {
|
||||
mm_dbg ("XLCSLSR based GPS control unsupported: protocol invalid %s, standalone %s, nmea %s, gps/glonass %s",
|
||||
transport_protocol_invalid_supported ? "supported" : "unsupported",
|
||||
standalone_position_mode_supported ? "supported" : "unsupported",
|
||||
loc_response_type_nmea_supported ? "supported" : "unsupported",
|
||||
gnss_type_gps_glonass_supported ? "supported" : "unsupported");
|
||||
mm_obj_dbg (self, "XLCSLSR based GPS control unsupported: protocol invalid %s, standalone %s, nmea %s, gps/glonass %s",
|
||||
transport_protocol_invalid_supported ? "supported" : "unsupported",
|
||||
standalone_position_mode_supported ? "supported" : "unsupported",
|
||||
loc_response_type_nmea_supported ? "supported" : "unsupported",
|
||||
gnss_type_gps_glonass_supported ? "supported" : "unsupported");
|
||||
} else {
|
||||
mm_dbg ("XLCSLSR based GPS control supported");
|
||||
mm_obj_dbg (self, "XLCSLSR based GPS control supported");
|
||||
priv->supported_sources |= (MM_MODEM_LOCATION_SOURCE_GPS_NMEA | MM_MODEM_LOCATION_SOURCE_GPS_RAW);
|
||||
|
||||
if (transport_protocol_supl_supported && ms_assisted_based_position_mode_supported) {
|
||||
mm_dbg ("XLCSLSR based A-GPS control supported");
|
||||
mm_obj_dbg (self, "XLCSLSR based A-GPS control supported");
|
||||
priv->supported_sources |= (MM_MODEM_LOCATION_SOURCE_AGPS_MSA | MM_MODEM_LOCATION_SOURCE_AGPS_MSB);
|
||||
} else {
|
||||
mm_dbg ("XLCSLSR based A-GPS control unsupported: protocol supl %s, ms assisted/based %s",
|
||||
transport_protocol_supl_supported ? "supported" : "unsupported",
|
||||
ms_assisted_based_position_mode_supported ? "supported" : "unsupported");
|
||||
mm_obj_dbg (self, "XLCSLSR based A-GPS control unsupported: protocol supl %s, ms assisted/based %s",
|
||||
transport_protocol_supl_supported ? "supported" : "unsupported",
|
||||
ms_assisted_based_position_mode_supported ? "supported" : "unsupported");
|
||||
}
|
||||
|
||||
sources |= priv->supported_sources;
|
||||
@@ -903,7 +904,7 @@ parent_load_capabilities_ready (MMIfaceModemLocation *self,
|
||||
|
||||
/* If parent already supports GPS sources, we won't do anything else */
|
||||
if (sources & (MM_MODEM_LOCATION_SOURCE_GPS_NMEA | MM_MODEM_LOCATION_SOURCE_GPS_RAW)) {
|
||||
mm_dbg ("No need to run XLCSLSR based location gathering");
|
||||
mm_obj_dbg (self, "no need to run XLCSLSR based location gathering");
|
||||
g_task_return_int (task, sources);
|
||||
g_object_unref (task);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user