.. _rust_v2x_cli_tutorial: ======================================================= Rust V2X CLI Tool Tutorial (`v2x_cli`) ======================================================= The ``rustflexstack`` crate includes a complete command-line station, located at ``examples/v2x_cli.rs``. It demonstrates how to assemble the complete stack—from Link Layer and GeoNetworking through BTP, Security, and Facilities (CAM, DENM, VAM, and LDM)—into a single executable. Downloading Precompiled Binaries (No Compilation Required) ========================================================== You do **not** need to install Rust or clone the entire repository to use ``v2x_cli``. Standalone Linux executables are precompiled and directly downloadable from GitHub Releases: * **Official GitHub Release**: https://github.com/Fundacio-i2CAT/RustFlexstack/releases/latest Available binary packages: * ``v2x_cli`` (x86_64): For standard Intel/AMD Linux PCs, servers, and simulation testbeds. * ``v2x_cli`` (aarch64): For Arm64 platforms such as Raspberry Pi 5 and single-board computers. * ``v2x_cli_cv2x`` (aarch64): Precompiled for Cohda Wireless MK6 OBUs/RSUs operating over Qualcomm PC5 direct radio. Simply download the binary for your platform, grant execution permissions, and run: .. code-block:: bash chmod +x v2x_cli sudo ./v2x_cli --help Command-Line Options ==================== .. code-block:: text v2x_cli [OPTIONS] OPTIONS: -i, --iface Network interface [default: lo] --send Transmit CAMs or VAMs [default: receive-only] --security Enable ETSI TS 103 097 signing/verification --pki Obtain certificates from an ETSI TS 102 941 PKI (implies --security) --ea-url EA access point [default: http://localhost:8080/ea/v1/enrolment] --aa-url AA access point [default: http://localhost:8081/aa/v1/authorization] --rca-cert Root CA certificate file [default: /root_ca.cert or rca.coer] --ea-cert EA certificate file [default: /ea.cert or ea.coer] --aa-cert AA certificate file [default: /aa.cert or aa.coer] --reprovision Force reprovisioning from the PKI even if a cached AT exists --at <1|2> Authorization Ticket index (static mode) [default: 1] --certs-dir Certificate directory [default: certs/] --canonical-key Canonical private key, created when absent [default: /canonical_key.pem] --its-id Canonical identifier [default: generated from the canonical public key] --gpsd Use real GPS from gpsd [e.g. 127.0.0.1:2947] --lat Static GPS latitude [default: 41.552] --lon Static GPS longitude [default: 2.134] -h, --help Print this help ``v2x_cli_cv2x`` (C-V2X link layer, see below) takes the same options except ``-i``, ``--canonical-key`` and ``--its-id``. Common Usage Recipes ==================== 1. Receive-Only Sniffer (All Message Types) ------------------------------------------- Listen on all standard BTP ports (CAM 2001, DENM 2002, VAM 2018), decode incoming packets, and store remote vehicle positions in the Local Dynamic Map: .. code-block:: bash # Using the precompiled binary: sudo ./v2x_cli -i eth0 # Or from source: sudo cargo run --example v2x_cli -- -i eth0 2. Transmit CAMs with Static Coordinates ---------------------------------------- Broadcast Cooperative Awareness Messages at 10 Hz over interface ``eth0``: .. code-block:: bash # Using the precompiled binary: sudo ./v2x_cli -i eth0 --send cam # Or from source: sudo cargo run --example v2x_cli -- -i eth0 --send cam 3. Transmit Secured CAMs with ECDSA P-256 ----------------------------------------- Enable ETSI TS 103 097 signing using pre-generated authorization tickets: .. code-block:: bash # If building from source, generate certificate chain: cargo run --example generate_certificate_chain # Transmit secured CAMs: sudo ./v2x_cli -i eth0 --send cam --security --at 1 4. Transmit VAMs Using Live GPSD Receiver ----------------------------------------- Connect to a USB or serial GNSS receiver managed by ``gpsd``: .. code-block:: bash sudo ./v2x_cli -i wlan0 --send vam --gpsd 127.0.0.1:2947 C-V2X Direct Radio Variant (`v2x_cli_cv2x`) =========================================== For deployment on Qualcomm PC5 hardware (such as the Cohda MK6 OBU or RSU): * Download the precompiled ``v2x_cli_cv2x`` binary from the `GitHub Releases `_ page. * Copy it to the device via SCP and run: .. code-block:: bash # Transmit CAMs over real Qualcomm PC5 sidelink ./v2x_cli_cv2x --send cam # Receive packets over the air ./v2x_cli_cv2x # receive-only (default) See :ref:`Cohda MK6 Deployment Tutorial ` for the complete hardware setup guide.