Sending messages

Serial Modem Host Applications

tags
Serial Modem Host Applications

Messages are sent on a channel using zbus_chan_pub(). For example, to request a cloud disconnect on the cloud_chan channel:

    struct cloud_msg msg = {
        .type = CLOUD_DISCONNECT
    };

    err = zbus_chan_pub(&cloud_chan, &msg, PUB_TIMEOUT);

Zbus copies the message, so the original message struct is no longer needed after calling zbus_chan_pub(). PUB_TIMEOUT is a common publish timeout defined in lib/include/app_common.h.