Skip to content

The tgtest tool

tgtest is a command-line program for Windows that talks to a TriggerGate hub from a terminal. It shows everything a hub sends, finds hubs on the network, checks a hub's OSC output and starts faceoffs with trigger actions, so you can see what TriggerGate does before your own application is written, or rule your application out when something looks wrong. Every line it prints is one JSON object, which makes its output easy to read in a script.

Get and run it

tgtest runs on 64-bit Windows and needs the .NET 11 runtime, unless you have a self-contained build. During pre-release it is supplied on request, like the packages: get in touch.

tgtest --help
tgtest observe --help

Each command lists its own options with --help. Stop a command that runs until stopped with Ctrl+C; it closes its connection and prints a done line.

Output

Every line has the same four members:

Member Meaning
t When the line was written, on this computer's clock, in UTC (ISO 8601).
elapsedMs Milliseconds since tgtest started.
event What happened: connected, edge, osc and so on.
data The details. Members that are null are left out.
{"t":"2026-11-24T14:03:22.1234567Z","elapsedMs":412.877,"event":"connected","data":{"url":"http://studio-pc:9090/TriggerGate"}}

A problem is an error line whose data has a message. The exit code is 0 when the command did what it was asked; the other codes are given with each command.

Connecting to a hub

The commands that talk to a hub share these options. tgtest connects over WebSockets with the MessagePack protocol, as the client library does, so it works with every TriggerGate, the ESP32 included.

Option Default Meaning
--host localhost The host name or address of the TriggerGate.
--port 9090 The hub port.
--platform the server's choice The platform to bind to on a server that runs more than one, such as AdvantechWindows or XKeysWindows. See Platforms and devices.
--device-index the server's choice (0) The device on that platform, 0-based, for a platform with several devices (X-keys).

observe

Connects to a hub and prints everything it learns: the initial state, the configuration and every edge.

tgtest observe --host studio-pc --duration 30
Option Meaning
--duration, -t Seconds to watch. Default: until Ctrl+C.

The lines it prints:

event Contents
connected The hub URL.
initialState The server (version, build date, platform, host name), the platforms and devices it offers and the ones this connection is bound to, the server's clock status, the service state, the platform's settings, how many inputs there are, and which of them are active now (high).
getConfig The configuration: settings, input and output pins, the server's subnets, the inputs that can raise interrupts, and the ordering resolutions in microseconds.
edge Each edge report as it arrives, with its place (ordinal), faceoff time, lockout, interrupt flag, and its own monotonicTime and absoluteTime. The line's t is when it arrived here, so t minus absoluteTime is the report's age when both clocks agree.
serviceState, config, devicesChanged, clockChanged The notifications of the same names in Hub API.
reconnecting, reconnected, closed Changes of the connection. tgtest reconnects by itself.
done The end of the run.

Exit code 2: it could not connect.

discover

Finds TriggerGates on the network by mDNS, with the same search a client application's find button uses.

tgtest discover --duration 5
Option Default Meaning
--duration, -t 5 Seconds to search.

It prints searching, then found each time the list changes, and done with the final list. Each service has its host name, port and addresses. Exit code 1: nothing was found.

osc-listen

Receives OSC datagrams and prints each one, such as those TriggerGate sends for trigger actions. It needs no hub.

tgtest osc-listen --subnet 192.168.1.0/24 --duration 30
Option Default Meaning
--group 239.255.0.1 The multicast group to join: TriggerGate's default OSC destination. none listens for unicast only.
--osc-port 9000 The UDP port to listen on.
--subnet the operating system's choice The subnet, as address/prefix, whose network interface joins the group.
--duration, -t until Ctrl+C Seconds to listen.

It prints listening, then one osc line per datagram (sender, destination address, interface, length, the decoded packet, or the error when it is malformed), and done with the counts. Packets with type tags it does not know are still shown. Exit code 1: the group or subnet is not valid. Exit code 2: no network interface on this computer has an address in the subnet.

osc-run

Asks a hub to send one OSC message through RunOsc, the path a faceoff edge uses, to check the hub's playback settings. ESP32 supports this command over IPv4 Ethernet.

tgtest osc-run --host studio-pc --subnet 192.168.1.0/24
Option Default Meaning
--address, -a /triggergate/test The OSC address. The default address carries this computer's name and a timestamp; any other address carries only the --arg values, so a cue address can be sent bare.
--arg none A string argument to add to the message. Repeat it for more.
--destination the hub's default Where the hub sends it, as address:port.
--subnet the hub's default The hub's subnet, as address/prefix, whose interface sends it.

It prints runOsc with the hub's answer, the message, its size, and the destination and subnet used. Exit code 1: the hub refused, or a value is not valid. Exit code 2: it could not connect, or the call failed.

osc-config

Reads a platform's settings, changes its default OSC destination and source subnet, writes them back and reads them again. ESP32 supports OSC defaults; its settings can be changed only when no faceoff or pre-faceoff is armed and no input is locked out.

tgtest osc-config --host studio-pc --destination 239.255.0.1:9000 --subnet 192.168.1.0/24
Option Meaning
--destination The new default destination as address:port, or none to clear it. Omit it to leave the destination as it is.
--subnet The new default source subnet as address/prefix, or none to clear it. Omit it to leave the subnet as it is.

It prints setConfig with the hub's answer, the settings sent and the settings the hub then reports. Exit code 1: the hub refused, or a value is not valid. Exit code 2: it could not connect, or the call failed.

faceoff

Starts a faceoff with an OSC action, and optionally a lighting patch, on each input's win and loss; or ends the faceoff. With osc-listen in another window you can see the winner and loser messages the hub sends, and with observe the edges. ESP32 supports OSC actions but refuses lighting actions.

tgtest faceoff --host studio-pc --inputs 0 1 --use-polling
tgtest faceoff --host studio-pc
Option Default Meaning
--inputs, -i none The inputs taking part; each one's press counts. Omit it to end the faceoff, which runs every action supplied at once.
--actions the same as --inputs The inputs to attach actions to.
--address, -a /triggergate/faceoff The OSC address prefix. The hub sends {address}/win <input> for the winner and {address}/lose <input> for every later input.
--lighting off Also attach a 3-byte lighting patch to each input, at byte input × 3. The hub logs lighting patches on .NET platforms; ESP32 refuses them.
--use-polling off Decide the faceoff by polled edges. Without it, interrupt edges decide, and the hub refuses the request if an input cannot raise interrupts, which on X-keys and the UNO is every input.
--destination the hub's default Where the actions' OSC messages go, as address:port.
--subnet the hub's default The hub's subnet whose interface sends them.

It prints resetFaceoff with the hub's answer, the inputs, which inputs have actions, the edge source and the hub's reference time. Exit code 1: the hub refused, or a value is not valid. Exit code 2: it could not connect, or the call failed. Trigger actions describes what the hub does with the actions.

v2.0.62