Solaris Software
Loading...
Searching...
No Matches
service.h
Go to the documentation of this file.
1/**
2* @file service.h
3* @brief SPP module descriptor and registry API.
4*/
5
6#ifndef SPP_SERVICE_H
7#define SPP_SERVICE_H
8
9#include "spp/core/types.h"
11#include "spp/core/packet.h"
12#include "spp/services/kpid.h"
13
14/* ----------------------------------------------------------------
15 * STRUCTS AND ENUMS
16 * ---------------------------------------------------------------- */
17
18/**
19 * @brief Defines the callbacks and metadata of an SPP producer.
20 *
21 * The producer KPID is assigned during PUBSUB registration.
22 * The timeout field is currently not enforced.
23 */
24typedef struct
25{
26 const char *p_nameProducer; /**< Human-readable module name (for logging). */
27 spp_uint16_t tiemoutMs; /**< Timeout for the producer to send a packet (currently unused)*/
28 SPP_RetVal_t (*init)(); /**< Initialise the module. */
29 SPP_RetVal_t (*acquireData)(); /**< Acquire data from the module. */
31
32/**
33* @brief Describes the contract of a consumer module. This module needs to have:
34* - a consumer ID
35* - a name
36* - a timeout (optional)
37* - a consumeData function
38*/
39typedef struct
40{
41 spp_int8_t priority; /**< Priority of the consumer */
42 const char *p_nameConsumer; /**< Human-readable module name (for logging). */
43 spp_uint16_t tiemoutMs; /**< Timeout for the consumer to receive a packet */
44 SPP_RetVal_t (*init)(); /**< Initialise the module. */
45 SPP_RetVal_t (*deliverToMailbox)(const SPP_Packet_t packet); /**< Receives a packet dispatched by PUBSUB. */
46 SPP_RetVal_t (*consumeData)(void *p_data); /**< Consume data from the module. */
48
49
50#endif /* SPP_SERVICE_H */
APID bitmask assignments for every SPP producer.
Solaris Packet Protocol (SPP) packet structure definitions.
SPP_Packet_t
Definition packet.h:79
Standard return-value type used across all SPP modules.
SPP_RetVal_t
Unified return type for all SPP API functions.
Definition returnTypes.h:24
Describes the contract of a consumer module. This module needs to have:
Definition service.h:40
SPP_RetVal_t(*) consumeData(void *p_data)
Definition service.h:46
SPP_RetVal_t(*) deliverToMailbox(const SPP_Packet_t packet)
Definition service.h:45
SPP_RetVal_t(*) init()
Definition service.h:44
Defines the callbacks and metadata of an SPP producer.
Definition service.h:25
SPP_RetVal_t(*) acquireData()
Definition service.h:29
SPP_RetVal_t(*) init()
Definition service.h:28
Portable integer types and SPI/storage configuration types for SPP.
uint16_t spp_uint16_t
Definition types.h:29
int8_t spp_int8_t
Definition types.h:28