diff options
author | Guido Günther <agx@sigxcpu.org> | 2025-02-22 17:20:59 +0100 |
---|---|---|
committer | Dan Williams <dan@ioncontrol.co> | 2025-03-28 20:53:52 +0000 |
commit | b83df955fa80b5ee167f8dde4dcb879e06758d9d (patch) | |
tree | 197bf51823385abdca44be5effad237247c9838d /src/mm-iface-modem-cell-broadcast.c | |
parent | 2878833f5c83fe112f579865a6d318ce8413f452 (diff) |
modem: Load current channels on startup
Signed-off-by: Guido Günther <agx@sigxcpu.org>
Diffstat (limited to 'src/mm-iface-modem-cell-broadcast.c')
-rw-r--r-- | src/mm-iface-modem-cell-broadcast.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/mm-iface-modem-cell-broadcast.c b/src/mm-iface-modem-cell-broadcast.c index a4ab41e3..f543d8f9 100644 --- a/src/mm-iface-modem-cell-broadcast.c +++ b/src/mm-iface-modem-cell-broadcast.c @@ -527,6 +527,7 @@ typedef enum { ENABLING_STEP_FIRST, ENABLING_STEP_SETUP_UNSOLICITED_EVENTS, ENABLING_STEP_ENABLE_UNSOLICITED_EVENTS, + ENABLING_STEP_GET_CHANNELS, ENABLING_STEP_LAST } EnablingStep; @@ -593,6 +594,31 @@ enable_unsolicited_events_ready (MMIfaceModemCellBroadcast *self, } static void +load_channels_ready (MMIfaceModemCellBroadcast *self, + GAsyncResult *res, + GTask *task) +{ + EnablingContext *ctx; + g_autoptr (GError) error = NULL; + g_autoptr (GArray) channels = NULL; + + ctx = g_task_get_task_data (task); + channels = MM_IFACE_MODEM_CELL_BROADCAST_GET_IFACE (self)->load_channels_finish (self, res, &error); + if (channels) { + mm_gdbus_modem_cell_broadcast_set_channels ( + ctx->skeleton, + mm_common_cell_broadcast_channels_garray_to_variant (channels)); + } else { + /* Not critical! */ + mm_obj_warn (self, "Couldn't load current channel list: %s", error->message); + } + + /* Go on with next step */ + ctx->step++; + interface_enabling_step (task); +} + +static void interface_enabling_step (GTask *task) { MMIfaceModemCellBroadcast *self; @@ -654,6 +680,19 @@ interface_enabling_step (GTask *task) ctx->step++; /* fall through */ + case ENABLING_STEP_GET_CHANNELS: + /* Read current channel list */ + if (MM_IFACE_MODEM_CELL_BROADCAST_GET_IFACE (self)->load_channels && + MM_IFACE_MODEM_CELL_BROADCAST_GET_IFACE (self)->load_channels_finish) { + MM_IFACE_MODEM_CELL_BROADCAST_GET_IFACE (self)->load_channels ( + self, + (GAsyncReadyCallback)load_channels_ready, + task); + return; + } + ctx->step++; + /* fall through */ + case ENABLING_STEP_LAST: /* We are done without errors! */ g_task_return_boolean (task, TRUE); |