62 if (p_producerData == NULL || p_assignedKpid == NULL)
98 if (p_consumerData == NULL)
158 if (
s_consumers[j].p_contract->consumeData == NULL)
168 (void)
s_consumers[j].p_contract->consumeData(NULL);
223 if (p_producerData == NULL || p_initResult == NULL)
242 if (p_consumerData == NULL || p_initResult == NULL)
280 if (
s_consumers[j].p_contract->deliverToMailbox == NULL)
284 if ((
s_consumers[j].subcription.value & packet.primaryHeader.apid) == 0U)
288 (void)
s_consumers[j].p_contract->deliverToMailbox(packet);
SPP_RetVal_t SPP_SERVICES_DATABANK_returnPacket(SPP_Packet_t *p_packet)
Return a packet to the pool after processing.
Static packet pool manager.
APID bitmask assignments for every SPP producer.
Compile-time configuration flags and utility macros for SPP.
static spp_uint8_t s_bufferCount
SPP_RetVal_t SPP_SERVICES_PUBSUB_getConsumerInitResult(const SPP_SERVICE_ConsumerContract_t *p_consumerData, SPP_RetVal_t *p_initResult)
void SPP_SERVICES_PUBSUB_signalProducerReady(void)
Signals that a producer has new data pending.
void SPP_SERVICES_PUBSUB_callConsumers(void)
Routes all buffered packets to matching consumer mailboxes, then clears the buffer.
SPP_RetVal_t SPP_SERVICES_PUBSUB_init(void)
static SPP_SERVICES_PUBSUB_Producer_t s_producers[K_SPP_SERVICES_PUBSUB_MAX_PRODUCERS]
spp_uint8_t SPP_SERVICES_PUBSUB_queueDepth(void)
Returns the number of packets currently held in the internal FIFO buffer.
static SPP_Packet_t s_packetBuffer[K_SPP_SERVICES_PUBSUB_BUFFER_SIZE]
static SPP_SERVICES_PUBSUB_Consumer_t s_consumers[K_SPP_SERVICES_PUBSUB_MAX_CONSUMERS]
void SPP_SERVICES_PUBSUB_callProducers(void)
Calls acquireData on every registered producer.
SPP_RetVal_t SPP_SERVICES_PUBSUB_getProducerInitResult(const SPP_SERVICE_ProducerContract_t *p_producerData, SPP_RetVal_t *p_initResult)
static void SPP_SERVICES_PUBSUB_sendToMailbox(void)
Copies each buffered packet to every consumer whose APID subscription matches, then resets the intern...
SPP_RetVal_t SPP_SERVICES_PUBSUB_registerProducer(const SPP_SERVICE_ProducerContract_t *p_producerData, SPP_Kpid_t *p_assignedKpid)
static volatile spp_bool_t s_producerReady
static spp_uint8_t s_registeredConsumers
SPP_RetVal_t SPP_SERVICES_PUBSUB_publish(SPP_Packet_t *p_pkt)
Copies a packet into the internal buffer and returns it to the databank.
SPP_RetVal_t SPP_SERVICES_PUBSUB_registerConsumer(const SPP_SERVICE_ConsumerContract_t *p_consumerData, SPP_Kpid_t subscription)
static spp_uint16_t s_registeredProducers
static spp_uint8_t s_bufferTail
static spp_uint8_t s_bufferHead
static void SPP_SERVICES_PUBSUB_sortConsumers(void)
Sorts the registered consumer array in ascending priority order using insertion sort....
Publish-subscribe packet router.
#define K_SPP_SERVICES_PUBSUB_STEP
#define K_SPP_SERVICES_PUBSUB_BUFFER_SIZE
#define K_SPP_SERVICES_PUBSUB_MAX_CONSUMERS
#define K_SPP_SERVICES_PUBSUB_PREEMPT_PRIORITY
#define K_SPP_SERVICES_PUBSUB_MAX_PRODUCERS
#define K_SPP_SERVICES_PUBSUB_SORT_START_INDEX
#define K_SPP_SERVICES_PUBSUB_ZERO_INDEX
#define K_SPP_SERVICES_PUBSUB_OFFSET
SPP_RetVal_t
Unified return type for all SPP API functions.
@ K_SPP_ERROR_NOT_INITIALIZED
@ K_SPP_ERROR_REGISTRY_FULL
@ K_SPP_ERROR_NULL_POINTER
const SPP_SERVICE_ConsumerContract_t * p_contract
const SPP_SERVICE_ProducerContract_t * p_contract
Describes the contract of a consumer module. This module needs to have:
Describes the contract of a producer module. This module needs to have: