diff options
author | Guido Günther <agx@sigxcpu.org> | 2025-03-28 16:49:59 +0100 |
---|---|---|
committer | Dan Williams <dan@ioncontrol.co> | 2025-03-29 22:19:17 +0000 |
commit | 577639659ce3427d5768476e55f705780c23110e (patch) | |
tree | 3e431567a31590d32a52477ead6a010f55275330 /libmm-glib | |
parent | d6367c76c0e188e9d3e9dee6bb9415c11bd9093c (diff) |
libmm-glib,cell-broadcast: Add setters for channel list
Signed-off-by: Guido Günther <agx@sigxcpu.org>
Diffstat (limited to 'libmm-glib')
-rw-r--r-- | libmm-glib/mm-modem-cell-broadcast.c | 106 | ||||
-rw-r--r-- | libmm-glib/mm-modem-cell-broadcast.h | 17 |
2 files changed, 122 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) { diff --git a/libmm-glib/mm-modem-cell-broadcast.h b/libmm-glib/mm-modem-cell-broadcast.h index b080ee5a..9d9cafa3 100644 --- a/libmm-glib/mm-modem-cell-broadcast.h +++ b/libmm-glib/mm-modem-cell-broadcast.h @@ -99,6 +99,23 @@ gboolean mm_modem_cell_broadcast_delete_sync (MMModemCellBroadcast *self, GCancellable *cancellable, GError **error); +gboolean mm_modem_cell_broadcast_set_channels_finish (MMModemCellBroadcast *self, + GAsyncResult *res, + GError **error); + +void mm_modem_cell_broadcast_set_channels (MMModemCellBroadcast *self, + const MMCellBroadcastChannels *channels, + guint n_channels, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean mm_modem_cell_broadcast_set_channels_sync (MMModemCellBroadcast *self, + const MMCellBroadcastChannels *channels, + guint n_channels, + GCancellable *cancellable, + GError **error); + G_END_DECLS #endif /* _MM_MODEM_CELL_BROADCAST_H_ */ |