Commands
A command is an instruction from mobile to the dongle, sent in an encrypted packet. This document outlines commands supported by ClickStick platform.
Command structure
| Field | Size | Description |
|---|---|---|
| Command ID | 1 byte | Command identifier |
| Params | 0 – MAX_PARAM_SIZE bytes | Command-specific parameters |
- Maximum size of a command structure (
MAX_COMMAND_SIZE) is 226 bytes, due to BLE stack constraints.MAX_PARAM_SIZEis thus 225. - Unrecognized command IDs are discarded without processing.
Supported commands
START_SESSION
Completes session initialization by providing mobile's public ECDH key to the dongle.
- Command ID:
0x00 - Parameters:
mobilePublicKey: 32 bytes
- Effect: the dongle computes the
sessionKey, resetsSEQcounter and switches toIDLEmode. This command is accepted only inINIT_SESSIONstate and ignored otherwise.
Warning: Basically plaintext
Given that START_SESSION command is part of the session initiation workflow, the peers do not have the sessionKey yet and/or have mismatched seq counters. Therefore, the encrypted packet with this command is encrypted using seq = 0 and all-zero encryption key.
CANCEL
Interrupts command processing and returns the dongle to IDLE state.
- Command ID:
0x01 - Parameters: none
- Effect: the dongle stops processing the current command, clears the command queue, and returns to the
IDLEstate as soon as possible. This command is ignored inINIT_SESSIONstate.
PAUSE
Pauses command processing for the given duration
- Command ID:
0x02 - Parameters:
- Delay:
UInt16(in milliseconds) - Dummy: 0 to
MAX_PARAM_SIZE - 2bytes, optional dummy payload for traffic activity obfuscation
- Delay:
- Effect: sets
BUSYstatus and delays processing queued commands for the given duration. The delay can be interrupted by theCANCELcommand. This command is ignored inINIT_SESSIONstate.
TYPE
Emulates pressing and releasing specific keys with a fixed delay
- Command ID:
0x10 - Parameters:
- Scancodes: 1 to
MAX_PARAM_SIZEbytes
- Scancodes: 1 to
- Effect: for each scancode, the dongle produces three actions: a "key press" HID frame, a "key release" frame, and a fixed delay defined by dongle's rate limit (see SR-RateLimit)