Files
video-setup/docs/cli/protocol_cli.md
mikael-lovqvists-claude-agent 44090c1d6d docs: write CLI docs for all 12 previously undocumented tools
Add docs/cli/ entries for:
  transport_cli, discovery_cli, config_cli, protocol_cli, query_cli,
  test_image_cli, xorg_cli, v4l2_view_cli, stream_send_cli,
  stream_recv_cli, reconciler_cli, controller_cli

Each doc covers: description, build instructions, full usage with all
options and defaults, example output, and a relationship note pointing
to related tools. controller_cli includes the display control IDs table
and notes its temporary status.

README.md: convert all CLI tool entries to links.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 00:45:27 +00:00

65 lines
1.7 KiB
Markdown

# protocol_cli
A development tool for testing the protocol layer in isolation. Runs a server that decodes and prints all incoming control messages, or a client that connects and sends a sample STREAM_OPEN request.
---
## Build
From the repository root:
```sh
make cli
```
The binary is placed in `build/cli/`.
---
## Usage
### Server mode
```sh
./protocol_cli --server [port]
```
Default port: `8000`. Listens for connections and prints a decoded description of every received frame.
Example output on an incoming STREAM_OPEN:
```
CONTROL_REQUEST request_id=1 STREAM_OPEN stream_id=1 format=0x0001 pixel_format=0x0000 origin=0x0001
```
Recognised message types and commands:
| Type | Description |
|---|---|
| `VIDEO_FRAME` | stream_id + compressed payload |
| `STREAM_EVENT` | stream_id + event code (INTERRUPTED / RESUMED) |
| `CONTROL_REQUEST` | request_id + command (STREAM_OPEN, STREAM_CLOSE, ENUM_DEVICES, ENUM_CONTROLS, GET_CONTROL, SET_CONTROL, ENUM_MONITORS) |
| `CONTROL_RESPONSE` | request_id + status (OK, ERROR, UNKNOWN_CMD, INVALID_PARAMS, NOT_FOUND) |
### Client mode
```sh
./protocol_cli --client <host> <port>
```
Connects to the server and sends a single STREAM_OPEN request, then waits for the response.
Example:
```sh
./protocol_cli --client 127.0.0.1 8000
```
---
## Relationship to the Video Routing System
`protocol_cli` exercises the `protocol` module that all nodes use to encode and decode wire messages. Pairing the server with a running node lets you inspect raw control traffic; pairing the client with a running node lets you inject individual commands for debugging.
See also: [`transport_cli.md`](transport_cli.md) for raw frame-level testing without protocol parsing.