Skip to main content

Module trigger

Module trigger 

Source
Expand description

This module provides functionality to define, manage, and track triggers, which represent event-based activations identified by NFC tags (NfcUid).

Triggers can be configured with different usage policies, such as single use, limited number of uses, or duration-based activation. The module supports both local (per client) and global triggers.

§Key types

  • TriggerOccurrence: Specifies how often or for how long a trigger remains active.
  • TriggerSpec: Defines the properties of a trigger including its type and occurrence.
  • [ActiveTrigger]: Tracks usage and activation time for an active trigger instance.
  • TriggerRegistry: Holds trigger specifications and active triggers, providing methods to activate and check triggers per client.

§Usage

To use triggers, initialize a TriggerRegistry with your trigger specifications, then activate triggers upon NFC scans (NfcUid) and check their active status for clients.

The registry automatically manages usage counts and expiration of active triggers.

Structs§

TriggerRegistry
Registry that manages trigger specifications and tracks active triggers.
TriggerSpec
Defines the specification of a trigger, including its activation policy and type.

Enums§

TriggerOccurrence
Specifies how often or for how long a trigger should remain active.