Skip to content

Universal AI Communication Engine. Connect legacy (Modbus/Serial) to IoT (MQTT/BLE), analyze protocols with AI, and detect anomalies in real-time.

License

Notifications You must be signed in to change notification settings

commatea/ComX-Bridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

ComX-Bridge

Universal AI Communication Engine

"Connect all communications, analyze with AI, and extend with plugins."

Go Version License Status

Important

This project is currently in Pre-Test stage. While core functionality has been implemented, comprehensive integration testing and validation have not been completed. Thorough testing is required before production deployment.

ComX-Bridge is an open-source communication middleware that integrates and manages all communications from legacy industrial equipment (Serial, Modbus) to modern IoT devices (MQTT, BLE) with a single engine. Beyond simple data transmission, the built-in AI Engine automatically analyzes packets and detects anomalies, enhancing system reliability.


πŸ’‘ Capabilities

With ComX-Bridge, you can build the following systems with configuration only, no complex coding required:

  1. Cloud/IoT Transition for Legacy Equipment

    • Convert data from old RS-485/Serial devices to TCP, MQTT, or WebSocket for transmission to the web or cloud.
    • Example: "transmit Modbus data from a 20-year-old PLC to AWS IoT Core in real-time."
  2. Intelligent Bridge Between Heterogeneous Protocols

    • Connect Device A and Device B that use different communication methods.
    • The AI acts as an intermediary to automatically convert data formats or filter data.
    • Example: "Receive BLE sensor data and map it to registers in a Modbus TCP server."
  3. Automatic Protocol Analysis & Reverse Engineering

    • The AI analyzes unknown binary packets from undocumented equipment to deduce their structure (header, length, checksum).
    • Example: "Feed RS-232 communication logs from a defunct manufacturer's device to generate a protocol specification."
  4. Real-time Communication Monitoring & Security/Anomaly Detection

    • Monitor communication traffic in real-time and send immediate alerts when unusual patterns (anomalies) occur.
    • Example: "Detect sensors sending abnormal values or transmitting at irregular intervals due to hacking or malfunction."

✨ Advantages

  • Faster Development (No-Code/Low-Code): Build data pipelines using only YAML/JSON configuration files without writing complex communication code.
  • Powerful Compatibility (All-in-One): Supports all major industrial/IoT protocols including Serial, TCP, UDP, BLE, and MQTT.
  • Intelligent Operations (AI Inside): Goes beyond simple connections by understanding data meaning and preventing issues proactively.
  • Flexible Extensibility (Plugin System): Easily add custom logic using Go/Lua/JS plugins alongside standard features.
  • Run Anywhere (Cross-Platform): A single binary runs on all environments including Windows, Linux (x86/ARM), macOS, and Docker.

πŸ“‹ Feature List

1. Connectivity

  • Physical Layer: Serial (RS-232/422/485), Bluetooth Low Energy (BLE)
  • Network Layer: TCP/IP (Client/Server), UDP (Unicast/Multicast)
  • Application Layer: MQTT v3.1.1 (Client), WebSocket (Client/Server), HTTP/HTTPS (Client/Server)

2. Protocols

  • Industrial: Modbus RTU/TCP (Master/Slave), OPC-UA (Basic), BACnet/IP (Basic)
  • Generic: Raw Binary (Stream), Line-based (Text), Hex-String
  • Dynamic: User-defined structure-based dynamic protocols (YAML config)

3. AI Engine

  • Protocol Analyzer: Hybrid analysis (Heuristic + LLM) for unknown binary data
  • Auto-Config Generator: Automatically generates config.yaml from analysis results
  • Code Generator: Auto-generates Lua parsers and Go structs for custom protocols
  • Anomaly Detector: Statistical anomaly detection for communication intervals, values, and packet sizes (Z-Score)
  • Generative AI: Natural Language (Text-to-Config) for configuration generation and control
  • LLM Providers: Support for OpenAI, Google Gemini, Anthropic Claude, Ollama
  • Auto Optimizer: Automatic tuning of timeouts and retries
  • Digital Twin: Device simulation and virtual testing

4. Extensibility

  • Plugin System: Go (.so) and Script (Lua/JavaScript) based plugins
  • Language Bindings: APIs for integration with C/C++, C#, Python, Rust, etc.
  • Remote Control: Remote control and monitoring via gRPC/WebSocket APIs

5. Production Ready

  • Reliability: Config Validation, Panic Recovery, Data Persistence (SQLite Buffering), Active-Standby Failover
  • Security: Multi-User Authentication (JWT/API Key), TLS/mTLS Encryption, Role-based Access
  • Observability: Structured Logging (JSON), Prometheus Metrics
  • Management: Web Admin Dashboard (React)

πŸš€ Getting Started

1. Installation

Go language must be installed (1.24+ recommended).

# Download source and build
git clone https://github.com/commatea/ComX-Bridge.git
cd ComX-Bridge
go build -o comx.exe ./cmd/comx

2. Configuration

Create a config.yaml file to define gateways.

# config.yaml example
version: "1.0"

gateways:
  # 1. Modbus RTU Gateway (Serial)
  - name: "machinery-01"
    enabled: true
    transport:
      type: "serial"
      address: "COM3" # Windows
      options:
        baudrate: 9600
    protocol:
      type: "modbus-rtu"
      options:
        slave_id: 1

  # 2. MQTT Uplink (Cloud)
  - name: "cloud-uplink"
    enabled: true
    transport:
      type: "mqtt"
      options:
        broker: "tcp://broker.emqx.io:1883"
        topic: "factory/data"

ai:
  enabled: true
  features:
    anomaly_detection: true # Enable anomaly detection
    protocol_analysis: true # Enable packet analysis

3. Usage

# 1. Start Engine
./comx.exe start -c config.yaml

# 2. Check Status
./comx.exe status

# 3. Data Transmission Test (CLI)
# Send data to machinery-01 gateway
./comx.exe send machinery-01 "010300000001840A" --hex

πŸ“š Documentation

For more details, please refer to the documents in the docs/ directory.

Document Description
πŸ“– Architecture System overview and data flow
πŸ“– Transports Guides for Serial, TCP, UDP, BLE drivers
πŸ“– Protocols Details on Modbus, BACnet, OPC-UA protocols
πŸ“– AI Engine Anomaly detection, code generation, NLP features
πŸ“– Plugins Plugin development and extension guide
πŸ“– Bindings Integration guides for C/C++, C#, Python
πŸ“– Production Guide Security, HA, and monitoring configuration
πŸ“– Rule Engine Lua/JS based edge rule engine guide
πŸ“– Web Admin Web Admin Dashboard usage

πŸ—οΈ Architecture

graph TD
    User[User/APP] --> API[Unified API / CLI]
    
    subgraph "ComX-Bridge Core"
        API --> Engine[Engine Core]
        
        Engine --> AI[AI Engine]
        AI --> Analyzer[Protocol Analyzer]
        AI --> Detector[Anomaly Detector]
        
        Engine --> GW[Gateway Manager]
        GW --> TP[Transport Layer]
        GW --> PL[Protocol Layer]
        
        TP --> Serial[Serial]
        TP --> TCP[TCP/UDP]
        TP --> IoT[MQTT/WS/HTTP]
        TP --> BLE[BLE Sim]
        
        PL --> Modbus[Modbus]
        PL --> Standard[BACnet/OPC-UA]
        PL --> Custom[Custom Plugin]
    end
    
    TP --> Device[External Device/Sensor]
Loading

βœ… Status

Category Feature Status Note
Core Engine / Config / CLI βœ… Done
Transport Serial / TCP / UDP βœ… Done
MQTT / WebSocket / HTTP βœ… Done
BLE βœ… Done Real Implementation (TinyGo)
Protocol Raw / Modbus RTU / TCP βœ… Done
BACnet (BVLC) βœ… Done Basic structure implemented
OPC-UA (OCPF) βœ… Done Header parsing implemented
AI Protocol Analyzer βœ… Done Heuristic
Anomaly Detector βœ… Done Statistical (Z-Score)
Code Generator βœ… Done Template Based
NLP Commander βœ… Done Keyword Based
LLM Providers βœ… Done OpenAI/Gemini/Claude/Ollama
Auto Optimizer βœ… Done Timeout/Retry Tuning
Digital Twin βœ… Done Device Simulation
Binding C API / gRPC βœ… Done Source implemented (GCC/Protoc required)
API gRPC Server βœ… Done pkg/api/grpc
WebSocket API βœ… Done Pub/Sub supported
Production Security (Auth/TLS) βœ… Done JWT, Multi-User, mTLS
Persistence (SQLite) βœ… Done Auto-Retry Buffering
HA (Failover) βœ… Done Active-Standby
Feature Web Admin βœ… Done React Dashboard
Edge Rule Engine βœ… Done Lua + JavaScript

πŸ€– AI Collaboration Disclosure

This project was developed through collaboration between a Human Architect and AI.

  • Ideation & Architecture: The overall project idea, core architecture, and interface design were conceptualized and designed by a Human Architect.
  • Code Implementation: The actual source code implementation, refactoring, and debugging were performed by Google Gemini and Anthropic Claude AI models.

Note: This project demonstrates the capabilities of Agentic AI. The Idea and Architecture were strictly conceptualized by a human, while the Code Generation was primarily executed by AI Agents (Gemini & Claude).


License

Apache License 2.0. See LICENSE for details.

About

Universal AI Communication Engine. Connect legacy (Modbus/Serial) to IoT (MQTT/BLE), analyze protocols with AI, and detect anomalies in real-time.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published