pdcomm_gem_spool_capture
Function
Offers a generic primary message to the spool.
PdcommStatus pdcomm_gem_spool_capture(PdcommTcpEndpoint *endpoint, uint8_t stream, uint8_t function, uint8_t wait, const PdcommSecsItem *body, uint64_t now, PdcommGemSpoolWriteInfo *info)The message is validated first: the stream must be 2 to 127, the function odd, and a W1 message cannot use function 255; the body must be one valid item within the GEM item limits and max_body_bytes. The message is then stored only if spooling is enabled and active, the key is in the catalog, and the selection includes it. Otherwise the call returns #PDCOMM_OK with selected and applied 0, and the application should send the message live. A full spool applies the overflow policy: discarding the new message is reported as #PDCOMM_GEM_SPOOL_DISCARDED, an applied statistics change.
Capture copies the encoded body; it does not change live publishing, current values, or alarm observation.
Parameters
| Name | Description |
|---|---|
endpoint | Synchronized endpoint with an Equipment spool. |
stream | Stream of the message. |
function | Primary function of the message. |
wait | 1 to store the message with the W bit; must be 0 or 1. |
body | Message body, or NULL for a header-only message. |
now | Application timestamp stored as the capture time. |
info | Receives the outcome. Must not be NULL. |
Returns
#PDCOMM_OK on success, including not selected; #PDCOMM_SPOOL_UNCONFIRMED when stored without a confirmed directory sync; #PDCOMM_INVALID_ARGUMENT for a NULL or short info, wait above 1, an invalid message key, or a NULL endpoint; #PDCOMM_INVALID_STATE when the spool is missing or not synchronized; #PDCOMM_LIMIT_EXCEEDED when the body exceeds an item or spool limit; #PDCOMM_INVALID_DATA when the body is not a valid item; #PDCOMM_BACKPRESSURE when a staged TCP event is pending or the only entry that could be overwritten is in delivery; a persistence error such as #PDCOMM_IO_ERROR (spool unchanged); #PDCOMM_ALLOCATION_FAILED or #PDCOMM_POISONED.