Skip to main content

Module Timeout Detection

This example demonstrates how a Gateway can react when a paired module goes offline.

Complete Example

#include <ArmorLink.h>

ArmorLinkModule module(
"Gateway",
ArmorLinkModuleType::Generic
);

void setup()
{
Serial.begin(115200);

ArmorLinkOptions options;
options.enableGateway = true;

ArmorLink.begin(module, options);

ArmorLink.setModuleTimeoutHook(
[](const ArmorLinkStoredPairedModule& module,
uint32_t silentMs)
{
Serial.printf(
"%s offline for %lu ms\n",
module.name,
silentMs
);
});
}

void loop()
{
ArmorLink.loop();
}

What Happens

When a paired module exceeds the configured timeout:

  1. The Gateway detects the timeout
  2. The timeout hook executes
  3. The application can react

Possible reactions:

  • Display warning LEDs
  • Trigger alarms
  • Update displays
  • Log diagnostic information
  • Notify the ArmorLink App
  • Module Presence
  • Presence API
  • Gateway