|
LibJuno 1.0.4
LibJuno is a lightweight C11 library designed specifically for embedded systems.
|
Public interface for SenderApp — the UDP sender application on Thread 1. More...
#include <stdint.h>#include "juno/app/app_api.h"#include "juno/sb/broker_api.h"#include "udp_api.h"#include "juno/module.h"#include "juno/types.h"

Go to the source code of this file.
Typedefs | |
| typedef struct SENDER_APP_TAG | SENDER_APP_T |
Functions | |
| struct SENDER_APP_TAG | JUNO_MODULE_DERIVE (JUNO_APP_ROOT_T, JUNO_UDP_ROOT_T *ptUdp;JUNO_SB_BROKER_ROOT_T *ptBroker;uint32_t _uSeqNum;) |
| Concrete SenderApp instance. | |
| JUNO_STATUS_T | SenderApp_Init (SENDER_APP_T *ptApp, JUNO_UDP_ROOT_T *ptUdp, JUNO_SB_BROKER_ROOT_T *ptBroker, JUNO_FAILURE_HANDLER_T pfcnFailureHandler, void *pvFailureUserData) |
| Initialize a SenderApp instance. | |
Public interface for SenderApp — the UDP sender application on Thread 1.
SenderApp implements the JUNO_APP_API_T lifecycle interface. On each scheduler cycle it builds a UDP_THREAD_MSG_T with a monotonically incrementing sequence counter, publishes it to Thread 1's software-bus broker (so MonitorApp can observe it locally), and transmits it via the UDP module to the loopback address so UdpBridgeApp on Thread 2 can receive it.
All memory is caller-owned and injected. SenderApp allocates nothing.
Typical usage:
| typedef struct SENDER_APP_TAG SENDER_APP_T |
| struct SENDER_APP_TAG JUNO_MODULE_DERIVE | ( | JUNO_APP_ROOT_T | , |
| JUNO_UDP_ROOT_T *ptUdp;JUNO_SB_BROKER_ROOT_T *ptBroker;uint32_t _uSeqNum; | |||
| ) |
Concrete SenderApp instance.
Embeds JUNO_APP_ROOT_T via JUNO_MODULE_DERIVE, accessible as JUNO_MODULE_SUPER (tRoot), enabling safe up-cast from a JUNO_APP_ROOT_T * to SENDER_APP_T * inside the lifecycle callbacks. The scheduler holds a JUNO_APP_ROOT_T * and dispatches via the vtable; each callback recovers the full struct with:
All fields other than the embedded root are either injected at SenderApp_Init time or are private mutable state (_uSeqNum). The composition root owns this struct; no field is heap-allocated.
| JUNO_STATUS_T SenderApp_Init | ( | SENDER_APP_T * | ptApp, |
| JUNO_UDP_ROOT_T * | ptUdp, | ||
| JUNO_SB_BROKER_ROOT_T * | ptBroker, | ||
| JUNO_FAILURE_HANDLER_T | pfcnFailureHandler, | ||
| void * | pvFailureUserData | ||
| ) |
Initialize a SenderApp instance.
Wires the internal static vtable into ptApp->tRoot.ptApi, stores ptUdp and ptBroker, stores the failure handler and user data into the root, and sets _uSeqNum to zero. Verifies that no required injected pointer is NULL before returning.
Must be called before any lifecycle operation. All caller-allocated storage; this function does not allocate any memory.
| ptApp | Caller-owned SenderApp storage; must be non-NULL. |
| ptUdp | UDP module root configured for sender role; must be non-NULL and outlive ptApp. |
| ptBroker | Thread 1 broker root; must be non-NULL and outlive ptApp. |
| pfcnFailureHandler | Diagnostic callback invoked before any error return; may be NULL. |
| pvFailureUserData | Opaque pointer passed to the failure handler; may be NULL. |
JUNO_STATUS_SUCCESS on success; JUNO_STATUS_NULLPTR_ERROR if any required pointer is NULL.