Skip to content

IDaasApiEvent

IDaasApiEvent is the event callback interface used by the DaaS-IoT core to notify an application about runtime events (e.g. DDO reception, frisbees, synchronization milestones).

The interface is pure virtual (abstract): applications must implement all callbacks.


Where it is defined

  • IDaasApiEvent is declared in daas_types.hpp.
  • It is passed to the core through DaasAPI constructors:
  • DaasAPI(IDaasApiEvent *)
  • DaasAPI(IDaasApiEvent *, const char *lhver_)

Execution model and when callbacks can fire

The DaaS-IoT core executes through DaasAPI::doPerform(performs_mode_t mode).

  • With PERFORM_CORE_THREAD, the core operates in multi-threading mode (the call is performed once).
  • With PERFORM_CORE_NO_THREAD, the core requires cyclic calls to doPerform(...).

Callbacks in IDaasApiEvent are generated by the core while it is being performed.


Callback reference

All callbacks are mandatory (pure virtual). Signatures below match the headers.

dinAccepted(din_t din)

Notifies that a DIN is accepted by the core.

  • din: local DIN accepted (din_t is a uint64_t).

ddoReceived(int payload_size, typeset_t typeset, din_t din)

Notifies that a DDO has been received.

  • payload_size: received payload size
  • typeset: DDO typeset (typeset_t is uint16_t)
  • din: DIN associated with the received DDO (din_t)

To retrieve the inbound DDO, the core API provides:

  • pull(din_t din, DDO **inboundDDO)
  • availablesPull(din_t din, uint32_t &count)

Note: when a typeset is mapped to a handler function through the core API, the headers specify that the registered typeset does not trigger the received DDO event.


frisbeeReceived(din_t din)

Notifies the reception of a frisbee from a remote node.

  • din: DIN of the node that generated the frisbee

nodeStateReceived(din_t din)

Notifies the reception of a node state from a remote node.

  • din: DIN of the node that generated the node state

The node state data structure is defined as nodestate_t in daas_types.hpp.


atsSyncCompleted(din_t din)

Notifies that ATS synchronization has completed with a given DIN.

  • din: the remote DIN for which ATS sync completion is reported

frisbeeDperfCompleted(din_t din, uint32_t packets_sent, uint32_t block_size)

Notifies completion of a frisbee performance operation.

  • din: remote DIN involved
  • packets_sent: number of packets sent
  • block_size: block size used

Notifies that a node has been discovered.

  • din: discovered node DIN
  • link: link technology used (link_t)

link_t includes values such as _LINK_INET4, _LINK_BT, _LINK_MQTT5, _LINK_UART, etc.


nodeConnectedToNetwork(din_t sid, din_t din)

Notifies that a node has connected to a network.

  • sid: network/system identifier (type in the header is din_t)
  • din: DIN of the node

Depending on the event you receive, typical operations are performed using:

  • pull(...) / availablesPull(...) (DDO inbound flow)
  • push(...) (DDO outbound flow)
  • doPerform(...) (core execution)

See also: - DDO - Typesets - Frisbees - Time Synchronization