Skip to content
Start free evaluation

pdcomm::Secs1Event

Class

Owned, immutable snapshot of one SECS-I endpoint event.

class Secs1Event

Declared in: #include <pdcomm_secs1.hpp>

Secs1Endpoint::nextEvent() returns events in the order they were queued. info() tells the kind: a received message (PDCOMM_SECS1_EVENT_INBOUND), block-level delivery of a submitted message (PDCOMM_SECS1_EVENT_OUTBOUND_COMPLETE), a submission that was not delivered (PDCOMM_SECS1_EVENT_OUTBOUND_FAILED) or a terminal fault (PDCOMM_SECS1_EVENT_FAULT). body() copies the body of a received message.

Unlike the endpoint, an event is not bound to the endpoint's thread, and it stays valid after the endpoint is destroyed.

Notes

  • Move-only RAII wrapper over PdcommSecs1Event. info() and body() may run concurrently on any thread; destruction must not race with them. body() can also throw std::bad_alloc.

Members

Secs1Event

Constructor

Creates an empty event that owns no native handle.

Secs1Event() noexcept = default

Declared in: #include <pdcomm_secs1.hpp>

Secs1Event

Constructor

Takes ownership of the native handle owned by other.

Secs1Event(Secs1Event &&other) noexcept

Declared in: #include <pdcomm_secs1.hpp>

Parameters

NameDescription
otherSource wrapper; it becomes empty.

Secs1Event

Constructor

Copying is disabled; the wrapper exclusively owns its native handle.

Secs1Event(const Secs1Event &) = delete

Declared in: #include <pdcomm_secs1.hpp>

body

Method

Copies the body of a received message.

std::vector<uint8_t> body() const

Declared in: #include <pdcomm_secs1.hpp>

The bytes are the reassembled message body exactly as received; the endpoint does not parse it as SECS-II. The copy is empty for a message without a body and for every event kind other than PDCOMM_SECS1_EVENT_INBOUND.

Returns

An independent copy of the body.

Notes

  • Throws pdcomm::Error: PDCOMM_INVALID_ARGUMENT when the event is empty.

info

Method

Describes the event with pdcomm_secs1_event_info().

PdcommSecs1EventInfo info() const

Declared in: #include <pdcomm_secs1.hpp>

Fields that do not apply to the event kind are zero. A received message carries the block header fields (device ID, direction from the R-bit, stream, function, W-bit and system bytes) and the body length. Outbound events, and a fault that aborted a submission, carry the submission token. A fault carries fault_kind, fault_detail and discarded_partial.

Returns

The description, with struct_size set by the library.

Notes

  • Throws pdcomm::Error: PDCOMM_INVALID_ARGUMENT when the event is empty.

operator bool

Method

Reports whether the wrapper owns a native event.

explicit operator bool() const noexcept

Declared in: #include <pdcomm_secs1.hpp>

Secs1Endpoint::nextEvent() returns an empty event when its queue is empty.

Returns

true when an event is owned.

operator=

Method

Releases the current handle, then takes ownership of the handle owned by other.

Secs1Event &operator=(Secs1Event &&other) noexcept

Declared in: #include <pdcomm_secs1.hpp>

Parameters

NameDescription
otherSource wrapper; it becomes empty.

Returns

This wrapper.

operator=

Method

Copy assignment is disabled; the wrapper exclusively owns its native handle.

Secs1Event &operator=(const Secs1Event &) = delete

Declared in: #include <pdcomm_secs1.hpp>

~Secs1Event

Method

Releases the native event with pdcomm_secs1_event_destroy().

~Secs1Event()

Declared in: #include <pdcomm_secs1.hpp>

Any thread may release an event. An empty event releases nothing.