# network.rs — UDP & Dummy Simulator

<p class="callout warning">This file is work in progress</p>

Exposes commands related to the UDP connection and the development simulator.

### Commands

**`<strong class="editor-theme-bold editor-theme-code">send_ping_cmd(packet_type)</strong>`**<span style="white-space: pre-wrap;"> Intended to send a ping packet to the rover over UDP. Currently logs to console — full implementation pending.</span>

**`<strong class="editor-theme-bold editor-theme-code">start_dummy_streams()</strong>`**<span style="white-space: pre-wrap;"> Starts the full multi-stream simulator. Sends fake protobuf packets to </span>`<span class="editor-theme-code">127.0.0.1:9000</span>`<span style="white-space: pre-wrap;"> mimicking live rover data. Useful for UI development without hardware. Simulator config:</span>

- Jitter: 30ms
- Simulated packet loss: 2%

**`<strong class="editor-theme-bold editor-theme-code">start_detection_sim()</strong>` Starts a single stream for the detection object stream dummy data.

**`<strong class="editor-theme-bold editor-theme-code">stop_dummy_streams()</strong>`**<span style="white-space: pre-wrap;"> Signals the running simulator to stop by setting a shared cancellation flag.</span>

<span style="white-space: pre-wrap;">The </span>`<span class="editor-theme-code">DummyStreamHandle</span>`<span style="white-space: pre-wrap;"> struct (managed Tauri state) holds the cancellation handle so any command can stop the simulator.</span>