The events object is designed to handle various actions and events within the application. It includes a function called onAction that allows you to define custom behaviour based on the type of action triggered. The onAction function is a callback that is invoked whenever an action occurs in your Read Point. You can use it to respond to different types of actions by inspecting the action parameter passed to the callback function.

Action Types:

Actions in your application are identified by their type property, which can have one of the following values:

  • RfidArrive: Generated when new RFID tags are read by the reader.
  • RfidStay: Generated when tags are present for a given number of time (RfidStay events should be enabled in the settings).
  • RfidLeave: Generated when RFID tags are no longer read by the reader.
  • RfidCurrent: Shows the RFID tags currently read by the reader (RfidCurrent events should be enabled in the settings).
  • RfidAntennaChange: Generated when there is a change in the RFID antenna configuration of the reader.
  • RfidAccessResult: Indicates the result of an RFID access operation (for example writing a tag).
  • RfidEnabledChange: Generated when the RFID reader is enabled or disabled.
  • HandheldTriggerChange: Indicates when a handheld device triggerIndicates changes in handheld trigger events.
  • GpiChange: Generated when there is a change in the state of General Purpose Inputs (GPIs).
  • BarcodeRead: Generated when a Barcode is read.
  • NoBarcodeRead: Generated when no barcode is read within a certain time frame.
  • PrinterLabelPrinted: Indicates that a label has been printed.
  • AutomationTunnelContainerEnter: Triggered when a container enters an automation tunnel.
  • AutomationTunnelContainerExit: Triggered when a container exits an automation tunnel.
  • HookResult: Represents the result of a hook operation.
  • State: Generated when state changes occur.
  • External: Generated by external triggers ( this can be used to create integrations from outside of Harmony ).

Example code:

events.onAction = (action) => {
  console.log('Action', action)

  switch (action.type) {
    case 'RfidAccessResult':
      // Handle RfidAccessResult action
      // ...

    case 'RfidArrive':
      // Handle RfidArrive action
      // ...

    case 'RfidStay':
      // Handle RfidStay action
      // ...