From c368a63e01dba01c966eac15c07486b82a15c14d Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Fri, 25 Jun 2021 10:56:38 +0200 Subject: libmm-glib,oma: deprecate method names without the mm_modem_oma prefix --- cli/mmcli-modem-oma.c | 2 +- docs/reference/libmm-glib/libmm-glib-docs.xml | 5 ++ docs/reference/libmm-glib/libmm-glib-sections.txt | 11 ++- libmm-glib/Makefile.am | 3 + libmm-glib/libmm-glib.h | 1 + libmm-glib/mm-compat.c | 45 ++++++++++++ libmm-glib/mm-compat.h | 85 +++++++++++++++++++++++ libmm-glib/mm-modem-oma.c | 20 +++--- libmm-glib/mm-modem-oma.h | 12 ++-- 9 files changed, 165 insertions(+), 19 deletions(-) create mode 100644 libmm-glib/mm-compat.c create mode 100644 libmm-glib/mm-compat.h diff --git a/cli/mmcli-modem-oma.c b/cli/mmcli-modem-oma.c index e1a41ada..800c272e 100644 --- a/cli/mmcli-modem-oma.c +++ b/cli/mmcli-modem-oma.c @@ -177,7 +177,7 @@ print_oma_status (void) } /* If 1 or more pending sessions... */ - if (mm_modem_peek_pending_network_initiated_sessions (ctx->modem_oma, &pending_sessions, &n_pending_sessions) && + if (mm_modem_oma_peek_pending_network_initiated_sessions (ctx->modem_oma, &pending_sessions, &n_pending_sessions) && n_pending_sessions > 0) { guint i; diff --git a/docs/reference/libmm-glib/libmm-glib-docs.xml b/docs/reference/libmm-glib/libmm-glib-docs.xml index df75bee3..92e105f0 100644 --- a/docs/reference/libmm-glib/libmm-glib-docs.xml +++ b/docs/reference/libmm-glib/libmm-glib-docs.xml @@ -267,6 +267,11 @@ + + Compatibility with older versions + + + Object Hierarchy diff --git a/docs/reference/libmm-glib/libmm-glib-sections.txt b/docs/reference/libmm-glib/libmm-glib-sections.txt index 7667f244..2ff239cd 100644 --- a/docs/reference/libmm-glib/libmm-glib-sections.txt +++ b/docs/reference/libmm-glib/libmm-glib-sections.txt @@ -811,8 +811,8 @@ mm_modem_oma_cancel_session_sync mm_modem_oma_get_features mm_modem_oma_get_session_type mm_modem_oma_get_session_state -mm_modem_peek_pending_network_initiated_sessions -mm_modem_get_pending_network_initiated_sessions +mm_modem_oma_peek_pending_network_initiated_sessions +mm_modem_oma_get_pending_network_initiated_sessions MMModemOmaClass MMModemOmaPrivate @@ -1828,6 +1828,13 @@ mm_mobile_equipment_error_get_type mm_serial_error_get_type +
+mm-compat +Deprecated Interface +mm_modem_peek_pending_network_initiated_sessions +mm_modem_get_pending_network_initiated_sessions +
+
MmGdbusBearer MmGdbusBearer diff --git a/libmm-glib/Makefile.am b/libmm-glib/Makefile.am index ee59f557..776ed6f9 100644 --- a/libmm-glib/Makefile.am +++ b/libmm-glib/Makefile.am @@ -95,6 +95,8 @@ libmm_glib_la_SOURCES = \ mm-sim-preferred-network.c \ mm-3gpp-profile.h \ mm-3gpp-profile.c \ + mm-compat.h \ + mm-compat.c \ $(NULL) libmm_glib_la_CPPFLAGS = \ @@ -169,6 +171,7 @@ include_HEADERS = \ mm-call-audio-format.h \ mm-sim-preferred-network.h \ mm-3gpp-profile.h \ + mm-compat.h \ $(NULL) CLEANFILES = diff --git a/libmm-glib/libmm-glib.h b/libmm-glib/libmm-glib.h index 03b3f1f4..86088509 100644 --- a/libmm-glib/libmm-glib.h +++ b/libmm-glib/libmm-glib.h @@ -83,6 +83,7 @@ #include #include #include +#include /* generated */ #include diff --git a/libmm-glib/mm-compat.c b/libmm-glib/mm-compat.c new file mode 100644 index 00000000..6b36e5a3 --- /dev/null +++ b/libmm-glib/mm-compat.c @@ -0,0 +1,45 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * libmm -- 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 + */ + +#include + +#include "mm-compat.h" + +#ifndef MM_DISABLE_DEPRECATED + +gboolean +mm_modem_get_pending_network_initiated_sessions (MMModemOma *self, + MMOmaPendingNetworkInitiatedSession **sessions, + guint *n_sessions) +{ + return mm_modem_oma_get_pending_network_initiated_sessions (self, sessions, n_sessions); +} + +gboolean +mm_modem_peek_pending_network_initiated_sessions (MMModemOma *self, + const MMOmaPendingNetworkInitiatedSession **sessions, + guint *n_sessions) +{ + return mm_modem_oma_peek_pending_network_initiated_sessions (self, sessions, n_sessions); +} + +#endif /* MM_DISABLE_DEPRECATED */ diff --git a/libmm-glib/mm-compat.h b/libmm-glib/mm-compat.h new file mode 100644 index 00000000..ef2fc5b1 --- /dev/null +++ b/libmm-glib/mm-compat.h @@ -0,0 +1,85 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * libmm -- 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 + */ + +#ifndef _MM_COMPAT_H_ +#define _MM_COMPAT_H_ + +#ifndef MM_DISABLE_DEPRECATED + +#if !defined (__LIBMM_GLIB_H_INSIDE__) && !defined (LIBMM_GLIB_COMPILATION) +#error "Only can be included directly." +#endif + +#include "mm-modem-oma.h" + +/** + * SECTION:mm-compat + * @short_description: Deprecated types and methods. + * + * These types and methods are flagged as deprecated and therefore + * shouldn't be used in newly written code. They are provided to avoid + * innecessary API/ABI breaks, for compatibility purposes only. + */ + +/** + * mm_modem_get_pending_network_initiated_sessions: + * @self: A #MMModem. + * @sessions: (out) (array length=n_sessions): Return location for the array of + * #MMOmaPendingNetworkInitiatedSession structs. The returned array should be + * freed with g_free() when no longer needed. + * @n_sessions: (out): Return location for the number of values in @sessions. + * + * Gets the list of pending network-initiated OMA sessions. + * + * Returns: %TRUE if @sessions and @n_sessions are set, %FALSE otherwise. + * + * Since: 1.2 + * Deprecated: 1.18: Use mm_modem_oma_get_pending_network_initiated_sessions() instead. + */ +G_DEPRECATED_FOR (mm_modem_oma_get_pending_network_initiated_sessions) +gboolean mm_modem_get_pending_network_initiated_sessions (MMModemOma *self, + MMOmaPendingNetworkInitiatedSession **sessions, + guint *n_sessions); + +/** + * mm_modem_peek_pending_network_initiated_sessions: + * @self: A #MMModem. + * @sessions: (out) (array length=n_sessions): Return location for the array of + * #MMOmaPendingNetworkInitiatedSession values. Do not free the returned array, + * it is owned by @self. + * @n_sessions: (out): Return location for the number of values in @sessions. + * + * Gets the list of pending network-initiated OMA sessions. + * + * Returns: %TRUE if @sessions and @n_sessions are set, %FALSE otherwise. + * + * Since: 1.2 + * Deprecated: 1.18: Use mm_modem_oma_peek_pending_network_initiated_sessions() instead. + */ +G_DEPRECATED_FOR (mm_modem_oma_peek_pending_network_initiated_sessions) +gboolean mm_modem_peek_pending_network_initiated_sessions (MMModemOma *self, + const MMOmaPendingNetworkInitiatedSession **sessions, + guint *n_sessions); + +#endif /* MM_DISABLE_DEPRECATED */ + +#endif /* _MM_COMPAT_H_ */ diff --git a/libmm-glib/mm-modem-oma.c b/libmm-glib/mm-modem-oma.c index e1dc8506..72f57dd7 100644 --- a/libmm-glib/mm-modem-oma.c +++ b/libmm-glib/mm-modem-oma.c @@ -571,7 +571,7 @@ ensure_internal_pending_network_initiated_sessions (MMModemOma *self, } /** - * mm_modem_get_pending_network_initiated_sessions: + * mm_modem_oma_get_pending_network_initiated_sessions: * @self: A #MMModem. * @sessions: (out) (array length=n_sessions): Return location for the array of * #MMOmaPendingNetworkInitiatedSession structs. The returned array should be @@ -582,12 +582,12 @@ ensure_internal_pending_network_initiated_sessions (MMModemOma *self, * * Returns: %TRUE if @sessions and @n_sessions are set, %FALSE otherwise. * - * Since: 1.2 + * Since: 1.18 */ gboolean -mm_modem_get_pending_network_initiated_sessions (MMModemOma *self, - MMOmaPendingNetworkInitiatedSession **sessions, - guint *n_sessions) +mm_modem_oma_get_pending_network_initiated_sessions (MMModemOma *self, + MMOmaPendingNetworkInitiatedSession **sessions, + guint *n_sessions) { g_return_val_if_fail (MM_IS_MODEM_OMA (self), FALSE); g_return_val_if_fail (sessions != NULL, FALSE); @@ -597,7 +597,7 @@ mm_modem_get_pending_network_initiated_sessions (MMModemOma *self, } /** - * mm_modem_peek_pending_network_initiated_sessions: + * mm_modem_oma_peek_pending_network_initiated_sessions: * @self: A #MMModem. * @sessions: (out) (array length=n_sessions): Return location for the array of * #MMOmaPendingNetworkInitiatedSession values. Do not free the returned array, @@ -608,12 +608,12 @@ mm_modem_get_pending_network_initiated_sessions (MMModemOma *self, * * Returns: %TRUE if @sessions and @n_sessions are set, %FALSE otherwise. * - * Since: 1.2 + * Since: 1.18 */ gboolean -mm_modem_peek_pending_network_initiated_sessions (MMModemOma *self, - const MMOmaPendingNetworkInitiatedSession **sessions, - guint *n_sessions) +mm_modem_oma_peek_pending_network_initiated_sessions (MMModemOma *self, + const MMOmaPendingNetworkInitiatedSession **sessions, + guint *n_sessions) { g_return_val_if_fail (MM_IS_MODEM_OMA (self), FALSE); g_return_val_if_fail (sessions != NULL, FALSE); diff --git a/libmm-glib/mm-modem-oma.h b/libmm-glib/mm-modem-oma.h index ee670942..d935bdfa 100644 --- a/libmm-glib/mm-modem-oma.h +++ b/libmm-glib/mm-modem-oma.h @@ -124,12 +124,12 @@ MMOmaFeature mm_modem_oma_get_features (MMModemOma *self); MMOmaSessionType mm_modem_oma_get_session_type (MMModemOma *self); MMOmaSessionState mm_modem_oma_get_session_state (MMModemOma *self); -gboolean mm_modem_peek_pending_network_initiated_sessions (MMModemOma *self, - const MMOmaPendingNetworkInitiatedSession **sessions, - guint *n_sessions); -gboolean mm_modem_get_pending_network_initiated_sessions (MMModemOma *self, - MMOmaPendingNetworkInitiatedSession **sessions, - guint *n_sessions); +gboolean mm_modem_oma_peek_pending_network_initiated_sessions (MMModemOma *self, + const MMOmaPendingNetworkInitiatedSession **sessions, + guint *n_sessions); +gboolean mm_modem_oma_get_pending_network_initiated_sessions (MMModemOma *self, + MMOmaPendingNetworkInitiatedSession **sessions, + guint *n_sessions); G_END_DECLS -- cgit v1.2.3-70-g09d2