Pairing
Pairing connects a module to an ArmorLink Gateway.
A module must be paired with a Gateway before it can participate in an ArmorLink network.
For more information about the Gateway role, see Gateway.
Why Pairing?
ArmorLink networks are built around one Gateway and one or more modules.
Pairing tells a module which Gateway it belongs to and allows the Gateway to remember that module for future communication.
Once paired, the module becomes part of the ArmorLink network and can send and receive Commands through the Gateway.
For more information about Commands, see Commands.
Pairing Ownership
Pairing information is stored persistently.
The Gateway stores information about paired modules.
A paired module stores information about its Gateway.
This allows modules and the Gateway to restore their relationship after rebooting.
Pairing Flow
Pairing is initiated on the Gateway.
During pairing, the Gateway opens a temporary pairing window.
Gateway enters pairing mode
|
v
Gateway broadcasts pairing announcement
|
v
Unpaired modules respond
|
v
Gateway lists pairing candidates
|
v
User accepts a candidate
|
v
Gateway and module store pairing information
|
v
Pairing complete
Only modules that are not already paired with a Gateway respond as pairing candidates.
Starting Pairing
Pairing can be started in two ways:
- Through the ArmorLink App
- Through the Gateway serial interface
Both methods start pairing on the Gateway.
The Gateway then broadcasts that it is ready for pairing.
Pairing Through the ArmorLink App
The ArmorLink App can start pairing on the connected Gateway.
The App communicates with the Gateway over BLE.
The Gateway then handles the actual pairing process over ESP-NOW.
ArmorLink App
|
v
Gateway starts pairing
|
v
Unpaired modules respond
|
v
User selects module in App
|
v
Gateway accepts module
The App acts as the user interface for pairing.
The Gateway remains responsible for pairing and storing the paired module.
Pairing Through Serial
Pairing can also be performed without the ArmorLink App by using the Gateway serial interface.
This is useful during development, testing or when no mobile device is available.
Serial pairing requires the Gateway to have the serial menu enabled.
Example option:
ArmorLinkOptions options;
options.enableGateway = true;
options.enableSerialMenu = true;
Once the Gateway is running, open the Serial Monitor and use the serial menu commands.
Serial Menu Commands
The Gateway serial menu supports the following commands:
| Command | Description |
|---|---|
help or ? | Show the serial menu help |
start or startpairing | Start the pairing window |
stop or stoppairing | Stop the pairing window |
candidates | List discovered pairing candidates |
pair <number> | Pair a candidate by list number |
modules or list | List paired modules |
unpair <number> | Unpair a module by list number |
unpair <mac> | Unpair a module by MAC address |
Example serial pairing flow:
start
candidates
pair 1
modules
Pairing Candidates
When pairing mode is active, unpaired modules respond to the Gateway pairing announcement.
These modules appear as pairing candidates.
A candidate typically contains information such as:
- Module name
- Module type
- MAC address
The user can then select which candidate should be accepted.
Paired Modules
Once a module has been paired, the Gateway stores it as a known module.
The Gateway can use this information to route Commands and provide module discovery information to the ArmorLink App.
For more information about module discovery, see Gateway.
Unpairing
Modules can also be removed from the Gateway.
Through the serial menu, this can be done by using either the module list number or the module MAC address.
Examples:
unpair 1
unpair AA:BB:CC:DD:EE:FF
Unpairing removes the module from the Gateway's stored module list.
Important Notes
Every ArmorLink network has exactly one Gateway.
A module should only be paired with one Gateway at a time.
If a module is already paired with a Gateway, it will not participate as a normal pairing candidate for another Gateway.
Summary
Pairing connects modules to an ArmorLink Gateway.
Pairing:
- Is initiated on the Gateway
- Can be started through the App or Serial
- Uses a temporary pairing window
- Discovers unpaired modules as candidates
- Stores pairing information persistently
- Allows the Gateway to route Commands to known modules
Pairing is required before a module becomes part of an ArmorLink network.