libmm-glib,cell-broadcast: Add setters for channel list

Signed-off-by: Guido Günther <agx@sigxcpu.org>
This commit is contained in:
Guido Günther
2025-03-29 22:19:17 +00:00
committed by Dan Williams
parent d6367c76c0
commit 577639659c
2 changed files with 122 additions and 1 deletions
+105 -1
View File
@@ -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)
{
+17
View File
@@ -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_ */