====== Communication Protocol Documentation ======
===== Overview =====
The communication protocol for the TCP server is designed to handle various commands and triggers sent from a client. The protocol uses a specific format to encapsulate commands and their parameters, ensuring that the server can interpret and execute them correctly.
===== Message Format =====
Each message sent to the server must be enclosed within `[S]` (start) and `[E]` (end) markers. Commands within the message are separated by semicolons (`;`). Commands can have parameters, which are separated by colons (`:`).
===== Example Message =====
[S]trigger 123;my_command;my_second_command:123;my_string_command:"hello\nworld"[E]
===== Commands =====
The protocol supports several commands, each with specific parameters. Below are the supported commands and their formats:
1. **trigger**
- **Format:** `trigger `
- **Description:** Starts a camera trigger with the specified number as trigger id.
- **Example:** `trigger 123`
2. **ledson**
- **Format:** `ledson`
- **Description:** Turns on the LEDs.
- **Example:** `ledson`
- **DEPRECATED**: was in use with EVT cameras
3. **ledsoff**
- **Format:** `ledsoff`
- **Description:** Turns off the LEDs.
- **Example:** `ledsoff`
- **DEPRECATED**: was in use with EVT cameras
4. **carrierID**
- **Format:** `carrierID `
- **Description:** Sets the carrier ID to the specified number. This ID will be added to metadata of image.
- **Example:** `carrierID 456`
- **DEPRECATED**: use **meta ** command to set additional metadata
5. **mask**
- **Format:** `mask `
- **Description:** Sets the camera mask to the specified number. Allows to disable certain camera trigger.
- **Example:** `mask 5` - will only enable cameras 3 and 1 since 5 = 0b00000101
6. **meta**
- **Format:** `meta `
- **Description:** Sets additional metadata to an image. The metadata is reset after each trigger, so must be set **BEFORE** trigger.
- **Example:** `[S]meta:"some metadata\nsupports\nmultiple\lines";trigger 123[E]`
===== Example Calls =====
==== Single Command ====
[S]trigger 123[E]
- **Description:** Starts a camera trigger with the number 123.
==== Multiple Commands ====
[S]meta:"some metadata";carrierID 456;trigger 123[E]
- **Description:** Sets metadata to "some metadata"(without quotes), sets carrierID to 456 and triggers camera with trigger id 123