libmm-glib,cell-info-umts: new 'MMCellInfoUmts' object
Implementing support for UMTS cell info.
This commit is contained in:
@@ -95,6 +95,7 @@
|
||||
<xi:include href="xml/mm-cell-info.xml"/>
|
||||
<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-pco.xml"/>
|
||||
<xi:include href="xml/mm-nr5g-registration-settings.xml"/>
|
||||
</section>
|
||||
|
@@ -340,13 +340,13 @@ mm_cell_info_cdma_get_type
|
||||
<TITLE>MMCellInfoGsm</TITLE>
|
||||
MMCellInfoGsm
|
||||
<SUBSECTION Getters>
|
||||
mm_cell_info_gsm_gsm_get_operator_id
|
||||
mm_cell_info_gsm_gsm_get_lac
|
||||
mm_cell_info_gsm_gsm_get_ci
|
||||
mm_cell_info_gsm_gsm_get_timing_advance
|
||||
mm_cell_info_gsm_gsm_get_arfcn
|
||||
mm_cell_info_gsm_gsm_get_base_station_id
|
||||
mm_cell_info_gsm_gsm_get_rx_level
|
||||
mm_cell_info_gsm_get_operator_id
|
||||
mm_cell_info_gsm_get_lac
|
||||
mm_cell_info_gsm_get_ci
|
||||
mm_cell_info_gsm_get_timing_advance
|
||||
mm_cell_info_gsm_get_arfcn
|
||||
mm_cell_info_gsm_get_base_station_id
|
||||
mm_cell_info_gsm_get_rx_level
|
||||
<SUBSECTION Private>
|
||||
mm_cell_info_gsm_new_from_dictionary
|
||||
mm_cell_info_gsm_set_operator_id
|
||||
@@ -368,6 +368,47 @@ MM_CELL_INFO_GSM_GET_CLASS
|
||||
mm_cell_info_gsm_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>mm-cell-info-umts</FILE>
|
||||
<TITLE>MMCellInfoUmts</TITLE>
|
||||
MMCellInfoUmts
|
||||
<SUBSECTION Getters>
|
||||
mm_cell_info_umts_get_operator_id
|
||||
mm_cell_info_umts_get_lac
|
||||
mm_cell_info_umts_get_ci
|
||||
mm_cell_info_umts_get_frequency_fdd_ul
|
||||
mm_cell_info_umts_get_frequency_fdd_dl
|
||||
mm_cell_info_umts_get_frequency_tdd
|
||||
mm_cell_info_umts_get_uarfcn
|
||||
mm_cell_info_umts_get_psc
|
||||
mm_cell_info_umts_get_rscp
|
||||
mm_cell_info_umts_get_ecio
|
||||
mm_cell_info_umts_get_path_loss
|
||||
<SUBSECTION Private>
|
||||
mm_cell_info_umts_new_from_dictionary
|
||||
mm_cell_info_umts_set_operator_id
|
||||
mm_cell_info_umts_set_lac
|
||||
mm_cell_info_umts_set_ci
|
||||
mm_cell_info_umts_set_frequency_fdd_ul
|
||||
mm_cell_info_umts_set_frequency_fdd_dl
|
||||
mm_cell_info_umts_set_frequency_tdd
|
||||
mm_cell_info_umts_set_uarfcn
|
||||
mm_cell_info_umts_set_psc
|
||||
mm_cell_info_umts_set_rscp
|
||||
mm_cell_info_umts_set_ecio
|
||||
mm_cell_info_umts_set_path_loss
|
||||
<SUBSECTION Standard>
|
||||
MMCellInfoUmtsClass
|
||||
MMCellInfoUmtsPrivate
|
||||
MM_IS_CELL_INFO_UMTS
|
||||
MM_IS_CELL_INFO_UMTS_CLASS
|
||||
MM_TYPE_CELL_INFO_UMTS
|
||||
MM_CELL_INFO_UMTS
|
||||
MM_CELL_INFO_UMTS_CLASS
|
||||
MM_CELL_INFO_UMTS_GET_CLASS
|
||||
mm_cell_info_umts_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>mm-modem-3gpp</FILE>
|
||||
<TITLE>MMModem3gpp</TITLE>
|
||||
|
@@ -107,6 +107,8 @@ libmm_glib_la_SOURCES = \
|
||||
mm-cell-info-cdma.c \
|
||||
mm-cell-info-gsm.h \
|
||||
mm-cell-info-gsm.c \
|
||||
mm-cell-info-umts.h \
|
||||
mm-cell-info-umts.c \
|
||||
mm-compat.h \
|
||||
mm-compat.c \
|
||||
$(NULL)
|
||||
@@ -189,6 +191,7 @@ include_HEADERS = \
|
||||
mm-cell-info.h \
|
||||
mm-cell-info-cdma.h \
|
||||
mm-cell-info-gsm.h \
|
||||
mm-cell-info-umts.h \
|
||||
mm-compat.h \
|
||||
$(NULL)
|
||||
|
||||
|
@@ -89,6 +89,7 @@
|
||||
#include <mm-cell-info.h>
|
||||
#include <mm-cell-info-cdma.h>
|
||||
#include <mm-cell-info-gsm.h>
|
||||
#include <mm-cell-info-umts.h>
|
||||
#include <mm-compat.h>
|
||||
|
||||
/* generated */
|
||||
|
@@ -19,6 +19,7 @@ headers = files(
|
||||
'mm-cell-info.h',
|
||||
'mm-cell-info-cdma.h',
|
||||
'mm-cell-info-gsm.h',
|
||||
'mm-cell-info-umts.h',
|
||||
'mm-compat.h',
|
||||
'mm-firmware-properties.h',
|
||||
'mm-firmware-update-settings.h',
|
||||
@@ -77,6 +78,7 @@ sources = files(
|
||||
'mm-cell-info.c',
|
||||
'mm-cell-info-cdma.c',
|
||||
'mm-cell-info-gsm.c',
|
||||
'mm-cell-info-umts.c',
|
||||
'mm-common-helpers.c',
|
||||
'mm-compat.c',
|
||||
'mm-firmware-properties.c',
|
||||
|
509
libmm-glib/mm-cell-info-umts.c
Normal file
509
libmm-glib/mm-cell-info-umts.c
Normal file
@@ -0,0 +1,509 @@
|
||||
/* -*- 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>
|
||||
*/
|
||||
|
||||
#include "mm-helpers.h"
|
||||
#include "mm-cell-info-umts.h"
|
||||
|
||||
/**
|
||||
* SECTION: mm-cell-info-umts
|
||||
* @title: MMCellInfoUmts
|
||||
* @short_description: Helper object to report UMTS cell info
|
||||
*
|
||||
* The #MMCellInfoUmts is an object used to report UMTS cell
|
||||
* information.
|
||||
*
|
||||
* The object inherits from the generic #MMCellInfo.
|
||||
*/
|
||||
|
||||
G_DEFINE_TYPE (MMCellInfoUmts, mm_cell_info_umts, MM_TYPE_CELL_INFO)
|
||||
|
||||
#define PROPERTY_OPERATOR_ID "operator-id"
|
||||
#define PROPERTY_LAC "lac"
|
||||
#define PROPERTY_CI "ci"
|
||||
#define PROPERTY_FREQUENCY_FDD_UL "frequency-fdd-ul"
|
||||
#define PROPERTY_FREQUENCY_FDD_DL "frequency-fdd-dl"
|
||||
#define PROPERTY_FREQUENCY_TDD "frequency-tdd"
|
||||
#define PROPERTY_UARFCN "uarfcn"
|
||||
#define PROPERTY_PSC "psc"
|
||||
#define PROPERTY_RSCP "rscp"
|
||||
#define PROPERTY_ECIO "ecio"
|
||||
#define PROPERTY_PATH_LOSS "path-loss"
|
||||
|
||||
struct _MMCellInfoUmtsPrivate {
|
||||
gchar *operator_id;
|
||||
gchar *lac;
|
||||
gchar *ci;
|
||||
guint frequency_fdd_ul;
|
||||
guint frequency_fdd_dl;
|
||||
guint frequency_tdd;
|
||||
guint uarfcn;
|
||||
guint psc;
|
||||
gdouble rscp;
|
||||
gdouble ecio;
|
||||
guint path_loss;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_get_operator_id:
|
||||
* @self: a #MMCellInfoUmts.
|
||||
*
|
||||
* Get the PLMN MCC/MNC.
|
||||
*
|
||||
* Returns: (transfer none): the MCCMNC, or %NULL if not available.
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
const gchar *
|
||||
mm_cell_info_umts_get_operator_id (MMCellInfoUmts *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_CELL_INFO_UMTS (self), NULL);
|
||||
|
||||
RETURN_NON_EMPTY_CONSTANT_STRING (self->priv->operator_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_set_operator_id: (skip)
|
||||
*/
|
||||
void
|
||||
mm_cell_info_umts_set_operator_id (MMCellInfoUmts *self,
|
||||
const gchar *operator_id)
|
||||
{
|
||||
g_free (self->priv->operator_id);
|
||||
self->priv->operator_id = g_strdup (operator_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_get_lac:
|
||||
* @self: a #MMCellInfoUmts.
|
||||
*
|
||||
* 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_umts_get_lac (MMCellInfoUmts *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_CELL_INFO_UMTS (self), NULL);
|
||||
|
||||
RETURN_NON_EMPTY_CONSTANT_STRING (self->priv->lac);
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_set_lac: (skip)
|
||||
*/
|
||||
void
|
||||
mm_cell_info_umts_set_lac (MMCellInfoUmts *self,
|
||||
const gchar *lac)
|
||||
{
|
||||
g_free (self->priv->lac);
|
||||
self->priv->lac = g_strdup (lac);
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_get_ci:
|
||||
* @self: a #MMCellInfoUmts.
|
||||
*
|
||||
* 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_umts_get_ci (MMCellInfoUmts *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_CELL_INFO_UMTS (self), NULL);
|
||||
|
||||
RETURN_NON_EMPTY_CONSTANT_STRING (self->priv->ci);
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_set_ci: (skip)
|
||||
*/
|
||||
void
|
||||
mm_cell_info_umts_set_ci (MMCellInfoUmts *self,
|
||||
const gchar *ci)
|
||||
{
|
||||
g_free (self->priv->ci);
|
||||
self->priv->ci = g_strdup (ci);
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_get_frequency_fdd_ul:
|
||||
* @self: a #MMCellInfoUmts.
|
||||
*
|
||||
* Get the frequency of the uplink in kHz while in FDD.
|
||||
*
|
||||
* Returns: the frequency, or %G_MAXUINT if not available.
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
guint
|
||||
mm_cell_info_umts_get_frequency_fdd_ul (MMCellInfoUmts *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_CELL_INFO_UMTS (self), G_MAXUINT);
|
||||
|
||||
return self->priv->frequency_fdd_ul;
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_set_frequency_fdd_ul: (skip)
|
||||
*/
|
||||
void
|
||||
mm_cell_info_umts_set_frequency_fdd_ul (MMCellInfoUmts *self,
|
||||
guint frequency_fdd_ul)
|
||||
{
|
||||
self->priv->frequency_fdd_ul = frequency_fdd_ul;
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_get_frequency_fdd_dl:
|
||||
* @self: a #MMCellInfoUmts.
|
||||
*
|
||||
* Get the frequency of the downlink in kHz while in FDD.
|
||||
*
|
||||
* Returns: the frequency, or %G_MAXUINT if not available.
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
guint
|
||||
mm_cell_info_umts_get_frequency_fdd_dl (MMCellInfoUmts *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_CELL_INFO_UMTS (self), G_MAXUINT);
|
||||
|
||||
return self->priv->frequency_fdd_dl;
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_set_frequency_fdd_dl: (skip)
|
||||
*/
|
||||
void
|
||||
mm_cell_info_umts_set_frequency_fdd_dl (MMCellInfoUmts *self,
|
||||
guint frequency_fdd_dl)
|
||||
{
|
||||
self->priv->frequency_fdd_dl = frequency_fdd_dl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_get_frequency_tdd:
|
||||
* @self: a #MMCellInfoUmts.
|
||||
*
|
||||
* Get the frequency in kHz while in TDD.
|
||||
*
|
||||
* Returns: the frequency, or %G_MAXUINT if not available.
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
guint
|
||||
mm_cell_info_umts_get_frequency_tdd (MMCellInfoUmts *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_CELL_INFO_UMTS (self), G_MAXUINT);
|
||||
|
||||
return self->priv->frequency_tdd;
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_set_frequency_tdd: (skip)
|
||||
*/
|
||||
void
|
||||
mm_cell_info_umts_set_frequency_tdd (MMCellInfoUmts *self,
|
||||
guint frequency_tdd)
|
||||
{
|
||||
self->priv->frequency_tdd = frequency_tdd;
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_get_uarfcn:
|
||||
* @self: a #MMCellInfoUmts.
|
||||
*
|
||||
* Get the UTRA absolute RF channel number.
|
||||
*
|
||||
* Returns: the UARFCN, or %G_MAXUINT if not available.
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
guint
|
||||
mm_cell_info_umts_get_uarfcn (MMCellInfoUmts *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_CELL_INFO_UMTS (self), G_MAXUINT);
|
||||
|
||||
return self->priv->uarfcn;
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_set_uarfcn: (skip)
|
||||
*/
|
||||
void
|
||||
mm_cell_info_umts_set_uarfcn (MMCellInfoUmts *self,
|
||||
guint uarfcn)
|
||||
{
|
||||
self->priv->uarfcn = uarfcn;
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_get_psc:
|
||||
* @self: a #MMCellInfoUmts.
|
||||
*
|
||||
* Get the primary scrambling code.
|
||||
*
|
||||
* Returns: the PSC, or %G_MAXUINT if not available.
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
guint
|
||||
mm_cell_info_umts_get_psc (MMCellInfoUmts *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_CELL_INFO_UMTS (self), G_MAXUINT);
|
||||
|
||||
return self->priv->psc;
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_set_psc: (skip)
|
||||
*/
|
||||
void
|
||||
mm_cell_info_umts_set_psc (MMCellInfoUmts *self,
|
||||
guint psc)
|
||||
{
|
||||
self->priv->psc = psc;
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_get_rscp:
|
||||
* @self: a #MMCellInfoUmts.
|
||||
*
|
||||
* Get the received signal code power.
|
||||
*
|
||||
* Returns: the RSCP, or -%G_MAXDOUBLE if not available.
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
gdouble
|
||||
mm_cell_info_umts_get_rscp (MMCellInfoUmts *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_CELL_INFO_UMTS (self), -G_MAXDOUBLE);
|
||||
|
||||
return self->priv->rscp;
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_set_rscp: (skip)
|
||||
*/
|
||||
void
|
||||
mm_cell_info_umts_set_rscp (MMCellInfoUmts *self,
|
||||
gdouble rscp)
|
||||
{
|
||||
self->priv->rscp = rscp;
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_get_ecio:
|
||||
* @self: a #MMCellInfoUmts.
|
||||
*
|
||||
* Get the ECIO, the received energy per chip divided by the power density
|
||||
* in the band measured in dBm on the primary CPICH channel of the cell.
|
||||
*
|
||||
* Returns: the ECIO, or -%G_MAXDOUBLE if not available.
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
gdouble
|
||||
mm_cell_info_umts_get_ecio (MMCellInfoUmts *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_CELL_INFO_UMTS (self), -G_MAXDOUBLE);
|
||||
|
||||
return self->priv->ecio;
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_set_ecio: (skip)
|
||||
*/
|
||||
void
|
||||
mm_cell_info_umts_set_ecio (MMCellInfoUmts *self,
|
||||
gdouble ecio)
|
||||
{
|
||||
self->priv->ecio = ecio;
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_get_path_loss:
|
||||
* @self: a #MMCellInfoUmts.
|
||||
*
|
||||
* Get the path loss of the cell.
|
||||
*
|
||||
* Returns: the path loss, or %G_MAXUINT if not available.
|
||||
*
|
||||
* Since: 1.20
|
||||
*/
|
||||
guint
|
||||
mm_cell_info_umts_get_path_loss (MMCellInfoUmts *self)
|
||||
{
|
||||
g_return_val_if_fail (MM_IS_CELL_INFO_UMTS (self), G_MAXUINT);
|
||||
|
||||
return self->priv->path_loss;
|
||||
}
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_set_path_loss: (skip)
|
||||
*/
|
||||
void
|
||||
mm_cell_info_umts_set_path_loss (MMCellInfoUmts *self,
|
||||
guint path_loss)
|
||||
{
|
||||
self->priv->path_loss = path_loss;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static GString *
|
||||
build_string (MMCellInfo *_self)
|
||||
{
|
||||
MMCellInfoUmts *self = MM_CELL_INFO_UMTS (_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 ("frequency fdd ul", "%u", frequency_fdd_ul, G_MAXUINT);
|
||||
MM_CELL_INFO_BUILD_STRING_APPEND ("frequency fdd dl", "%u", frequency_fdd_dl, G_MAXUINT);
|
||||
MM_CELL_INFO_BUILD_STRING_APPEND ("frequency tdd", "%u", frequency_tdd, G_MAXUINT);
|
||||
MM_CELL_INFO_BUILD_STRING_APPEND ("uarfcn", "%u", uarfcn, G_MAXUINT);
|
||||
MM_CELL_INFO_BUILD_STRING_APPEND ("psc", "%u", psc, G_MAXUINT);
|
||||
MM_CELL_INFO_BUILD_STRING_APPEND ("rscp", "%lf", rscp, -G_MAXDOUBLE);
|
||||
MM_CELL_INFO_BUILD_STRING_APPEND ("ecio", "%lf", ecio, -G_MAXDOUBLE);
|
||||
MM_CELL_INFO_BUILD_STRING_APPEND ("path loss", "%u", path_loss, G_MAXUINT);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_get_dictionary: (skip)
|
||||
*/
|
||||
static GVariantDict *
|
||||
get_dictionary (MMCellInfo *_self)
|
||||
{
|
||||
MMCellInfoUmts *self = MM_CELL_INFO_UMTS (_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 (FREQUENCY_FDD_UL, frequency_fdd_ul, uint32, G_MAXUINT);
|
||||
MM_CELL_INFO_GET_DICTIONARY_INSERT (FREQUENCY_FDD_DL, frequency_fdd_dl, uint32, G_MAXUINT);
|
||||
MM_CELL_INFO_GET_DICTIONARY_INSERT (FREQUENCY_TDD, frequency_tdd, uint32, G_MAXUINT);
|
||||
MM_CELL_INFO_GET_DICTIONARY_INSERT (UARFCN, uarfcn, uint32, G_MAXUINT);
|
||||
MM_CELL_INFO_GET_DICTIONARY_INSERT (PSC, psc, uint32, G_MAXUINT);
|
||||
MM_CELL_INFO_GET_DICTIONARY_INSERT (RSCP, rscp, double, -G_MAXDOUBLE);
|
||||
MM_CELL_INFO_GET_DICTIONARY_INSERT (ECIO, ecio, double, -G_MAXDOUBLE);
|
||||
MM_CELL_INFO_GET_DICTIONARY_INSERT (PATH_LOSS, path_loss, uint32, G_MAXUINT);
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* mm_cell_info_umts_new_from_dictionary: (skip)
|
||||
*/
|
||||
MMCellInfo *
|
||||
mm_cell_info_umts_new_from_dictionary (GVariantDict *dict)
|
||||
{
|
||||
MMCellInfoUmts *self;
|
||||
|
||||
self = MM_CELL_INFO_UMTS (g_object_new (MM_TYPE_CELL_INFO_UMTS, NULL));
|
||||
|
||||
if (dict) {
|
||||
MM_CELL_INFO_NEW_FROM_DICTIONARY_STRING_SET (umts, OPERATOR_ID, operator_id);
|
||||
MM_CELL_INFO_NEW_FROM_DICTIONARY_STRING_SET (umts, LAC, lac);
|
||||
MM_CELL_INFO_NEW_FROM_DICTIONARY_STRING_SET (umts, CI, ci);
|
||||
|
||||
MM_CELL_INFO_NEW_FROM_DICTIONARY_NUM_SET (umts, FREQUENCY_FDD_UL, frequency_fdd_ul, UINT32, uint32);
|
||||
MM_CELL_INFO_NEW_FROM_DICTIONARY_NUM_SET (umts, FREQUENCY_FDD_DL, frequency_fdd_dl, UINT32, uint32);
|
||||
MM_CELL_INFO_NEW_FROM_DICTIONARY_NUM_SET (umts, FREQUENCY_TDD, frequency_tdd, UINT32, uint32);
|
||||
MM_CELL_INFO_NEW_FROM_DICTIONARY_NUM_SET (umts, UARFCN, uarfcn, UINT32, uint32);
|
||||
MM_CELL_INFO_NEW_FROM_DICTIONARY_NUM_SET (umts, PSC, psc, UINT32, uint32);
|
||||
MM_CELL_INFO_NEW_FROM_DICTIONARY_NUM_SET (umts, RSCP, rscp, DOUBLE, double);
|
||||
MM_CELL_INFO_NEW_FROM_DICTIONARY_NUM_SET (umts, ECIO, ecio, DOUBLE, double);
|
||||
MM_CELL_INFO_NEW_FROM_DICTIONARY_NUM_SET (umts, PATH_LOSS, path_loss, UINT32, uint32);
|
||||
}
|
||||
|
||||
return MM_CELL_INFO (self);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static void
|
||||
mm_cell_info_umts_init (MMCellInfoUmts *self)
|
||||
{
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_CELL_INFO_UMTS, MMCellInfoUmtsPrivate);
|
||||
self->priv->frequency_fdd_ul = G_MAXUINT;
|
||||
self->priv->frequency_fdd_dl = G_MAXUINT;
|
||||
self->priv->frequency_tdd = G_MAXUINT;
|
||||
self->priv->uarfcn = G_MAXUINT;
|
||||
self->priv->psc = G_MAXUINT;
|
||||
self->priv->rscp = -G_MAXDOUBLE;
|
||||
self->priv->ecio = -G_MAXDOUBLE;
|
||||
self->priv->path_loss = G_MAXUINT;
|
||||
}
|
||||
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
MMCellInfoUmts *self = MM_CELL_INFO_UMTS (object);
|
||||
|
||||
g_free (self->priv->operator_id);
|
||||
g_free (self->priv->lac);
|
||||
g_free (self->priv->ci);
|
||||
|
||||
G_OBJECT_CLASS (mm_cell_info_umts_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
mm_cell_info_umts_class_init (MMCellInfoUmtsClass *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 (MMCellInfoUmtsPrivate));
|
||||
|
||||
object_class->finalize = finalize;
|
||||
cell_info_class->get_dictionary = get_dictionary;
|
||||
cell_info_class->build_string = build_string;
|
||||
|
||||
}
|
116
libmm-glib/mm-cell-info-umts.h
Normal file
116
libmm-glib/mm-cell-info-umts.h
Normal file
@@ -0,0 +1,116 @@
|
||||
/* -*- 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_UMTS_H
|
||||
#define MM_CELL_INFO_UMTS_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_UMTS (mm_cell_info_umts_get_type ())
|
||||
#define MM_CELL_INFO_UMTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_CELL_INFO_UMTS, MMCellInfoUmts))
|
||||
#define MM_CELL_INFO_UMTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_CELL_INFO_UMTS, MMCellInfoUmtsClass))
|
||||
#define MM_IS_CELL_INFO_UMTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_CELL_INFO_UMTS))
|
||||
#define MM_IS_CELL_INFO_UMTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_CELL_INFO_UMTS))
|
||||
#define MM_CELL_INFO_UMTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_CELL_INFO_UMTS, MMCellInfoUmtsClass))
|
||||
|
||||
typedef struct _MMCellInfoUmts MMCellInfoUmts;
|
||||
typedef struct _MMCellInfoUmtsClass MMCellInfoUmtsClass;
|
||||
typedef struct _MMCellInfoUmtsPrivate MMCellInfoUmtsPrivate;
|
||||
|
||||
/**
|
||||
* MMCellInfoUmts:
|
||||
*
|
||||
* The #MMCellInfoUmts structure contains private data and should only be
|
||||
* accessed using the provided API.
|
||||
*/
|
||||
struct _MMCellInfoUmts {
|
||||
/*< private >*/
|
||||
MMCellInfo parent;
|
||||
MMCellInfoUmtsPrivate *priv;
|
||||
};
|
||||
|
||||
struct _MMCellInfoUmtsClass {
|
||||
/*< private >*/
|
||||
MMCellInfoClass parent;
|
||||
};
|
||||
|
||||
GType mm_cell_info_umts_get_type (void);
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMCellInfoUmts, g_object_unref)
|
||||
|
||||
const gchar *mm_cell_info_umts_get_operator_id (MMCellInfoUmts *self);
|
||||
const gchar *mm_cell_info_umts_get_lac (MMCellInfoUmts *self);
|
||||
const gchar *mm_cell_info_umts_get_ci (MMCellInfoUmts *self);
|
||||
guint mm_cell_info_umts_get_frequency_fdd_ul (MMCellInfoUmts *self);
|
||||
guint mm_cell_info_umts_get_frequency_fdd_dl (MMCellInfoUmts *self);
|
||||
guint mm_cell_info_umts_get_frequency_tdd (MMCellInfoUmts *self);
|
||||
guint mm_cell_info_umts_get_uarfcn (MMCellInfoUmts *self);
|
||||
guint mm_cell_info_umts_get_psc (MMCellInfoUmts *self);
|
||||
gdouble mm_cell_info_umts_get_rscp (MMCellInfoUmts *self);
|
||||
gdouble mm_cell_info_umts_get_ecio (MMCellInfoUmts *self);
|
||||
guint mm_cell_info_umts_get_path_loss (MMCellInfoUmts *self);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* ModemManager/libmm-glib/mmcli specific methods */
|
||||
|
||||
#if defined (_LIBMM_INSIDE_MM) || \
|
||||
defined (_LIBMM_INSIDE_MMCLI) || \
|
||||
defined (LIBMM_GLIB_COMPILATION)
|
||||
|
||||
void mm_cell_info_umts_set_operator_id (MMCellInfoUmts *self,
|
||||
const gchar *operator_id);
|
||||
void mm_cell_info_umts_set_lac (MMCellInfoUmts *self,
|
||||
const gchar *lac);
|
||||
void mm_cell_info_umts_set_ci (MMCellInfoUmts *self,
|
||||
const gchar *ci);
|
||||
void mm_cell_info_umts_set_frequency_fdd_ul (MMCellInfoUmts *self,
|
||||
guint frequency_fdd_ul);
|
||||
void mm_cell_info_umts_set_frequency_fdd_dl (MMCellInfoUmts *self,
|
||||
guint frequency_fdd_ul);
|
||||
void mm_cell_info_umts_set_frequency_tdd (MMCellInfoUmts *self,
|
||||
guint frequency_tdd);
|
||||
void mm_cell_info_umts_set_uarfcn (MMCellInfoUmts *self,
|
||||
guint uarfcn);
|
||||
void mm_cell_info_umts_set_psc (MMCellInfoUmts *self,
|
||||
guint psc);
|
||||
void mm_cell_info_umts_set_rscp (MMCellInfoUmts *self,
|
||||
gdouble rscp);
|
||||
void mm_cell_info_umts_set_ecio (MMCellInfoUmts *self,
|
||||
gdouble ecio);
|
||||
void mm_cell_info_umts_set_path_loss (MMCellInfoUmts *self,
|
||||
guint path_loss);
|
||||
|
||||
MMCellInfo *mm_cell_info_umts_new_from_dictionary (GVariantDict *dict);
|
||||
|
||||
#endif
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* MM_CELL_INFO_UMTS_H */
|
@@ -23,6 +23,7 @@
|
||||
#include "mm-cell-info.h"
|
||||
#include "mm-cell-info-cdma.h"
|
||||
#include "mm-cell-info-gsm.h"
|
||||
#include "mm-cell-info-umts.h"
|
||||
|
||||
#include "mm-enums-types.h"
|
||||
#include "mm-errors-types.h"
|
||||
@@ -60,8 +61,9 @@ ensure_cell_type (MMCellInfo *self)
|
||||
self->priv->cell_type = MM_CELL_TYPE_CDMA;
|
||||
else if (MM_IS_CELL_INFO_GSM (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_UMTS; */
|
||||
/* MM_CELL_TYPE_TDSCDMA; */
|
||||
/* MM_CELL_TYPE_LTE; */
|
||||
/* MM_CELL_TYPE_5GNR; */
|
||||
@@ -165,6 +167,8 @@ mm_cell_info_new_from_dictionary (GVariant *dictionary,
|
||||
self = mm_cell_info_gsm_new_from_dictionary (dict);
|
||||
break;
|
||||
case MM_CELL_TYPE_UMTS:
|
||||
self = mm_cell_info_umts_new_from_dictionary (dict);
|
||||
break;
|
||||
case MM_CELL_TYPE_TDSCDMA:
|
||||
case MM_CELL_TYPE_LTE:
|
||||
case MM_CELL_TYPE_5GNR:
|
||||
|
Reference in New Issue
Block a user