diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2022-01-02 15:52:43 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2022-01-18 09:00:10 +0000 |
commit | e682b8a4995aa498ffe398692288e476c1b2187e (patch) | |
tree | a323e9adc826c779921b2f45514ee42c25bcd819 | |
parent | b5a5d58650f168423c14fa3246c8ce9137c2e0da (diff) |
libmm-glib,cell-info-tdscdma: new 'MMCellInfoTdscdma' object
Implementing support for TDSCDMA cell info.
-rw-r--r-- | docs/reference/libmm-glib/libmm-glib-docs.xml | 1 | ||||
-rw-r--r-- | docs/reference/libmm-glib/libmm-glib-sections.txt | 35 | ||||
-rw-r--r-- | libmm-glib/Makefile.am | 3 | ||||
-rw-r--r-- | libmm-glib/libmm-glib.h | 1 | ||||
-rw-r--r-- | libmm-glib/meson.build | 2 | ||||
-rw-r--r-- | libmm-glib/mm-cell-info-tdscdma.c | 407 | ||||
-rw-r--r-- | libmm-glib/mm-cell-info-tdscdma.h | 107 | ||||
-rw-r--r-- | libmm-glib/mm-cell-info.c | 7 |
8 files changed, 561 insertions, 2 deletions
diff --git a/docs/reference/libmm-glib/libmm-glib-docs.xml b/docs/reference/libmm-glib/libmm-glib-docs.xml index e84a6088..3a3f5bd7 100644 --- a/docs/reference/libmm-glib/libmm-glib-docs.xml +++ b/docs/reference/libmm-glib/libmm-glib-docs.xml @@ -96,6 +96,7 @@ <xi:include href="xml/mm-cell-info-cdma.xml"/> <xi:include href="xml/mm-cell-info-gsm.xml"/> <xi:include href="xml/mm-cell-info-umts.xml"/> + <xi:include href="xml/mm-cell-info-tdscdma.xml"/> <xi:include href="xml/mm-pco.xml"/> <xi:include href="xml/mm-nr5g-registration-settings.xml"/> </section> diff --git a/docs/reference/libmm-glib/libmm-glib-sections.txt b/docs/reference/libmm-glib/libmm-glib-sections.txt index f64b9927..68088afe 100644 --- a/docs/reference/libmm-glib/libmm-glib-sections.txt +++ b/docs/reference/libmm-glib/libmm-glib-sections.txt @@ -410,6 +410,41 @@ mm_cell_info_umts_get_type </SECTION> <SECTION> +<FILE>mm-cell-info-tdscdma</FILE> +<TITLE>MMCellInfoTdscdma</TITLE> +MMCellInfoTdscdma +<SUBSECTION Getters> +mm_cell_info_tdscdma_get_operator_id +mm_cell_info_tdscdma_get_lac +mm_cell_info_tdscdma_get_ci +mm_cell_info_tdscdma_get_uarfcn +mm_cell_info_tdscdma_get_cell_parameter_id +mm_cell_info_tdscdma_get_timing_advance +mm_cell_info_tdscdma_get_rscp +mm_cell_info_tdscdma_get_path_loss +<SUBSECTION Private> +mm_cell_info_tdscdma_new_from_dictionary +mm_cell_info_tdscdma_set_operator_id +mm_cell_info_tdscdma_set_lac +mm_cell_info_tdscdma_set_ci +mm_cell_info_tdscdma_set_uarfcn +mm_cell_info_tdscdma_set_cell_parameter_id +mm_cell_info_tdscdma_set_timing_advance +mm_cell_info_tdscdma_set_rscp +mm_cell_info_tdscdma_set_path_loss +<SUBSECTION Standard> +MMCellInfoTdscdmaClass +MMCellInfoTdscdmaPrivate +MM_IS_CELL_INFO_TDSCDMA +MM_IS_CELL_INFO_TDSCDMA_CLASS +MM_TYPE_CELL_INFO_TDSCDMA +MM_CELL_INFO_TDSCDMA +MM_CELL_INFO_TDSCDMA_CLASS +MM_CELL_INFO_TDSCDMA_GET_CLASS +mm_cell_info_tdscdma_get_type +</SECTION> + +<SECTION> <FILE>mm-modem-3gpp</FILE> <TITLE>MMModem3gpp</TITLE> MMModem3gpp diff --git a/libmm-glib/Makefile.am b/libmm-glib/Makefile.am index eaec44f9..e5f76380 100644 --- a/libmm-glib/Makefile.am +++ b/libmm-glib/Makefile.am @@ -109,6 +109,8 @@ libmm_glib_la_SOURCES = \ mm-cell-info-gsm.c \ mm-cell-info-umts.h \ mm-cell-info-umts.c \ + mm-cell-info-tdscdma.h \ + mm-cell-info-tdscdma.c \ mm-compat.h \ mm-compat.c \ $(NULL) @@ -192,6 +194,7 @@ include_HEADERS = \ mm-cell-info-cdma.h \ mm-cell-info-gsm.h \ mm-cell-info-umts.h \ + mm-cell-info-tdscdma.h \ mm-compat.h \ $(NULL) diff --git a/libmm-glib/libmm-glib.h b/libmm-glib/libmm-glib.h index d1de9a8b..bdd5a2fc 100644 --- a/libmm-glib/libmm-glib.h +++ b/libmm-glib/libmm-glib.h @@ -90,6 +90,7 @@ #include <mm-cell-info-cdma.h> #include <mm-cell-info-gsm.h> #include <mm-cell-info-umts.h> +#include <mm-cell-info-tdscdma.h> #include <mm-compat.h> /* generated */ diff --git a/libmm-glib/meson.build b/libmm-glib/meson.build index d2e8f917..1de8e9e9 100644 --- a/libmm-glib/meson.build +++ b/libmm-glib/meson.build @@ -19,6 +19,7 @@ headers = files( 'mm-cell-info.h', 'mm-cell-info-cdma.h', 'mm-cell-info-gsm.h', + 'mm-cell-info-tdscdma.h', 'mm-cell-info-umts.h', 'mm-compat.h', 'mm-firmware-properties.h', @@ -78,6 +79,7 @@ sources = files( 'mm-cell-info.c', 'mm-cell-info-cdma.c', 'mm-cell-info-gsm.c', + 'mm-cell-info-tdscdma.c', 'mm-cell-info-umts.c', 'mm-common-helpers.c', 'mm-compat.c', diff --git a/libmm-glib/mm-cell-info-tdscdma.c b/libmm-glib/mm-cell-info-tdscdma.c new file mode 100644 index 00000000..dcf16e69 --- /dev/null +++ b/libmm-glib/mm-cell-info-tdscdma.c @@ -0,0 +1,407 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * libmm-glib -- Access modem status & information from glib applications + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + * Copyright (C) 2021 Aleksander Morgado <aleksander@aleksander.es> + */ + +#include "mm-helpers.h" +#include "mm-cell-info-tdscdma.h" + +/** + * SECTION: mm-cell-info-tdscdma + * @title: MMCellInfoTdscdma + * @short_description: Helper object to report TDSCDMA cell info + * + * The #MMCellInfoTdscdma is an object used to report TDSCDMA cell + * information. + * + * The object inherits from the generic #MMCellInfo. + */ + +G_DEFINE_TYPE (MMCellInfoTdscdma, mm_cell_info_tdscdma, MM_TYPE_CELL_INFO) + +#define PROPERTY_OPERATOR_ID "operator-id" +#define PROPERTY_LAC "lac" +#define PROPERTY_CI "ci" +#define PROPERTY_UARFCN "uarfcn" +#define PROPERTY_CELL_PARAMETER_ID "cell-parameter-id" +#define PROPERTY_TIMING_ADVANCE "timing-advance" +#define PROPERTY_RSCP "rscp" +#define PROPERTY_PATH_LOSS "path-loss" + +struct _MMCellInfoTdscdmaPrivate { + gchar *operator_id; + gchar *lac; + gchar *ci; + guint uarfcn; + guint cell_parameter_id; + guint timing_advance; + gdouble rscp; + guint path_loss; +}; + +/*****************************************************************************/ + +/** + * mm_cell_info_tdscdma_get_operator_id: + * @self: a #MMCellInfoTdscdma. + * + * Get the PLMN MCC/MNC. + * + * Returns: (transfer none): the MCCMNC, or %NULL if not available. + * + * Since: 1.20 + */ +const gchar * +mm_cell_info_tdscdma_get_operator_id (MMCellInfoTdscdma *self) +{ + g_return_val_if_fail (MM_IS_CELL_INFO_TDSCDMA (self), NULL); + + RETURN_NON_EMPTY_CONSTANT_STRING (self->priv->operator_id); +} + +/** + * mm_cell_info_tdscdma_set_operator_id: (skip) + */ +void +mm_cell_info_tdscdma_set_operator_id (MMCellInfoTdscdma *self, + const gchar *operator_id) +{ + g_free (self->priv->operator_id); + self->priv->operator_id = g_strdup (operator_id); +} + +/** + * mm_cell_info_tdscdma_get_lac: + * @self: a #MMCellInfoTdscdma. + * + * Get the two-byte Location Area Code of the base station. + * + * Encoded in upper-case hexadecimal format without leading zeros, + * as specified in 3GPP TS 27.007. + * + * Returns: (transfer none): the MCCMNC, or %NULL if not available. + * + * Since: 1.20 + */ +const gchar * +mm_cell_info_tdscdma_get_lac (MMCellInfoTdscdma *self) +{ + g_return_val_if_fail (MM_IS_CELL_INFO_TDSCDMA (self), NULL); + + RETURN_NON_EMPTY_CONSTANT_STRING (self->priv->lac); +} + +/** + * mm_cell_info_tdscdma_set_lac: (skip) + */ +void +mm_cell_info_tdscdma_set_lac (MMCellInfoTdscdma *self, + const gchar *lac) +{ + g_free (self->priv->lac); + self->priv->lac = g_strdup (lac); +} + +/** + * mm_cell_info_tdscdma_get_ci: + * @self: a #MMCellInfoTdscdma. + * + * Get the two- or four-byte Cell Identifier. + * + * Encoded in upper-case hexadecimal format without leading zeros, + * as specified in 3GPP TS 27.007. + * + * Returns: (transfer none): the MCCMNC, or %NULL if not available. + * + * Since: 1.20 + */ +const gchar * +mm_cell_info_tdscdma_get_ci (MMCellInfoTdscdma *self) +{ + g_return_val_if_fail (MM_IS_CELL_INFO_TDSCDMA (self), NULL); + + RETURN_NON_EMPTY_CONSTANT_STRING (self->priv->ci); +} + +/** + * mm_cell_info_tdscdma_set_ci: (skip) + */ +void +mm_cell_info_tdscdma_set_ci (MMCellInfoTdscdma *self, + const gchar *ci) +{ + g_free (self->priv->ci); + self->priv->ci = g_strdup (ci); +} + +/** + * mm_cell_info_tdscdma_get_uarfcn: + * @self: a #MMCellInfoTdscdma. + * + * Get the UTRA absolute RF channel number. + * + * Returns: the UARFCN, or %G_MAXUINT if not available. + * + * Since: 1.20 + */ +guint +mm_cell_info_tdscdma_get_uarfcn (MMCellInfoTdscdma *self) +{ + g_return_val_if_fail (MM_IS_CELL_INFO_TDSCDMA (self), G_MAXUINT); + + return self->priv->uarfcn; +} + +/** + * mm_cell_info_tdscdma_set_uarfcn: (skip) + */ +void +mm_cell_info_tdscdma_set_uarfcn (MMCellInfoTdscdma *self, + guint uarfcn) +{ + self->priv->uarfcn = uarfcn; +} + +/** + * mm_cell_info_tdscdma_get_cell_parameter_id: + * @self: a #MMCellInfoTdscdma. + * + * Get the cell parameter id. + * + * Returns: the cell parameter id, or %G_MAXUINT if not available. + * + * Since: 1.20 + */ +guint +mm_cell_info_tdscdma_get_cell_parameter_id (MMCellInfoTdscdma *self) +{ + g_return_val_if_fail (MM_IS_CELL_INFO_TDSCDMA (self), G_MAXUINT); + + return self->priv->cell_parameter_id; +} + +/** + * mm_cell_info_tdscdma_set_cell_parameter_id: (skip) + */ +void +mm_cell_info_tdscdma_set_cell_parameter_id (MMCellInfoTdscdma *self, + guint cell_parameter_id) +{ + self->priv->cell_parameter_id = cell_parameter_id; +} + +/** + * mm_cell_info_tdscdma_get_timing_advance: + * @self: a #MMCellInfoTdscdma. + * + * Get the measured delay (in bit periods) of an access burst transmission + * on the RACH or PRACH to the expected signal from a mobile station at zero + * distance under static channel conditions. + * + * Returns: the timing advance, or %G_MAXUINT if not available. + * + * Since: 1.20 + */ +guint +mm_cell_info_tdscdma_get_timing_advance (MMCellInfoTdscdma *self) +{ + g_return_val_if_fail (MM_IS_CELL_INFO_TDSCDMA (self), G_MAXUINT); + + return self->priv->timing_advance; +} + +/** + * mm_cell_info_tdscdma_set_timing_advance: (skip) + */ +void +mm_cell_info_tdscdma_set_timing_advance (MMCellInfoTdscdma *self, + guint timing_advance) +{ + self->priv->timing_advance = timing_advance; +} + +/** + * mm_cell_info_tdscdma_get_rscp: + * @self: a #MMCellInfoTdscdma. + * + * Get the received signal code power. + * + * Returns: the RSCP, or -%G_MAXDOUBLE if not available. + * + * Since: 1.20 + */ +gdouble +mm_cell_info_tdscdma_get_rscp (MMCellInfoTdscdma *self) +{ + g_return_val_if_fail (MM_IS_CELL_INFO_TDSCDMA (self), -G_MAXDOUBLE); + + return self->priv->rscp; +} + +/** + * mm_cell_info_tdscdma_set_rscp: (skip) + */ +void +mm_cell_info_tdscdma_set_rscp (MMCellInfoTdscdma *self, + gdouble rscp) +{ + self->priv->rscp = rscp; +} + +/** + * mm_cell_info_tdscdma_get_path_loss: + * @self: a #MMCellInfoTdscdma. + * + * Get the path loss of the cell. + * + * Returns: the path loss, or %G_MAXUINT if not available. + * + * Since: 1.20 + */ +guint +mm_cell_info_tdscdma_get_path_loss (MMCellInfoTdscdma *self) +{ + g_return_val_if_fail (MM_IS_CELL_INFO_TDSCDMA (self), G_MAXUINT); + + return self->priv->path_loss; +} + +/** + * mm_cell_info_tdscdma_set_path_loss: (skip) + */ +void +mm_cell_info_tdscdma_set_path_loss (MMCellInfoTdscdma *self, + guint path_loss) +{ + self->priv->path_loss = path_loss; +} + +/*****************************************************************************/ + +static GString * +build_string (MMCellInfo *_self) +{ + MMCellInfoTdscdma *self = MM_CELL_INFO_TDSCDMA (_self); + GString *str; + + str = g_string_new (NULL); + + MM_CELL_INFO_BUILD_STRING_APPEND ("operator id", "%s", operator_id, NULL); + MM_CELL_INFO_BUILD_STRING_APPEND ("lac", "%s", lac, NULL); + MM_CELL_INFO_BUILD_STRING_APPEND ("ci", "%s", ci, NULL); + MM_CELL_INFO_BUILD_STRING_APPEND ("uarfcn", "%u", uarfcn, G_MAXUINT); + MM_CELL_INFO_BUILD_STRING_APPEND ("cell parameter id", "%u", cell_parameter_id, G_MAXUINT); + MM_CELL_INFO_BUILD_STRING_APPEND ("timing advance", "%u", timing_advance, G_MAXUINT); + MM_CELL_INFO_BUILD_STRING_APPEND ("rscp", "%lf", rscp, -G_MAXDOUBLE); + MM_CELL_INFO_BUILD_STRING_APPEND ("path loss", "%u", path_loss, G_MAXUINT); + + return str; +} + +/*****************************************************************************/ + +/** + * mm_cell_info_tdscdma_get_dictionary: (skip) + */ +static GVariantDict * +get_dictionary (MMCellInfo *_self) +{ + MMCellInfoTdscdma *self = MM_CELL_INFO_TDSCDMA (_self); + GVariantDict *dict; + + dict = g_variant_dict_new (NULL); + + MM_CELL_INFO_GET_DICTIONARY_INSERT (OPERATOR_ID, operator_id, string, NULL); + MM_CELL_INFO_GET_DICTIONARY_INSERT (LAC, lac, string, NULL); + MM_CELL_INFO_GET_DICTIONARY_INSERT (CI, ci, string, NULL); + MM_CELL_INFO_GET_DICTIONARY_INSERT (UARFCN, uarfcn, uint32, G_MAXUINT); + MM_CELL_INFO_GET_DICTIONARY_INSERT (CELL_PARAMETER_ID, cell_parameter_id, uint32, G_MAXUINT); + MM_CELL_INFO_GET_DICTIONARY_INSERT (TIMING_ADVANCE, timing_advance, uint32, G_MAXUINT); + MM_CELL_INFO_GET_DICTIONARY_INSERT (RSCP, rscp, double, -G_MAXDOUBLE); + MM_CELL_INFO_GET_DICTIONARY_INSERT (PATH_LOSS, path_loss, uint32, G_MAXUINT); + + return dict; +} + +/*****************************************************************************/ + +/** + * mm_cell_info_tdscdma_new_from_dictionary: (skip) + */ +MMCellInfo * +mm_cell_info_tdscdma_new_from_dictionary (GVariantDict *dict) +{ + MMCellInfoTdscdma *self; + + self = MM_CELL_INFO_TDSCDMA (g_object_new (MM_TYPE_CELL_INFO_TDSCDMA, NULL)); + + if (dict) { + MM_CELL_INFO_NEW_FROM_DICTIONARY_STRING_SET (tdscdma, OPERATOR_ID, operator_id); + MM_CELL_INFO_NEW_FROM_DICTIONARY_STRING_SET (tdscdma, LAC, lac); + MM_CELL_INFO_NEW_FROM_DICTIONARY_STRING_SET (tdscdma, CI, ci); + + MM_CELL_INFO_NEW_FROM_DICTIONARY_NUM_SET (tdscdma, UARFCN, uarfcn, UINT32, uint32); + MM_CELL_INFO_NEW_FROM_DICTIONARY_NUM_SET (tdscdma, CELL_PARAMETER_ID, cell_parameter_id, UINT32, uint32); + MM_CELL_INFO_NEW_FROM_DICTIONARY_NUM_SET (tdscdma, TIMING_ADVANCE, timing_advance, UINT32, uint32); + MM_CELL_INFO_NEW_FROM_DICTIONARY_NUM_SET (tdscdma, RSCP, rscp, DOUBLE, double); + MM_CELL_INFO_NEW_FROM_DICTIONARY_NUM_SET (tdscdma, PATH_LOSS, path_loss, UINT32, uint32); + } + + return MM_CELL_INFO (self); +} + +/*****************************************************************************/ + +static void +mm_cell_info_tdscdma_init (MMCellInfoTdscdma *self) +{ + self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_CELL_INFO_TDSCDMA, MMCellInfoTdscdmaPrivate); + self->priv->uarfcn = G_MAXUINT; + self->priv->cell_parameter_id = G_MAXUINT; + self->priv->timing_advance = G_MAXUINT; + self->priv->rscp = -G_MAXDOUBLE; + self->priv->path_loss = G_MAXUINT; +} + +static void +finalize (GObject *object) +{ + MMCellInfoTdscdma *self = MM_CELL_INFO_TDSCDMA (object); + + g_free (self->priv->operator_id); + g_free (self->priv->lac); + g_free (self->priv->ci); + + G_OBJECT_CLASS (mm_cell_info_tdscdma_parent_class)->finalize (object); +} + +static void +mm_cell_info_tdscdma_class_init (MMCellInfoTdscdmaClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + MMCellInfoClass *cell_info_class = MM_CELL_INFO_CLASS (klass); + + g_type_class_add_private (object_class, sizeof (MMCellInfoTdscdmaPrivate)); + + object_class->finalize = finalize; + cell_info_class->get_dictionary = get_dictionary; + cell_info_class->build_string = build_string; + +} diff --git a/libmm-glib/mm-cell-info-tdscdma.h b/libmm-glib/mm-cell-info-tdscdma.h new file mode 100644 index 00000000..098a6be4 --- /dev/null +++ b/libmm-glib/mm-cell-info-tdscdma.h @@ -0,0 +1,107 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * libmm-glib -- Access modem status & information from glib applications + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + * Copyright (C) 2022 Aleksander Morgado <aleksander@aleksander.es> + */ + +#ifndef MM_CELL_INFO_TDSCDMA_H +#define MM_CELL_INFO_TDSCDMA_H + +#if !defined (__LIBMM_GLIB_H_INSIDE__) && !defined (LIBMM_GLIB_COMPILATION) +#error "Only <libmm-glib.h> can be included directly." +#endif + +#include <ModemManager.h> +#include <glib-object.h> + +#include "mm-cell-info.h" + +G_BEGIN_DECLS + +#define MM_TYPE_CELL_INFO_TDSCDMA (mm_cell_info_tdscdma_get_type ()) +#define MM_CELL_INFO_TDSCDMA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_CELL_INFO_TDSCDMA, MMCellInfoTdscdma)) +#define MM_CELL_INFO_TDSCDMA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_CELL_INFO_TDSCDMA, MMCellInfoTdscdmaClass)) +#define MM_IS_CELL_INFO_TDSCDMA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_CELL_INFO_TDSCDMA)) +#define MM_IS_CELL_INFO_TDSCDMA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_CELL_INFO_TDSCDMA)) +#define MM_CELL_INFO_TDSCDMA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_CELL_INFO_TDSCDMA, MMCellInfoTdscdmaClass)) + +typedef struct _MMCellInfoTdscdma MMCellInfoTdscdma; +typedef struct _MMCellInfoTdscdmaClass MMCellInfoTdscdmaClass; +typedef struct _MMCellInfoTdscdmaPrivate MMCellInfoTdscdmaPrivate; + +/** + * MMCellInfoTdscdma: + * + * The #MMCellInfoTdscdma structure contains private data and should only be + * accessed using the provided API. + */ +struct _MMCellInfoTdscdma { + /*< private >*/ + MMCellInfo parent; + MMCellInfoTdscdmaPrivate *priv; +}; + +struct _MMCellInfoTdscdmaClass { + /*< private >*/ + MMCellInfoClass parent; +}; + +GType mm_cell_info_tdscdma_get_type (void); +G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMCellInfoTdscdma, g_object_unref) + +const gchar *mm_cell_info_tdscdma_get_operator_id (MMCellInfoTdscdma *self); +const gchar *mm_cell_info_tdscdma_get_lac (MMCellInfoTdscdma *self); +const gchar *mm_cell_info_tdscdma_get_ci (MMCellInfoTdscdma *self); +guint mm_cell_info_tdscdma_get_uarfcn (MMCellInfoTdscdma *self); +guint mm_cell_info_tdscdma_get_cell_parameter_id (MMCellInfoTdscdma *self); +guint mm_cell_info_tdscdma_get_timing_advance (MMCellInfoTdscdma *self); +gdouble mm_cell_info_tdscdma_get_rscp (MMCellInfoTdscdma *self); +guint mm_cell_info_tdscdma_get_path_loss (MMCellInfoTdscdma *self); + +/*****************************************************************************/ +/* ModemManager/libmm-glib/mmcli specific methods */ + +#if defined (_LIBMM_INSIDE_MM) || \ + defined (_LIBMM_INSIDE_MMCLI) || \ + defined (LIBMM_GLIB_COMPILATION) + +void mm_cell_info_tdscdma_set_operator_id (MMCellInfoTdscdma *self, + const gchar *operator_id); +void mm_cell_info_tdscdma_set_lac (MMCellInfoTdscdma *self, + const gchar *lac); +void mm_cell_info_tdscdma_set_ci (MMCellInfoTdscdma *self, + const gchar *ci); +void mm_cell_info_tdscdma_set_uarfcn (MMCellInfoTdscdma *self, + guint uarfcn); +void mm_cell_info_tdscdma_set_cell_parameter_id (MMCellInfoTdscdma *self, + guint cell_parameter_id); +void mm_cell_info_tdscdma_set_timing_advance (MMCellInfoTdscdma *self, + guint timing_advance); +void mm_cell_info_tdscdma_set_rscp (MMCellInfoTdscdma *self, + gdouble rscp); +void mm_cell_info_tdscdma_set_path_loss (MMCellInfoTdscdma *self, + guint path_loss); + +MMCellInfo *mm_cell_info_tdscdma_new_from_dictionary (GVariantDict *dict); + +#endif + +G_END_DECLS + +#endif /* MM_CELL_INFO_TDSCDMA_H */ diff --git a/libmm-glib/mm-cell-info.c b/libmm-glib/mm-cell-info.c index 5db79268..96597620 100644 --- a/libmm-glib/mm-cell-info.c +++ b/libmm-glib/mm-cell-info.c @@ -24,6 +24,7 @@ #include "mm-cell-info-cdma.h" #include "mm-cell-info-gsm.h" #include "mm-cell-info-umts.h" +#include "mm-cell-info-tdscdma.h" #include "mm-enums-types.h" #include "mm-errors-types.h" @@ -63,8 +64,8 @@ ensure_cell_type (MMCellInfo *self) self->priv->cell_type = MM_CELL_TYPE_GSM; else if (MM_IS_CELL_INFO_UMTS (self)) self->priv->cell_type = MM_CELL_TYPE_UMTS; - - /* MM_CELL_TYPE_TDSCDMA; */ + else if (MM_IS_CELL_INFO_TDSCDMA (self)) + self->priv->cell_type = MM_CELL_TYPE_TDSCDMA; /* MM_CELL_TYPE_LTE; */ /* MM_CELL_TYPE_5GNR; */ } @@ -170,6 +171,8 @@ mm_cell_info_new_from_dictionary (GVariant *dictionary, self = mm_cell_info_umts_new_from_dictionary (dict); break; case MM_CELL_TYPE_TDSCDMA: + self = mm_cell_info_tdscdma_new_from_dictionary (dict); + break; case MM_CELL_TYPE_LTE: case MM_CELL_TYPE_5GNR: default: |