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:
- The Gateway detects the timeout
- The timeout hook executes
- The application can react
Possible reactions:
- Display warning LEDs
- Trigger alarms
- Update displays
- Log diagnostic information
- Notify the ArmorLink App
Related Documentation
- Module Presence
- Presence API
- Gateway