FlexStack

FlexStack(R) Overview

  • Overview
    • Modules
  • Getting Started
    • Installation
    • Setting up the example
      • Logging
      • Location Service
      • Link Layer
      • GeoNetworking
      • BTP
      • Facilities Layer
    • Complete Script
  • FlexStack Architecture

FlexStack(R) Modules

  • Link Layer
    • CV2XLinkLayer
      • Overview
      • Components
      • Building the Library
      • Summary
  • GeoNetworking (GN)
    • Diagram
    • Usage
      • Router Instantiation
      • Request Sending GeoNetworking Packet
      • Receiving GeoNetworking Packet
  • Security Layer
  • Basic Transport Protocol (BTP)
    • Diagram
    • Usage
      • Router Instantiation
      • Request Sending BTP Packet
      • Response Receiving BTP Packet
    • Example
  • Applications Layer
  • Utils

Facilities Services

  • Cooperative Awareness (CA) Basic Service
    • Introduction
    • Diagram
    • Usage
    • Basic Script sending and receiving CAMs
  • VRU Awareness Service
    • VRU Awareness Messages Overview
      • VRU Basic Service Management
      • VRU Cluster Management
      • VAM Reception Management
      • VAM Transmission Management
      • VAM Encoding & Decoding
    • Quickstart
    • Interfacing with the VRU Basic Service
  • Decentralized Environmental Notification (DEN) Service
    • DENM Overview
      • DEN Service
      • DEN Reception Management
      • DEN Transmission Management
    • Application Layer: Emergency Vehicle Approaching Service
    • Quickstart
  • Local Dynamic Map
    • Local Dynamic Map Overview
      • Local Dynamic Map Service
      • Local Dynamic Map Maintenance
    • LDM Declaration
      • LDM Data Providers
      • LDM Data Consumers
      • LDM Data Object
      • LDM Area of Maintenance
    • Local Dynamic Map Interfacing Options
      • LDM Publish Interface
      • LDM Query Interface
      • LDM Publish/Subscribe Interface
    • Quickstart
    • Interfacing with the VRU Basic Service

Tutorials

  • Docker Deployment
  • Sending and Recieving V2X Messages Through Ethernet
  • Logging
    • Logging Configuration
      • Simple Configuration Logging
      • File Configuration Logging
FlexStack
  • Link Layer
  • View page source

Link Layer

CV2XLinkLayer

Overview

cv2xlinklayer is a C++ library that provides an interface for Cellular Vehicle-to-Everything (C-V2X) communication. It interacts with a telematics SDK (telux_cv2x) to establish and manage transmission (Tx) and reception (Rx) flows. The library is exposed to Python using pybind11, allowing Python scripts to send and receive C-V2X messages.

Components

cv2x_link_layer.cpp

This file implements the main logic of the C-V2X communication layer, including:

  • Initialization of the Cv2xRadioManager.

  • Setup of transmission (Tx) and reception (Rx) flows.

  • Callbacks for handling C-V2X status updates and data reception.

  • A send method for transmitting data.

  • A receive method for reading incoming messages.

  • Integration with pybind11 for Python compatibility.

cv2x_link_layer.hpp

This header file declares the CV2XLinkLayer class and its methods.

CMakeLists.txt

This file defines the build process, including:

  • Minimum required CMake version (3.12).

  • Setting the project name (cv2xlinklayer).

  • Enforcing C++11 standard.

  • Finding and linking pybind11 and telux_cv2x.

  • Generating a shared library (cv2xlinklayer.so).

Building the Library

Prerequisites

Ensure the following dependencies are installed:

  • CMake (>= 3.12)

  • pybind11

  • telux_cv2x SDK

  • A C++11-compliant compiler

Build Steps

mkdir build && cd build
cmake ..
make

The output shared library (cv2xlinklayer.so) will be placed in the lib directory.

Using the Library in Python

Importing the Module

import cv2xlinklayer

Creating an Instance

link_layer = cv2xlinklayer.CV2XLinkLayer()

Sending Data

data = "Hello, C-V2X!"
link_layer.send(data)

Receiving Data

received_data = link_layer.receive()
print(received_data)

Summary

This project enables C-V2X communication through a C++ library exposed to Python. By using pybind11, Python applications can seamlessly integrate with the underlying C++ logic for transmitting and receiving C-V2X messages.

Previous Next

© Copyright 2025, i2CAT Foundation.

Built with Sphinx using a theme provided by Read the Docs.