aboutsummaryrefslogtreecommitdiff
path: root/libmm-glib/mm-modem-cell-broadcast.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmm-glib/mm-modem-cell-broadcast.c')
-rw-r--r--libmm-glib/mm-modem-cell-broadcast.c106
1 files changed, 105 insertions, 1 deletions
diff --git a/libmm-glib/mm-modem-cell-broadcast.c b/libmm-glib/mm-modem-cell-broadcast.c
index 5792a5c7..60495f84 100644
--- a/libmm-glib/mm-modem-cell-broadcast.c
+++ b/libmm-glib/mm-modem-cell-broadcast.c
@@ -17,7 +17,7 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
- * Copyright (C) 2024 Guido Günther <agx@sigxcpu.org>
+ * Copyright (C) 2024-2025 Guido Günther <agx@sigxcpu.org>
*/
#include <gio/gio.h>
@@ -413,6 +413,110 @@ mm_modem_cell_broadcast_delete_sync (MMModemCellBroadcast *self,
/*****************************************************************************/
+/**
+ * mm_modem_cell_broadcast_set_channels_finish
+ * @self: A #MMModemCellBroadcast.
+ * @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to
+ * mm_modem_cell_broadcast_set_channels()
+ * @error: Return location for error or %NULL.
+ *
+ * Finishes an operation started with mm_modem_cell_broadcast_set_channels().
+ *
+ * Returns: %TRUE if set default storage is success, %FALSE if @error is set.
+ *
+ * Since: 1.24
+ */
+gboolean
+mm_modem_cell_broadcast_set_channels_finish (MMModemCellBroadcast *self,
+ GAsyncResult *res,
+ GError **error)
+{
+ g_return_val_if_fail (MM_IS_MODEM_CELL_BROADCAST (self), FALSE);
+
+ return mm_gdbus_modem_cell_broadcast_call_set_channels_finish (MM_GDBUS_MODEM_CELL_BROADCAST (self),
+ res,
+ error);
+}
+
+/**
+ * mm_modem_cell_broadcast_set_channels
+ * @self: A #MMModemCellBroadcast.
+ * @channels: The #MMCellbroadcastChannels to set
+ * @n_channels: The number of elements in `channels`
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @callback: A #GAsyncReadyCallback to call when the request is satisfied or
+ * %NULL
+ * @user_data: User data to pass to @callback.
+ *
+ * Asynchronously set the #MMCellbroadcastChannel s in the modem.
+ *
+ * When the operation is finished, @callback will be invoked in the
+ * <link linkend="g-main-context-push-thread-default">thread-default main loop</link>
+ * of the thread you are calling this method from. You can then call
+ * mm_modem_cell_broadcast_set_channels_finish() to get the result of the operation.
+ *
+ * See mm_modem_cell_broadcast_set_channels_sync() for the synchronous, blocking version
+ * of this method.
+ *
+ * Since: 1.24
+ */
+void
+mm_modem_cell_broadcast_set_channels (MMModemCellBroadcast *self,
+ const MMCellBroadcastChannels *channels,
+ guint n_channels,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GVariant *channels_variant;
+
+ g_return_if_fail (MM_IS_MODEM_CELL_BROADCAST (self));
+
+ channels_variant = mm_common_cell_broadcast_channels_array_to_variant (channels, n_channels);
+ mm_gdbus_modem_cell_broadcast_call_set_channels (MM_GDBUS_MODEM_CELL_BROADCAST (self),
+ channels_variant,
+ cancellable,
+ callback,
+ user_data);
+}
+
+/**
+ * mm_modem_cell_broadcast_set_channels_sync
+ * @self: A #MMModemCellBroadcast.
+ * @channels: The #MMCellbroadcastChannels to set
+ * @n_channels: The number of elements in `channels`
+ * @cancellable: (allow-none): A #GCancellable or %NULL.
+ * @error: Return location for error or %NULL.
+ *
+ * Asynchronously set the #MMCellbroadcastChannel s in the modem.
+ *
+ * The calling thread is blocked until a reply is received. See
+ * mm_modem_cell_broadcast_set_channels() for the asynchronous version of this method.
+ *
+ * Returns: %TRUE if the operation was successful, %FALSE if @error is set.
+ *
+ * Since: 1.24
+ */
+gboolean
+mm_modem_cell_broadcast_set_channels_sync (MMModemCellBroadcast *self,
+ const MMCellBroadcastChannels *channels,
+ guint n_channels,
+ GCancellable *cancellable,
+ GError **error)
+{
+ GVariant *channels_variant;
+
+ g_return_val_if_fail (MM_IS_MODEM_CELL_BROADCAST (self), FALSE);
+
+ channels_variant = mm_common_cell_broadcast_channels_array_to_variant (channels, n_channels);
+ return mm_gdbus_modem_cell_broadcast_call_set_channels_sync (MM_GDBUS_MODEM_CELL_BROADCAST (self),
+ channels_variant,
+ cancellable,
+ error);
+}
+
+/*****************************************************************************/
+
static void
mm_modem_cell_broadcast_init (MMModemCellBroadcast *self)
{