summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-09-15 12:22:34 +0200
committerAleksander Morgado <aleksander@aleksander.es>2020-10-07 10:36:10 +0200
commit1b30b3a20a62bd5af5060b2ffcaa018c2961d2c4 (patch)
tree6ba9bac40461e08c4de72d62800cc6f5196a6b97
parenteb04b8943c7b24f8737441ceb24d2bceba6e6f92 (diff)
libqmi-glib,nas: BCD encoded strings should be read as arrays
The BCD encoded PLMN strings in the "NAS Get Cell Location Info" message should be read as byte arrays, and then processed by the user to read the BCD encoded string. Attempting to read this kind of fields as a standard ASCII strings will fail UTF-8 validation, and the whole TLV will be skipped. Fixes https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/issues/47 (cherry picked from commit 84e0bffaff9c6d07569377f04d3ea038620cf58f)
-rw-r--r--data/qmi-service-nas.json40
-rw-r--r--docs/reference/libqmi-glib/libqmi-glib-common.sections7
-rw-r--r--src/libqmi-glib/qmi-compat.c106
-rw-r--r--src/libqmi-glib/qmi-compat.h149
-rw-r--r--src/libqmi-glib/test/test-generated.c103
-rw-r--r--src/qmicli/qmicli-nas.c25
6 files changed, 401 insertions, 29 deletions
diff --git a/data/qmi-service-nas.json b/data/qmi-service-nas.json
index 5ff9e43..1eb2247 100644
--- a/data/qmi-service-nas.json
+++ b/data/qmi-service-nas.json
@@ -1622,16 +1622,17 @@
"id" : "0x0043",
"since" : "1.10",
"output" : [ { "common-ref" : "Operation Result" },
- { "name" : "GERAN Info",
+ { "name" : "GERAN Info v2",
"id" : "0x10",
"type" : "TLV",
- "since" : "1.10",
+ "since" : "1.28",
"format" : "sequence",
"contents" : [ { "name" : "Cell ID",
"format" : "guint32" },
- { "name" : "PLMN",
- "format" : "string",
- "fixed-size" : "3" },
+ { "name" : "PLMN",
+ "format" : "array",
+ "fixed-size" : "3",
+ "array-element" : { "format" : "guint8" } },
{ "name" : "LAC",
"format" : "guint16" },
{ "name" : "GERAN Absolute RF Channel Number",
@@ -1648,9 +1649,10 @@
"format" : "struct",
"contents" : [ { "name" : "Cell ID",
"format" : "guint32" },
- { "name" : "PLMN",
- "format" : "string",
- "fixed-size" : "3" },
+ { "name" : "PLMN",
+ "format" : "array",
+ "fixed-size" : "3",
+ "array-element" : { "format" : "guint8" } },
{ "name" : "LAC",
"format" : "guint16" },
{ "name" : "GERAN Absolute RF Channel Number",
@@ -1659,16 +1661,17 @@
"format" : "guint8" },
{ "name" : "RX Level",
"format" : "guint16" } ] } } ] },
- { "name" : "UMTS Info",
+ { "name" : "UMTS Info v2",
"id" : "0x11",
"type" : "TLV",
- "since" : "1.10",
+ "since" : "1.28",
"format" : "sequence",
"contents" : [ { "name" : "Cell ID",
"format" : "guint16" },
- { "name" : "PLMN",
- "format" : "string",
- "fixed-size" : "3" },
+ { "name" : "PLMN",
+ "format" : "array",
+ "fixed-size" : "3",
+ "array-element" : { "format" : "guint8" } },
{ "name" : "LAC",
"format" : "guint16" },
{ "name" : "UTRA Absolute RF Channel Number",
@@ -1720,17 +1723,18 @@
"format" : "guint32" },
{ "name" : "Longitude",
"format" : "guint32" } ] },
- { "name" : "Intrafrequency LTE Info",
+ { "name" : "Intrafrequency LTE Info v2",
"id" : "0x13",
"type" : "TLV",
- "since" : "1.10",
+ "since" : "1.28",
"format" : "sequence",
"contents" : [ { "name" : "UE In Idle",
"format" : "guint8",
"public-format" : "gboolean" },
- { "name" : "PLMN",
- "format" : "string",
- "fixed-size" : "3" },
+ { "name" : "PLMN",
+ "format" : "array",
+ "fixed-size" : "3",
+ "array-element" : { "format" : "guint8" } },
{ "name" : "Tracking Area Code",
"format" : "guint16" },
{ "name" : "Global Cell ID",
diff --git a/docs/reference/libqmi-glib/libqmi-glib-common.sections b/docs/reference/libqmi-glib/libqmi-glib-common.sections
index 8c91c41..7c70dd9 100644
--- a/docs/reference/libqmi-glib/libqmi-glib-common.sections
+++ b/docs/reference/libqmi-glib/libqmi-glib-common.sections
@@ -1556,6 +1556,13 @@ qmi_message_wda_get_data_format_output_get_uplink_data_aggregation_max_size
qmi_message_nas_get_operator_name_output_get_operator_nitz_information
qmi_indication_nas_operator_name_output_get_operator_nitz_information
qmi_message_nas_get_home_network_output_get_home_network_3gpp2
+QmiMessageNasGetCellLocationInfoOutputGeranInfoCellElement
+qmi_message_nas_get_cell_location_info_output_get_geran_info
+QmiMessageNasGetCellLocationInfoOutputUmtsInfoCellElement
+QmiMessageNasGetCellLocationInfoOutputUmtsInfoNeighboringGeranElement
+qmi_message_nas_get_cell_location_info_output_get_umts_info
+QmiMessageNasGetCellLocationInfoOutputIntrafrequencyLteInfoCellElement
+qmi_message_nas_get_cell_location_info_output_get_intrafrequency_lte_info
<SUBSECTION Symbols>
QMI_NAS_SIM_REJECT_STATE_SIM_VAILABLE
QMI_WDS_CDMA_CAUSE_CODE_NETWORK_ADDRESS_VACANT
diff --git a/src/libqmi-glib/qmi-compat.c b/src/libqmi-glib/qmi-compat.c
index b75265a..fca77f5 100644
--- a/src/libqmi-glib/qmi-compat.c
+++ b/src/libqmi-glib/qmi-compat.c
@@ -1142,4 +1142,110 @@ qmi_message_nas_get_home_network_output_get_home_network_3gpp2 (
#endif /* HAVE_QMI_MESSAGE_NAS_GET_HOME_NETWORK */
+#if defined HAVE_QMI_MESSAGE_NAS_GET_CELL_LOCATION_INFO
+
+/* This PLMN string is returned because it's a 3-char long valid UTF-8. */
+static const gchar invalid_plmn_str[] = " ";
+
+gboolean
+qmi_message_nas_get_cell_location_info_output_get_intrafrequency_lte_info (
+ QmiMessageNasGetCellLocationInfoOutput *self,
+ gboolean *value_intrafrequency_lte_info_ue_in_idle,
+ const gchar **value_intrafrequency_lte_info_plmn,
+ guint16 *value_intrafrequency_lte_info_tracking_area_code,
+ guint32 *value_intrafrequency_lte_info_global_cell_id,
+ guint16 *value_intrafrequency_lte_info_eutra_absolute_rf_channel_number,
+ guint16 *value_intrafrequency_lte_info_serving_cell_id,
+ guint8 *value_intrafrequency_lte_info_cell_reselection_priority,
+ guint8 *value_intrafrequency_lte_info_s_non_intra_search_threshold,
+ guint8 *value_intrafrequency_lte_info_serving_cell_low_threshold,
+ guint8 *value_intrafrequency_lte_info_s_intra_search_threshold,
+ GArray **value_intrafrequency_lte_info_cell,
+ GError **error)
+{
+ if (!qmi_message_nas_get_cell_location_info_output_get_intrafrequency_lte_info_v2 (
+ self,
+ value_intrafrequency_lte_info_ue_in_idle,
+ NULL,
+ value_intrafrequency_lte_info_tracking_area_code,
+ value_intrafrequency_lte_info_global_cell_id,
+ value_intrafrequency_lte_info_eutra_absolute_rf_channel_number,
+ value_intrafrequency_lte_info_serving_cell_id,
+ value_intrafrequency_lte_info_cell_reselection_priority,
+ value_intrafrequency_lte_info_s_non_intra_search_threshold,
+ value_intrafrequency_lte_info_serving_cell_low_threshold,
+ value_intrafrequency_lte_info_s_intra_search_threshold,
+ value_intrafrequency_lte_info_cell,
+ error))
+ return FALSE;
+
+ *value_intrafrequency_lte_info_plmn = invalid_plmn_str;
+ return TRUE;
+}
+
+gboolean
+qmi_message_nas_get_cell_location_info_output_get_umts_info (
+ QmiMessageNasGetCellLocationInfoOutput *self,
+ guint16 *value_umts_info_cell_id,
+ const gchar **value_umts_info_plmn,
+ guint16 *value_umts_info_lac,
+ guint16 *value_umts_info_utra_absolute_rf_channel_number,
+ guint16 *value_umts_info_primary_scrambling_code,
+ gint16 *value_umts_info_rscp,
+ gint16 *value_umts_info_ecio,
+ GArray **value_umts_info_cell,
+ GArray **value_umts_info_neighboring_geran,
+ GError **error)
+{
+ if (!qmi_message_nas_get_cell_location_info_output_get_umts_info_v2 (
+ self,
+ value_umts_info_cell_id,
+ NULL,
+ value_umts_info_lac,
+ value_umts_info_utra_absolute_rf_channel_number,
+ value_umts_info_primary_scrambling_code,
+ value_umts_info_rscp,
+ value_umts_info_ecio,
+ value_umts_info_cell,
+ value_umts_info_neighboring_geran,
+ error))
+ return FALSE;
+
+ *value_umts_info_plmn = invalid_plmn_str;
+ return TRUE;
+}
+
+gboolean
+qmi_message_nas_get_cell_location_info_output_get_geran_info (
+ QmiMessageNasGetCellLocationInfoOutput *self,
+ guint32 *value_geran_info_cell_id,
+ const gchar **value_geran_info_plmn,
+ guint16 *value_geran_info_lac,
+ guint16 *value_geran_info_geran_absolute_rf_channel_number,
+ guint8 *value_geran_info_base_station_identity_code,
+ guint32 *value_geran_info_timing_advance,
+ guint16 *value_geran_info_rx_level,
+ GArray **value_geran_info_cell,
+ GError **error)
+{
+ if (!qmi_message_nas_get_cell_location_info_output_get_geran_info_v2 (
+ self,
+ value_geran_info_cell_id,
+ NULL,
+ value_geran_info_lac,
+ value_geran_info_geran_absolute_rf_channel_number,
+ value_geran_info_base_station_identity_code,
+ value_geran_info_timing_advance,
+ value_geran_info_rx_level,
+ NULL,
+ error))
+ return FALSE;
+
+ *value_geran_info_plmn = invalid_plmn_str;
+ *value_geran_info_cell = NULL;
+ return TRUE;
+}
+
+#endif /* HAVE_QMI_MESSAGE_NAS_GET_CELL_LOCATION_INFO */
+
#endif /* QMI_DISABLE_DEPRECATED */
diff --git a/src/libqmi-glib/qmi-compat.h b/src/libqmi-glib/qmi-compat.h
index b00e66a..664e931 100644
--- a/src/libqmi-glib/qmi-compat.h
+++ b/src/libqmi-glib/qmi-compat.h
@@ -2133,6 +2133,155 @@ gboolean qmi_message_nas_get_home_network_output_get_home_network_3gpp2 (
#endif /* HAVE_QMI_MESSAGE_NAS_GET_HOME_NETWORK */
+#if defined HAVE_QMI_MESSAGE_NAS_GET_CELL_LOCATION_INFO
+
+/**
+ * QmiMessageNasGetCellLocationInfoOutputGeranInfoCellElement:
+ * @cell_id: a #guint32.
+ * @plmn: a string of exactly 3 characters.
+ * @lac: a #guint16.
+ * @geran_absolute_rf_channel_number: a #guint16.
+ * @base_station_identity_code: a #guint8.
+ * @rx_level: a #guint16.
+ *
+ * A QmiMessageNasGetCellLocationInfoOutputGeranInfoCellElement struct.
+ *
+ * Since: 1.10
+ * Deprecated: 1.28.
+ */
+G_DEPRECATED
+typedef struct _QmiMessageNasGetCellLocationInfoOutputGeranInfoCellElement {
+ guint32 cell_id;
+ gchar *plmn;
+ guint16 lac;
+ guint16 geran_absolute_rf_channel_number;
+ guint8 base_station_identity_code;
+ guint16 rx_level;
+} QmiMessageNasGetCellLocationInfoOutputGeranInfoCellElement;
+
+typedef QmiMessageNasGetCellLocationInfoOutputIntrafrequencyLteInfoV2CellElement QmiMessageNasGetCellLocationInfoOutputIntrafrequencyLteInfoCellElement;
+
+/**
+ * qmi_message_nas_get_cell_location_info_output_get_intrafrequency_lte_info:
+ * @self: a #QmiMessageNasGetCellLocationInfoOutput.
+ * @value_intrafrequency_lte_info_ue_in_idle: (out): a placeholder for the output #gboolean, or %NULL if not required.
+ * @value_intrafrequency_lte_info_plmn: (out): a placeholder for the output constant string, or %NULL if not required.
+ * @value_intrafrequency_lte_info_tracking_area_code: (out): a placeholder for the output #guint16, or %NULL if not required.
+ * @value_intrafrequency_lte_info_global_cell_id: (out): a placeholder for the output #guint32, or %NULL if not required.
+ * @value_intrafrequency_lte_info_eutra_absolute_rf_channel_number: (out): a placeholder for the output #guint16, or %NULL if not required.
+ * @value_intrafrequency_lte_info_serving_cell_id: (out): a placeholder for the output #guint16, or %NULL if not required.
+ * @value_intrafrequency_lte_info_cell_reselection_priority: (out): a placeholder for the output #guint8, or %NULL if not required.
+ * @value_intrafrequency_lte_info_s_non_intra_search_threshold: (out): a placeholder for the output #guint8, or %NULL if not required.
+ * @value_intrafrequency_lte_info_serving_cell_low_threshold: (out): a placeholder for the output #guint8, or %NULL if not required.
+ * @value_intrafrequency_lte_info_s_intra_search_threshold: (out): a placeholder for the output #guint8, or %NULL if not required.
+ * @value_intrafrequency_lte_info_cell: (out)(element-type QmiMessageNasGetCellLocationInfoOutputIntrafrequencyLteInfoCellElement)(transfer none): a placeholder for the output #GArray of #QmiMessageNasGetCellLocationInfoOutputIntrafrequencyLteInfoCellElement elements, or %NULL if not required. Do not free it, it is owned by @self.
+ * @error: Return location for error or %NULL.
+ *
+ * Get the 'Intrafrequency LTE Info' field from @self.
+ *
+ * This method is deprecated and returns an empty
+ * @value_intrafrequency_lte_info_plmn string.
+ *
+ * Returns: (skip): %TRUE if the field is found, %FALSE otherwise.
+ *
+ * Since: 1.10
+ * Deprecated: 1.28. Use qmi_message_nas_get_cell_location_info_output_get_intrafrequency_lte_info_v2() instead.
+ */
+G_DEPRECATED_FOR (qmi_message_nas_get_cell_location_info_output_get_intrafrequency_lte_info_v2)
+gboolean qmi_message_nas_get_cell_location_info_output_get_intrafrequency_lte_info (
+ QmiMessageNasGetCellLocationInfoOutput *self,
+ gboolean *value_intrafrequency_lte_info_ue_in_idle,
+ const gchar **value_intrafrequency_lte_info_plmn,
+ guint16 *value_intrafrequency_lte_info_tracking_area_code,
+ guint32 *value_intrafrequency_lte_info_global_cell_id,
+ guint16 *value_intrafrequency_lte_info_eutra_absolute_rf_channel_number,
+ guint16 *value_intrafrequency_lte_info_serving_cell_id,
+ guint8 *value_intrafrequency_lte_info_cell_reselection_priority,
+ guint8 *value_intrafrequency_lte_info_s_non_intra_search_threshold,
+ guint8 *value_intrafrequency_lte_info_serving_cell_low_threshold,
+ guint8 *value_intrafrequency_lte_info_s_intra_search_threshold,
+ GArray **value_intrafrequency_lte_info_cell,
+ GError **error);
+
+typedef QmiMessageNasGetCellLocationInfoOutputUmtsInfoV2CellElement QmiMessageNasGetCellLocationInfoOutputUmtsInfoCellElement;
+typedef QmiMessageNasGetCellLocationInfoOutputUmtsInfoV2NeighboringGeranElement QmiMessageNasGetCellLocationInfoOutputUmtsInfoNeighboringGeranElement;
+
+/**
+ * qmi_message_nas_get_cell_location_info_output_get_umts_info:
+ * @self: a #QmiMessageNasGetCellLocationInfoOutput.
+ * @value_umts_info_cell_id: (out): a placeholder for the output #guint16, or %NULL if not required.
+ * @value_umts_info_plmn: (out): a placeholder for the output constant string, or %NULL if not required.
+ * @value_umts_info_lac: (out): a placeholder for the output #guint16, or %NULL if not required.
+ * @value_umts_info_utra_absolute_rf_channel_number: (out): a placeholder for the output #guint16, or %NULL if not required.
+ * @value_umts_info_primary_scrambling_code: (out): a placeholder for the output #guint16, or %NULL if not required.
+ * @value_umts_info_rscp: (out): a placeholder for the output #gint16, or %NULL if not required.
+ * @value_umts_info_ecio: (out): a placeholder for the output #gint16, or %NULL if not required.
+ * @value_umts_info_cell: (out)(element-type QmiMessageNasGetCellLocationInfoOutputUmtsInfoCellElement)(transfer none): a placeholder for the output #GArray of #QmiMessageNasGetCellLocationInfoOutputUmtsInfoCellElement elements, or %NULL if not required. Do not free it, it is owned by @self.
+ * @value_umts_info_neighboring_geran: (out)(element-type QmiMessageNasGetCellLocationInfoOutputUmtsInfoNeighboringGeranElement)(transfer none): a placeholder for the output #GArray of #QmiMessageNasGetCellLocationInfoOutputUmtsInfoNeighboringGeranElement elements, or %NULL if not required. Do not free it, it is owned by @self.
+ * @error: Return location for error or %NULL.
+ *
+ * Get the 'UMTS Info' field from @self.
+ *
+ * This method is deprecated and returns an empty @value_umts_info_plmn
+ * string.
+ *
+ * Returns: (skip): %TRUE if the field is found, %FALSE otherwise.
+ *
+ * Since: 1.10
+ * Deprecated: 1.28. Use qmi_message_nas_get_cell_location_info_output_get_umts_info_v2() instead.
+ */
+G_DEPRECATED_FOR (qmi_message_nas_get_cell_location_info_output_get_umts_info_v2)
+gboolean qmi_message_nas_get_cell_location_info_output_get_umts_info (
+ QmiMessageNasGetCellLocationInfoOutput *self,
+ guint16 *value_umts_info_cell_id,
+ const gchar **value_umts_info_plmn,
+ guint16 *value_umts_info_lac,
+ guint16 *value_umts_info_utra_absolute_rf_channel_number,
+ guint16 *value_umts_info_primary_scrambling_code,
+ gint16 *value_umts_info_rscp,
+ gint16 *value_umts_info_ecio,
+ GArray **value_umts_info_cell,
+ GArray **value_umts_info_neighboring_geran,
+ GError **error);
+
+/**
+ * qmi_message_nas_get_cell_location_info_output_get_geran_info:
+ * @self: a #QmiMessageNasGetCellLocationInfoOutput.
+ * @value_geran_info_cell_id: (out): a placeholder for the output #guint32, or %NULL if not required.
+ * @value_geran_info_plmn: (out): a placeholder for the output constant string, or %NULL if not required.
+ * @value_geran_info_lac: (out): a placeholder for the output #guint16, or %NULL if not required.
+ * @value_geran_info_geran_absolute_rf_channel_number: (out): a placeholder for the output #guint16, or %NULL if not required.
+ * @value_geran_info_base_station_identity_code: (out): a placeholder for the output #guint8, or %NULL if not required.
+ * @value_geran_info_timing_advance: (out): a placeholder for the output #guint32, or %NULL if not required.
+ * @value_geran_info_rx_level: (out): a placeholder for the output #guint16, or %NULL if not required.
+ * @value_geran_info_cell: (out)(element-type QmiMessageNasGetCellLocationInfoOutputGeranInfoCellElement)(transfer none): a placeholder for the output #GArray of #QmiMessageNasGetCellLocationInfoOutputGeranInfoCellElement elements, or %NULL if not required. Do not free it, it is owned by @self.
+ * @error: Return location for error or %NULL.
+ *
+ * Get the 'GERAN Info' field from @self.
+ *
+ * This method is deprecated and returns an empty @value_geran_info_plmn
+ * string and an empty @value_geran_info_cell array.
+ *
+ * Returns: (skip): %TRUE if the field is found, %FALSE otherwise.
+ *
+ * Since: 1.10
+ * Deprecated: 1.28. Use qmi_message_nas_get_cell_location_info_output_get_geran_info_v2() instead.
+ */
+G_DEPRECATED_FOR (qmi_message_nas_get_cell_location_info_output_get_geran_info_v2)
+gboolean qmi_message_nas_get_cell_location_info_output_get_geran_info (
+ QmiMessageNasGetCellLocationInfoOutput *self,
+ guint32 *value_geran_info_cell_id,
+ const gchar **value_geran_info_plmn,
+ guint16 *value_geran_info_lac,
+ guint16 *value_geran_info_geran_absolute_rf_channel_number,
+ guint8 *value_geran_info_base_station_identity_code,
+ guint32 *value_geran_info_timing_advance,
+ guint16 *value_geran_info_rx_level,
+ GArray **value_geran_info_cell,
+ GError **error);
+
+#endif /* HAVE_QMI_MESSAGE_NAS_GET_CELL_LOCATION_INFO */
+
#endif /* QMI_DISABLE_DEPRECATED */
#endif /* _LIBQMI_GLIB_QMI_COMPAT_H_ */
diff --git a/src/libqmi-glib/test/test-generated.c b/src/libqmi-glib/test/test-generated.c
index 873b8cb..48e29f4 100644
--- a/src/libqmi-glib/test/test-generated.c
+++ b/src/libqmi-glib/test/test-generated.c
@@ -670,6 +670,108 @@ test_generated_nas_get_cell_location_info_1 (TestFixture *fixture)
}
static void
+nas_get_cell_location_info_2_ready (QmiClientNas *client,
+ GAsyncResult *res,
+ TestFixture *fixture)
+{
+ QmiMessageNasGetCellLocationInfoOutput *output;
+ GError *error = NULL;
+ gboolean st;
+
+ output = qmi_client_nas_get_cell_location_info_finish (client, res, &error);
+ g_assert_no_error (error);
+ g_assert (output);
+
+ st = qmi_message_nas_get_cell_location_info_output_get_result (output, &error);
+ g_assert_no_error (error);
+ g_assert (st);
+
+ {
+ gboolean value_intrafrequency_lte_info_ue_in_idle = FALSE;
+ GArray *value_intrafrequency_lte_info_plmn = NULL;
+ guint16 value_intrafrequency_lte_info_tracking_area_code = 0;
+ guint32 value_intrafrequency_lte_info_global_cell_id = 0;
+ guint16 value_intrafrequency_lte_info_eutra_absolute_rf_channel_number = 0;
+ guint16 value_intrafrequency_lte_info_serving_cell_id = 0;
+ guint8 value_intrafrequency_lte_info_cell_reselection_priority = 0;
+ guint8 value_intrafrequency_lte_info_s_non_intra_search_threshold = 0;
+ guint8 value_intrafrequency_lte_info_serving_cell_low_threshold = 0;
+ guint8 value_intrafrequency_lte_info_s_intra_search_threshold = 0;
+ GArray *value_intrafrequency_lte_info_cell = NULL;
+
+ st = qmi_message_nas_get_cell_location_info_output_get_intrafrequency_lte_info_v2 (output,
+ &value_intrafrequency_lte_info_ue_in_idle,
+ &value_intrafrequency_lte_info_plmn,
+ &value_intrafrequency_lte_info_tracking_area_code,
+ &value_intrafrequency_lte_info_global_cell_id,
+ &value_intrafrequency_lte_info_eutra_absolute_rf_channel_number,
+ &value_intrafrequency_lte_info_serving_cell_id,
+ &value_intrafrequency_lte_info_cell_reselection_priority,
+ &value_intrafrequency_lte_info_s_non_intra_search_threshold,
+ &value_intrafrequency_lte_info_serving_cell_low_threshold,
+ &value_intrafrequency_lte_info_s_intra_search_threshold,
+ &value_intrafrequency_lte_info_cell,
+ &error);
+ g_assert_no_error (error);
+ g_assert (st);
+ }
+
+ qmi_message_nas_get_cell_location_info_output_unref (output);
+
+ test_fixture_loop_stop (fixture);
+}
+
+static void
+test_generated_nas_get_cell_location_info_2 (TestFixture *fixture)
+{
+ guint8 expected[] = {
+ 0x01,
+ 0x0C, 0x00, 0x00, 0x03,
+ 0x01, 0x00, 0x01, 0x00, 0x43, 0x00, 0x00, 0x00,
+ };
+ guint8 response[] = {
+ 0x01,
+ 0x67, 0x00, 0x80, 0x03, 0x01,
+ 0x02, 0x01, 0x00, 0x43, 0x00, 0x5B, 0x00, 0x02,
+ 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x13, 0x1D, 0x00,
+ 0x01, 0x99, 0xF9, 0x04, 0x99, 0x00, 0x01,
+ 0xC2, 0x01, 0x00, 0x7E, 0xA9, 0x00, 0x00, 0x01,
+ 0x3E, 0x28, 0x3E, 0x01, 0x00, 0x00, 0xBD, 0xFF,
+ 0x19, 0xFC, 0x23, 0xFD, 0x1E, 0x00,
+ 0x14, 0x02, 0x00,
+ 0x01, 0x00,
+ 0x15, 0x02, 0x00,
+ 0x01, 0x00,
+ 0x16, 0x02, 0x00,
+ 0x01, 0x00,
+ 0x1E, 0x04, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF,
+ 0x26, 0x02, 0x00,
+ 0x46, 0x00,
+ 0x27, 0x04, 0x00,
+ 0x7E, 0xA9, 0x00, 0x00,
+ 0x28, 0x01, 0x00,
+ 0x00,
+ 0x2A, 0x04, 0x00,
+ 0x03, 0x00, 0x00, 0x00,
+ 0x2C, 0x04, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+ };
+
+ test_port_context_set_command (fixture->ctx,
+ expected, G_N_ELEMENTS (expected),
+ response, G_N_ELEMENTS (response),
+ fixture->service_info[QMI_SERVICE_NAS].transaction_id++);
+
+ qmi_client_nas_get_cell_location_info (QMI_CLIENT_NAS (fixture->service_info[QMI_SERVICE_NAS].client), NULL, 3, NULL,
+ (GAsyncReadyCallback) nas_get_cell_location_info_2_ready,
+ fixture);
+
+ test_fixture_loop_run (fixture);
+}
+
+static void
nas_get_cell_location_info_invalid_ready (QmiClientNas *client,
GAsyncResult *res,
TestFixture *fixture)
@@ -994,6 +1096,7 @@ int main (int argc, char **argv)
#endif
#if defined HAVE_QMI_MESSAGE_NAS_GET_CELL_LOCATION_INFO
TEST_ADD ("/libqmi-glib/generated/nas/get-cell-location-info/1", test_generated_nas_get_cell_location_info_1);
+ TEST_ADD ("/libqmi-glib/generated/nas/get-cell-location-info/2", test_generated_nas_get_cell_location_info_2);
TEST_ADD ("/libqmi-glib/generated/nas/get-cell-location-info/invalid", test_generated_nas_get_cell_location_info_invalid);
#endif
#if defined HAVE_QMI_MESSAGE_NAS_GET_SERVING_SYSTEM
diff --git a/src/qmicli/qmicli-nas.c b/src/qmicli/qmicli-nas.c
index 1797932..16b6518 100644
--- a/src/qmicli/qmicli-nas.c
+++ b/src/qmicli/qmicli-nas.c
@@ -2607,19 +2607,22 @@ network_scan_ready (QmiClientNas *client,
#if defined HAVE_QMI_MESSAGE_NAS_GET_CELL_LOCATION_INFO
static gchar *
-str_from_bcd_plmn (const gchar *bcd)
+str_from_bcd_plmn (GArray *bcd)
{
static const gchar bcd_chars[] = "0123456789*#abc\0\0";
gchar *str;
guint i;
guint j;
- str = g_malloc (7);
- for (i = 0, j = 0 ; i < 3; i++) {
- str[j] = bcd_chars[bcd[i] & 0xF];
+ if (!bcd || !bcd->len)
+ return NULL;
+
+ str = g_malloc (1 + (bcd->len * 2));
+ for (i = 0, j = 0 ; i < bcd->len; i++) {
+ str[j] = bcd_chars[g_array_index (bcd, guint8, i) & 0xF];
if (str[j])
j++;
- str[j] = bcd_chars[(bcd[i] >> 4) & 0xF];
+ str[j] = bcd_chars[(g_array_index (bcd, guint8, i) >> 4) & 0xF];
if (str[j])
j++;
}
@@ -2637,7 +2640,7 @@ get_cell_location_info_ready (QmiClientNas *client,
GArray *array;
GArray *array2;
- const gchar *operator;
+ GArray *operator;
guint32 cell_id;
guint16 lac;
@@ -2689,7 +2692,7 @@ get_cell_location_info_ready (QmiClientNas *client,
qmi_device_get_path_display (ctx->device));
array = NULL;
- if (qmi_message_nas_get_cell_location_info_output_get_geran_info (
+ if (qmi_message_nas_get_cell_location_info_output_get_geran_info_v2 (
output,
&cell_id,
&operator,
@@ -2742,9 +2745,9 @@ get_cell_location_info_ready (QmiClientNas *client,
for (i = 0; i < array->len; i++) {
- QmiMessageNasGetCellLocationInfoOutputGeranInfoCellElement *element;
+ QmiMessageNasGetCellLocationInfoOutputGeranInfoV2CellElement *element;
- element = &g_array_index (array, QmiMessageNasGetCellLocationInfoOutputGeranInfoCellElement, i);
+ element = &g_array_index (array, QmiMessageNasGetCellLocationInfoOutputGeranInfoV2CellElement, i);
g_print ("\tCell [%u]:\n", i);
if (element->cell_id == 0xFFFFFFFF)
@@ -2783,7 +2786,7 @@ get_cell_location_info_ready (QmiClientNas *client,
array = NULL;
array2 = NULL;
- if (qmi_message_nas_get_cell_location_info_output_get_umts_info (
+ if (qmi_message_nas_get_cell_location_info_output_get_umts_info_v2 (
output,
&cell_id_16,
&operator,
@@ -2884,7 +2887,7 @@ get_cell_location_info_ready (QmiClientNas *client,
}
array = NULL;
- if (qmi_message_nas_get_cell_location_info_output_get_intrafrequency_lte_info (
+ if (qmi_message_nas_get_cell_location_info_output_get_intrafrequency_lte_info_v2 (
output,
&ue_in_idle,
&operator,