Sending messages

Asset Tracker Template

tags
Asset Tracker Template

Messages are sent on a channel using zbus_chan_pub(). For example, to send a message to the NETWORK channel:

        struct network_msg msg = {
                .type = NETWORK_DISCONNECT
        };

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

Zbus copies the message, so the original message struct is no longer needed after calling zbus_chan_pub().