Skip to content

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

FieldSizeDescription
Command ID1 byteCommand identifier
Params0 – MAX_PARAM_SIZE bytesCommand-specific parameters
  • Maximum size of a command structure (MAX_COMMAND_SIZE) is 226 bytes, due to BLE stack constraints. MAX_PARAM_SIZE is 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, resets SEQ counter and switches to IDLE mode. This command is accepted only in INIT_SESSION state 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 IDLE state as soon as possible. This command is ignored in INIT_SESSION state.

PAUSE

Pauses command processing for the given duration

  • Command ID: 0x02
  • Parameters:
  • Effect: sets BUSY status and delays processing queued commands for the given duration. The delay can be interrupted by the CANCEL command. This command is ignored in INIT_SESSION state.

TYPE

Emulates pressing and releasing specific keys with a fixed delay

  • Command ID: 0x10
  • Parameters:
    • Scancodes: 1 to MAX_PARAM_SIZE bytes
  • 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)