libmm-glib,cell-info-nr5g: new 'MMCellInfoNr5g' object
Implementing support for 5GNR cell info.
This commit is contained in:
@@ -98,6 +98,7 @@
|
|||||||
<xi:include href="xml/mm-cell-info-umts.xml"/>
|
<xi:include href="xml/mm-cell-info-umts.xml"/>
|
||||||
<xi:include href="xml/mm-cell-info-tdscdma.xml"/>
|
<xi:include href="xml/mm-cell-info-tdscdma.xml"/>
|
||||||
<xi:include href="xml/mm-cell-info-lte.xml"/>
|
<xi:include href="xml/mm-cell-info-lte.xml"/>
|
||||||
|
<xi:include href="xml/mm-cell-info-nr5g.xml"/>
|
||||||
<xi:include href="xml/mm-pco.xml"/>
|
<xi:include href="xml/mm-pco.xml"/>
|
||||||
<xi:include href="xml/mm-nr5g-registration-settings.xml"/>
|
<xi:include href="xml/mm-nr5g-registration-settings.xml"/>
|
||||||
</section>
|
</section>
|
||||||
|
@@ -479,6 +479,43 @@ MM_CELL_INFO_LTE_GET_CLASS
|
|||||||
mm_cell_info_lte_get_type
|
mm_cell_info_lte_get_type
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
|
<SECTION>
|
||||||
|
<FILE>mm-cell-info-nr5g</FILE>
|
||||||
|
<TITLE>MMCellInfoNr5g</TITLE>
|
||||||
|
MMCellInfoNr5g
|
||||||
|
<SUBSECTION Getters>
|
||||||
|
mm_cell_info_nr5g_get_operator_id
|
||||||
|
mm_cell_info_nr5g_get_tac
|
||||||
|
mm_cell_info_nr5g_get_ci
|
||||||
|
mm_cell_info_nr5g_get_physical_ci
|
||||||
|
mm_cell_info_nr5g_get_nrarfcn
|
||||||
|
mm_cell_info_nr5g_get_rsrp
|
||||||
|
mm_cell_info_nr5g_get_rsrq
|
||||||
|
mm_cell_info_nr5g_get_sinr
|
||||||
|
mm_cell_info_nr5g_get_timing_advance
|
||||||
|
<SUBSECTION Private>
|
||||||
|
mm_cell_info_nr5g_new_from_dictionary
|
||||||
|
mm_cell_info_nr5g_set_operator_id
|
||||||
|
mm_cell_info_nr5g_set_tac
|
||||||
|
mm_cell_info_nr5g_set_ci
|
||||||
|
mm_cell_info_nr5g_set_physical_ci
|
||||||
|
mm_cell_info_nr5g_set_nrarfcn
|
||||||
|
mm_cell_info_nr5g_set_rsrp
|
||||||
|
mm_cell_info_nr5g_set_rsrq
|
||||||
|
mm_cell_info_nr5g_set_sinr
|
||||||
|
mm_cell_info_nr5g_set_timing_advance
|
||||||
|
<SUBSECTION Standard>
|
||||||
|
MMCellInfoNr5gClass
|
||||||
|
MMCellInfoNr5gPrivate
|
||||||
|
MM_IS_CELL_INFO_NR5G
|
||||||
|
MM_IS_CELL_INFO_NR5G_CLASS
|
||||||
|
MM_TYPE_CELL_INFO_NR5G
|
||||||
|
MM_CELL_INFO_NR5G
|
||||||
|
MM_CELL_INFO_NR5G_CLASS
|
||||||
|
MM_CELL_INFO_NR5G_GET_CLASS
|
||||||
|
mm_cell_info_nr5g_get_type
|
||||||
|
</SECTION>
|
||||||
|
|
||||||
<SECTION>
|
<SECTION>
|
||||||
<FILE>mm-modem-3gpp</FILE>
|
<FILE>mm-modem-3gpp</FILE>
|
||||||
<TITLE>MMModem3gpp</TITLE>
|
<TITLE>MMModem3gpp</TITLE>
|
||||||
|
@@ -113,6 +113,8 @@ libmm_glib_la_SOURCES = \
|
|||||||
mm-cell-info-tdscdma.c \
|
mm-cell-info-tdscdma.c \
|
||||||
mm-cell-info-lte.h \
|
mm-cell-info-lte.h \
|
||||||
mm-cell-info-lte.c \
|
mm-cell-info-lte.c \
|
||||||
|
mm-cell-info-nr5g.h \
|
||||||
|
mm-cell-info-nr5g.c \
|
||||||
mm-compat.h \
|
mm-compat.h \
|
||||||
mm-compat.c \
|
mm-compat.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
@@ -198,6 +200,7 @@ include_HEADERS = \
|
|||||||
mm-cell-info-umts.h \
|
mm-cell-info-umts.h \
|
||||||
mm-cell-info-tdscdma.h \
|
mm-cell-info-tdscdma.h \
|
||||||
mm-cell-info-lte.h \
|
mm-cell-info-lte.h \
|
||||||
|
mm-cell-info-nr5g.h \
|
||||||
mm-compat.h \
|
mm-compat.h \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
@@ -92,6 +92,7 @@
|
|||||||
#include <mm-cell-info-umts.h>
|
#include <mm-cell-info-umts.h>
|
||||||
#include <mm-cell-info-tdscdma.h>
|
#include <mm-cell-info-tdscdma.h>
|
||||||
#include <mm-cell-info-lte.h>
|
#include <mm-cell-info-lte.h>
|
||||||
|
#include <mm-cell-info-nr5g.h>
|
||||||
#include <mm-compat.h>
|
#include <mm-compat.h>
|
||||||
|
|
||||||
/* generated */
|
/* generated */
|
||||||
|
@@ -20,6 +20,7 @@ headers = files(
|
|||||||
'mm-cell-info-cdma.h',
|
'mm-cell-info-cdma.h',
|
||||||
'mm-cell-info-gsm.h',
|
'mm-cell-info-gsm.h',
|
||||||
'mm-cell-info-lte.h',
|
'mm-cell-info-lte.h',
|
||||||
|
'mm-cell-info-nr5g.h',
|
||||||
'mm-cell-info-tdscdma.h',
|
'mm-cell-info-tdscdma.h',
|
||||||
'mm-cell-info-umts.h',
|
'mm-cell-info-umts.h',
|
||||||
'mm-compat.h',
|
'mm-compat.h',
|
||||||
@@ -81,6 +82,7 @@ sources = files(
|
|||||||
'mm-cell-info-cdma.c',
|
'mm-cell-info-cdma.c',
|
||||||
'mm-cell-info-gsm.c',
|
'mm-cell-info-gsm.c',
|
||||||
'mm-cell-info-lte.c',
|
'mm-cell-info-lte.c',
|
||||||
|
'mm-cell-info-nr5g.c',
|
||||||
'mm-cell-info-tdscdma.c',
|
'mm-cell-info-tdscdma.c',
|
||||||
'mm-cell-info-umts.c',
|
'mm-cell-info-umts.c',
|
||||||
'mm-common-helpers.c',
|
'mm-common-helpers.c',
|
||||||
|
444
libmm-glib/mm-cell-info-nr5g.c
Normal file
444
libmm-glib/mm-cell-info-nr5g.c
Normal file
@@ -0,0 +1,444 @@
|
|||||||
|
/* -*- 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-nr5g.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION: mm-cell-info-nr5g
|
||||||
|
* @title: MMCellInfoNr5g
|
||||||
|
* @short_description: Helper object to report 5GNR cell info
|
||||||
|
*
|
||||||
|
* The #MMCellInfoNr5g is an object used to report 5GNR cell
|
||||||
|
* information.
|
||||||
|
*
|
||||||
|
* The object inherits from the generic #MMCellInfo.
|
||||||
|
*/
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (MMCellInfoNr5g, mm_cell_info_nr5g, MM_TYPE_CELL_INFO)
|
||||||
|
|
||||||
|
#define PROPERTY_OPERATOR_ID "operator-id"
|
||||||
|
#define PROPERTY_TAC "tac"
|
||||||
|
#define PROPERTY_CI "ci"
|
||||||
|
#define PROPERTY_PHYSICAL_CI "physical-ci"
|
||||||
|
#define PROPERTY_NRARFCN "nrarfcn"
|
||||||
|
#define PROPERTY_RSRP "rsrp"
|
||||||
|
#define PROPERTY_RSRQ "rsrq"
|
||||||
|
#define PROPERTY_SINR "sinr"
|
||||||
|
#define PROPERTY_TIMING_ADVANCE "timing-advance"
|
||||||
|
|
||||||
|
|
||||||
|
struct _MMCellInfoNr5gPrivate {
|
||||||
|
gchar *operator_id;
|
||||||
|
gchar *tac;
|
||||||
|
gchar *ci;
|
||||||
|
gchar *physical_ci;
|
||||||
|
guint nrarfcn;
|
||||||
|
gdouble rsrp;
|
||||||
|
gdouble rsrq;
|
||||||
|
gdouble sinr;
|
||||||
|
guint timing_advance;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_get_operator_id:
|
||||||
|
* @self: a #MMCellInfoNr5g.
|
||||||
|
*
|
||||||
|
* Get the PLMN MCC/MNC.
|
||||||
|
*
|
||||||
|
* Returns: (transfer none): the MCCMNC, or %NULL if not available.
|
||||||
|
*
|
||||||
|
* Since: 1.20
|
||||||
|
*/
|
||||||
|
const gchar *
|
||||||
|
mm_cell_info_nr5g_get_operator_id (MMCellInfoNr5g *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (MM_IS_CELL_INFO_NR5G (self), NULL);
|
||||||
|
|
||||||
|
RETURN_NON_EMPTY_CONSTANT_STRING (self->priv->operator_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_set_operator_id: (skip)
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
mm_cell_info_nr5g_set_operator_id (MMCellInfoNr5g *self,
|
||||||
|
const gchar *operator_id)
|
||||||
|
{
|
||||||
|
g_free (self->priv->operator_id);
|
||||||
|
self->priv->operator_id = g_strdup (operator_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_get_tac:
|
||||||
|
* @self: a #MMCellInfoNr5g.
|
||||||
|
*
|
||||||
|
* Get the two- or three- byte Tracking 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_nr5g_get_tac (MMCellInfoNr5g *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (MM_IS_CELL_INFO_NR5G (self), NULL);
|
||||||
|
|
||||||
|
RETURN_NON_EMPTY_CONSTANT_STRING (self->priv->tac);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_set_tac: (skip)
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
mm_cell_info_nr5g_set_tac (MMCellInfoNr5g *self,
|
||||||
|
const gchar *tac)
|
||||||
|
{
|
||||||
|
g_free (self->priv->tac);
|
||||||
|
self->priv->tac = g_strdup (tac);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_get_ci:
|
||||||
|
* @self: a #MMCellInfoNr5g.
|
||||||
|
*
|
||||||
|
* 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_nr5g_get_ci (MMCellInfoNr5g *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (MM_IS_CELL_INFO_NR5G (self), NULL);
|
||||||
|
|
||||||
|
RETURN_NON_EMPTY_CONSTANT_STRING (self->priv->ci);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_set_ci: (skip)
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
mm_cell_info_nr5g_set_ci (MMCellInfoNr5g *self,
|
||||||
|
const gchar *ci)
|
||||||
|
{
|
||||||
|
g_free (self->priv->ci);
|
||||||
|
self->priv->ci = g_strdup (ci);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_get_physical_ci:
|
||||||
|
* @self: a #MMCellInfoNr5g.
|
||||||
|
*
|
||||||
|
* Get the physical 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_nr5g_get_physical_ci (MMCellInfoNr5g *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (MM_IS_CELL_INFO_NR5G (self), NULL);
|
||||||
|
|
||||||
|
RETURN_NON_EMPTY_CONSTANT_STRING (self->priv->physical_ci);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_set_physical_ci: (skip)
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
mm_cell_info_nr5g_set_physical_ci (MMCellInfoNr5g *self,
|
||||||
|
const gchar *physical_ci)
|
||||||
|
{
|
||||||
|
g_free (self->priv->physical_ci);
|
||||||
|
self->priv->physical_ci = g_strdup (physical_ci);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_get_nrarfcn:
|
||||||
|
* @self: a #MMCellInfoNr5g.
|
||||||
|
*
|
||||||
|
* Get the NR absolute RF channel number.
|
||||||
|
*
|
||||||
|
* Returns: the NRARFCN, or %G_MAXUINT if not available.
|
||||||
|
*
|
||||||
|
* Since: 1.20
|
||||||
|
*/
|
||||||
|
guint
|
||||||
|
mm_cell_info_nr5g_get_nrarfcn (MMCellInfoNr5g *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (MM_IS_CELL_INFO_NR5G (self), G_MAXUINT);
|
||||||
|
|
||||||
|
return self->priv->nrarfcn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_set_nrarfcn: (skip)
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
mm_cell_info_nr5g_set_nrarfcn (MMCellInfoNr5g *self,
|
||||||
|
guint nrarfcn)
|
||||||
|
{
|
||||||
|
self->priv->nrarfcn = nrarfcn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_get_rsrp:
|
||||||
|
* @self: a #MMCellInfoNr5g.
|
||||||
|
*
|
||||||
|
* Get the average reference signal received power in dBm.
|
||||||
|
*
|
||||||
|
* Returns: the RSRP, or -%G_MAXDOUBLE if not available.
|
||||||
|
*
|
||||||
|
* Since: 1.20
|
||||||
|
*/
|
||||||
|
gdouble
|
||||||
|
mm_cell_info_nr5g_get_rsrp (MMCellInfoNr5g *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (MM_IS_CELL_INFO_NR5G (self), -G_MAXDOUBLE);
|
||||||
|
|
||||||
|
return self->priv->rsrp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_set_rsrp: (skip)
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
mm_cell_info_nr5g_set_rsrp (MMCellInfoNr5g *self,
|
||||||
|
gdouble rsrp)
|
||||||
|
{
|
||||||
|
self->priv->rsrp = rsrp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_get_rsrq:
|
||||||
|
* @self: a #MMCellInfoNr5g.
|
||||||
|
*
|
||||||
|
* Get the average reference signal received quality in dB.
|
||||||
|
*
|
||||||
|
* Returns: the RSRQ, or -%G_MAXDOUBLE if not available.
|
||||||
|
*
|
||||||
|
* Since: 1.20
|
||||||
|
*/
|
||||||
|
gdouble
|
||||||
|
mm_cell_info_nr5g_get_rsrq (MMCellInfoNr5g *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (MM_IS_CELL_INFO_NR5G (self), -G_MAXDOUBLE);
|
||||||
|
|
||||||
|
return self->priv->rsrq;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_set_rsrq: (skip)
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
mm_cell_info_nr5g_set_rsrq (MMCellInfoNr5g *self,
|
||||||
|
gdouble rsrq)
|
||||||
|
{
|
||||||
|
self->priv->rsrq = rsrq;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_get_sinr:
|
||||||
|
* @self: a #MMCellInfoNr5g.
|
||||||
|
*
|
||||||
|
* Get the signal to interference and noise ratio.
|
||||||
|
*
|
||||||
|
* Returns: the SINR, or -%G_MAXDOUBLE if not available.
|
||||||
|
*
|
||||||
|
* Since: 1.20
|
||||||
|
*/
|
||||||
|
gdouble
|
||||||
|
mm_cell_info_nr5g_get_sinr (MMCellInfoNr5g *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (MM_IS_CELL_INFO_NR5G (self), -G_MAXDOUBLE);
|
||||||
|
|
||||||
|
return self->priv->sinr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_set_sinr: (skip)
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
mm_cell_info_nr5g_set_sinr (MMCellInfoNr5g *self,
|
||||||
|
gdouble sinr)
|
||||||
|
{
|
||||||
|
self->priv->sinr = sinr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_get_timing_advance:
|
||||||
|
* @self: a #MMCellInfoNr5g.
|
||||||
|
*
|
||||||
|
* Get the timing advance.
|
||||||
|
*
|
||||||
|
* Returns: the timing advance, or %G_MAXUINT if not available.
|
||||||
|
*
|
||||||
|
* Since: 1.20
|
||||||
|
*/
|
||||||
|
guint
|
||||||
|
mm_cell_info_nr5g_get_timing_advance (MMCellInfoNr5g *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (MM_IS_CELL_INFO_NR5G (self), G_MAXUINT);
|
||||||
|
|
||||||
|
return self->priv->timing_advance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_set_timing_advance: (skip)
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
mm_cell_info_nr5g_set_timing_advance (MMCellInfoNr5g *self,
|
||||||
|
guint timing_advance)
|
||||||
|
{
|
||||||
|
self->priv->timing_advance = timing_advance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static GString *
|
||||||
|
build_string (MMCellInfo *_self)
|
||||||
|
{
|
||||||
|
MMCellInfoNr5g *self = MM_CELL_INFO_NR5G (_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 ("tac", "%s", tac, NULL);
|
||||||
|
MM_CELL_INFO_BUILD_STRING_APPEND ("ci", "%s", ci, NULL);
|
||||||
|
MM_CELL_INFO_BUILD_STRING_APPEND ("physical ci", "%s", physical_ci, NULL);
|
||||||
|
MM_CELL_INFO_BUILD_STRING_APPEND ("nrarfcn", "%u", nrarfcn, G_MAXUINT);
|
||||||
|
MM_CELL_INFO_BUILD_STRING_APPEND ("rsrp", "%lf", rsrp, -G_MAXDOUBLE);
|
||||||
|
MM_CELL_INFO_BUILD_STRING_APPEND ("rsrq", "%lf", rsrq, -G_MAXDOUBLE);
|
||||||
|
MM_CELL_INFO_BUILD_STRING_APPEND ("sinr", "%lf", sinr, -G_MAXDOUBLE);
|
||||||
|
MM_CELL_INFO_BUILD_STRING_APPEND ("timing advance", "%u", timing_advance, G_MAXUINT);
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_get_dictionary: (skip)
|
||||||
|
*/
|
||||||
|
static GVariantDict *
|
||||||
|
get_dictionary (MMCellInfo *_self)
|
||||||
|
{
|
||||||
|
MMCellInfoNr5g *self = MM_CELL_INFO_NR5G (_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 (TAC, tac, string, NULL);
|
||||||
|
MM_CELL_INFO_GET_DICTIONARY_INSERT (CI, ci, string, NULL);
|
||||||
|
MM_CELL_INFO_GET_DICTIONARY_INSERT (PHYSICAL_CI, physical_ci, string, NULL);
|
||||||
|
MM_CELL_INFO_GET_DICTIONARY_INSERT (NRARFCN, nrarfcn, uint32, G_MAXUINT);
|
||||||
|
MM_CELL_INFO_GET_DICTIONARY_INSERT (RSRP, rsrp, double, -G_MAXDOUBLE);
|
||||||
|
MM_CELL_INFO_GET_DICTIONARY_INSERT (RSRQ, rsrq, double, -G_MAXDOUBLE);
|
||||||
|
MM_CELL_INFO_GET_DICTIONARY_INSERT (SINR, sinr, double, -G_MAXDOUBLE);
|
||||||
|
MM_CELL_INFO_GET_DICTIONARY_INSERT (TIMING_ADVANCE, timing_advance, uint32, G_MAXUINT);
|
||||||
|
|
||||||
|
return dict;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* mm_cell_info_nr5g_new_from_dictionary: (skip)
|
||||||
|
*/
|
||||||
|
MMCellInfo *
|
||||||
|
mm_cell_info_nr5g_new_from_dictionary (GVariantDict *dict)
|
||||||
|
{
|
||||||
|
MMCellInfoNr5g *self;
|
||||||
|
|
||||||
|
self = MM_CELL_INFO_NR5G (g_object_new (MM_TYPE_CELL_INFO_NR5G, NULL));
|
||||||
|
|
||||||
|
if (dict) {
|
||||||
|
MM_CELL_INFO_NEW_FROM_DICTIONARY_STRING_SET (nr5g, OPERATOR_ID, operator_id);
|
||||||
|
MM_CELL_INFO_NEW_FROM_DICTIONARY_STRING_SET (nr5g, TAC, tac);
|
||||||
|
MM_CELL_INFO_NEW_FROM_DICTIONARY_STRING_SET (nr5g, CI, ci);
|
||||||
|
MM_CELL_INFO_NEW_FROM_DICTIONARY_STRING_SET (nr5g, PHYSICAL_CI, physical_ci);
|
||||||
|
|
||||||
|
MM_CELL_INFO_NEW_FROM_DICTIONARY_NUM_SET (nr5g, NRARFCN, nrarfcn, UINT32, uint32);
|
||||||
|
MM_CELL_INFO_NEW_FROM_DICTIONARY_NUM_SET (nr5g, RSRP, rsrp, DOUBLE, double);
|
||||||
|
MM_CELL_INFO_NEW_FROM_DICTIONARY_NUM_SET (nr5g, RSRQ, rsrq, DOUBLE, double);
|
||||||
|
MM_CELL_INFO_NEW_FROM_DICTIONARY_NUM_SET (nr5g, SINR, sinr, DOUBLE, double);
|
||||||
|
MM_CELL_INFO_NEW_FROM_DICTIONARY_NUM_SET (nr5g, TIMING_ADVANCE, timing_advance, UINT32, uint32);
|
||||||
|
}
|
||||||
|
|
||||||
|
return MM_CELL_INFO (self);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
|
||||||
|
static void
|
||||||
|
mm_cell_info_nr5g_init (MMCellInfoNr5g *self)
|
||||||
|
{
|
||||||
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_CELL_INFO_NR5G, MMCellInfoNr5gPrivate);
|
||||||
|
self->priv->nrarfcn = G_MAXUINT;
|
||||||
|
self->priv->rsrp = -G_MAXDOUBLE;
|
||||||
|
self->priv->rsrq = -G_MAXDOUBLE;
|
||||||
|
self->priv->sinr = -G_MAXDOUBLE;
|
||||||
|
self->priv->timing_advance = G_MAXUINT;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
finalize (GObject *object)
|
||||||
|
{
|
||||||
|
MMCellInfoNr5g *self = MM_CELL_INFO_NR5G (object);
|
||||||
|
|
||||||
|
g_free (self->priv->operator_id);
|
||||||
|
g_free (self->priv->tac);
|
||||||
|
g_free (self->priv->ci);
|
||||||
|
g_free (self->priv->physical_ci);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (mm_cell_info_nr5g_parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mm_cell_info_nr5g_class_init (MMCellInfoNr5gClass *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 (MMCellInfoNr5gPrivate));
|
||||||
|
|
||||||
|
object_class->finalize = finalize;
|
||||||
|
cell_info_class->get_dictionary = get_dictionary;
|
||||||
|
cell_info_class->build_string = build_string;
|
||||||
|
|
||||||
|
}
|
110
libmm-glib/mm-cell-info-nr5g.h
Normal file
110
libmm-glib/mm-cell-info-nr5g.h
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
/* -*- 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_NR5G_H
|
||||||
|
#define MM_CELL_INFO_NR5G_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_NR5G (mm_cell_info_nr5g_get_type ())
|
||||||
|
#define MM_CELL_INFO_NR5G(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_CELL_INFO_NR5G, MMCellInfoNr5g))
|
||||||
|
#define MM_CELL_INFO_NR5G_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_CELL_INFO_NR5G, MMCellInfoNr5gClass))
|
||||||
|
#define MM_IS_CELL_INFO_NR5G(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_CELL_INFO_NR5G))
|
||||||
|
#define MM_IS_CELL_INFO_NR5G_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_CELL_INFO_NR5G))
|
||||||
|
#define MM_CELL_INFO_NR5G_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_CELL_INFO_NR5G, MMCellInfoNr5gClass))
|
||||||
|
|
||||||
|
typedef struct _MMCellInfoNr5g MMCellInfoNr5g;
|
||||||
|
typedef struct _MMCellInfoNr5gClass MMCellInfoNr5gClass;
|
||||||
|
typedef struct _MMCellInfoNr5gPrivate MMCellInfoNr5gPrivate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MMCellInfoNr5g:
|
||||||
|
*
|
||||||
|
* The #MMCellInfoNr5g structure contains private data and should only be
|
||||||
|
* accessed using the provided API.
|
||||||
|
*/
|
||||||
|
struct _MMCellInfoNr5g {
|
||||||
|
/*< private >*/
|
||||||
|
MMCellInfo parent;
|
||||||
|
MMCellInfoNr5gPrivate *priv;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _MMCellInfoNr5gClass {
|
||||||
|
/*< private >*/
|
||||||
|
MMCellInfoClass parent;
|
||||||
|
};
|
||||||
|
|
||||||
|
GType mm_cell_info_nr5g_get_type (void);
|
||||||
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMCellInfoNr5g, g_object_unref)
|
||||||
|
|
||||||
|
const gchar *mm_cell_info_nr5g_get_operator_id (MMCellInfoNr5g *self);
|
||||||
|
const gchar *mm_cell_info_nr5g_get_tac (MMCellInfoNr5g *self);
|
||||||
|
const gchar *mm_cell_info_nr5g_get_ci (MMCellInfoNr5g *self);
|
||||||
|
const gchar *mm_cell_info_nr5g_get_physical_ci (MMCellInfoNr5g *self);
|
||||||
|
guint mm_cell_info_nr5g_get_nrarfcn (MMCellInfoNr5g *self);
|
||||||
|
gdouble mm_cell_info_nr5g_get_rsrp (MMCellInfoNr5g *self);
|
||||||
|
gdouble mm_cell_info_nr5g_get_rsrq (MMCellInfoNr5g *self);
|
||||||
|
gdouble mm_cell_info_nr5g_get_sinr (MMCellInfoNr5g *self);
|
||||||
|
guint mm_cell_info_nr5g_get_timing_advance (MMCellInfoNr5g *self);
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
|
/* ModemManager/libmm-glib/mmcli specific methods */
|
||||||
|
|
||||||
|
#if defined (_LIBMM_INSIDE_MM) || \
|
||||||
|
defined (_LIBMM_INSIDE_MMCLI) || \
|
||||||
|
defined (LIBMM_GLIB_COMPILATION)
|
||||||
|
|
||||||
|
void mm_cell_info_nr5g_set_operator_id (MMCellInfoNr5g *self,
|
||||||
|
const gchar *operator_id);
|
||||||
|
void mm_cell_info_nr5g_set_tac (MMCellInfoNr5g *self,
|
||||||
|
const gchar *tac);
|
||||||
|
void mm_cell_info_nr5g_set_ci (MMCellInfoNr5g *self,
|
||||||
|
const gchar *ci);
|
||||||
|
void mm_cell_info_nr5g_set_physical_ci (MMCellInfoNr5g *self,
|
||||||
|
const gchar *ci);
|
||||||
|
void mm_cell_info_nr5g_set_nrarfcn (MMCellInfoNr5g *self,
|
||||||
|
guint earfcn);
|
||||||
|
void mm_cell_info_nr5g_set_rsrp (MMCellInfoNr5g *self,
|
||||||
|
gdouble rsrp);
|
||||||
|
void mm_cell_info_nr5g_set_rsrq (MMCellInfoNr5g *self,
|
||||||
|
gdouble rsrq);
|
||||||
|
void mm_cell_info_nr5g_set_sinr (MMCellInfoNr5g *self,
|
||||||
|
gdouble sinr);
|
||||||
|
void mm_cell_info_nr5g_set_timing_advance (MMCellInfoNr5g *self,
|
||||||
|
guint earfcn);
|
||||||
|
|
||||||
|
MMCellInfo *mm_cell_info_nr5g_new_from_dictionary (GVariantDict *dict);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* MM_CELL_INFO_NR5G_H */
|
@@ -26,6 +26,7 @@
|
|||||||
#include "mm-cell-info-umts.h"
|
#include "mm-cell-info-umts.h"
|
||||||
#include "mm-cell-info-tdscdma.h"
|
#include "mm-cell-info-tdscdma.h"
|
||||||
#include "mm-cell-info-lte.h"
|
#include "mm-cell-info-lte.h"
|
||||||
|
#include "mm-cell-info-nr5g.h"
|
||||||
|
|
||||||
#include "mm-enums-types.h"
|
#include "mm-enums-types.h"
|
||||||
#include "mm-errors-types.h"
|
#include "mm-errors-types.h"
|
||||||
@@ -69,7 +70,8 @@ ensure_cell_type (MMCellInfo *self)
|
|||||||
self->priv->cell_type = MM_CELL_TYPE_TDSCDMA;
|
self->priv->cell_type = MM_CELL_TYPE_TDSCDMA;
|
||||||
else if (MM_IS_CELL_INFO_LTE (self))
|
else if (MM_IS_CELL_INFO_LTE (self))
|
||||||
self->priv->cell_type = MM_CELL_TYPE_LTE;
|
self->priv->cell_type = MM_CELL_TYPE_LTE;
|
||||||
/* MM_CELL_TYPE_5GNR; */
|
else if (MM_IS_CELL_INFO_NR5G (self))
|
||||||
|
self->priv->cell_type = MM_CELL_TYPE_5GNR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -179,6 +181,8 @@ mm_cell_info_new_from_dictionary (GVariant *dictionary,
|
|||||||
self = mm_cell_info_lte_new_from_dictionary (dict);
|
self = mm_cell_info_lte_new_from_dictionary (dict);
|
||||||
break;
|
break;
|
||||||
case MM_CELL_TYPE_5GNR:
|
case MM_CELL_TYPE_5GNR:
|
||||||
|
self = mm_cell_info_nr5g_new_from_dictionary (dict);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user