| Crates.io | oxirs-canbus |
| lib.rs | oxirs-canbus |
| version | 0.1.0 |
| created_at | 2025-12-26 15:13:16.974541+00 |
| updated_at | 2026-01-20 21:42:51.822336+00 |
| description | CANbus/J1939 protocol support for OxiRS semantic web platform |
| homepage | https://github.com/cool-japan/oxirs |
| repository | https://github.com/cool-japan/oxirs |
| max_upload_size | |
| id | 2005845 |
| size | 436,221 |
CANbus/J1939 protocol support for the OxiRS semantic web platform.
✅ Production Ready (v0.1.0) - Phase D: Industrial Connectivity Complete
oxirs-canbus provides native Rust implementations of CANbus (Controller Area Network) and J1939 protocols, enabling real-time RDF knowledge graph updates from automotive vehicles, heavy machinery, agricultural equipment, and other CAN-enabled systems.
Market Coverage: Ubiquitous in automotive (100%), heavy machinery (80%), agriculture (60%).
[dependencies]
oxirs-canbus = "0.1.0"
Note: Linux only (requires socketcan kernel module).
use oxirs_canbus::{CanbusClient, CanbusConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = CanbusConfig {
interface: "can0".to_string(),
dbc_file: Some("vehicle.dbc".to_string()),
filters: vec![],
};
let client = CanbusClient::new(config)?;
client.start().await?;
Ok(())
}
use oxirs_canbus::dbc::DbcParser;
use oxirs_canbus::rdf::CanRdfMapper;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Parse DBC file
let dbc = DbcParser::from_file("vehicle.dbc")?;
// Create RDF mapper
let mapper = CanRdfMapper::new(dbc);
// Connect to CAN interface
let mut client = CanbusClient::new(config)?;
// Receive CAN frames and convert to RDF
while let Some(frame) = client.recv().await? {
let triples = mapper.map_frame(&frame)?;
store.insert_batch(&triples).await?;
}
Ok(())
}
VERSION ""
BO_ 1234 EngineData: 8 Engine
SG_ EngineSpeed : 0|16@1+ (0.125,0) [0|8191.875] "rpm" ECU
SG_ EngineTemp : 16|8@1+ (1,-40) [-40|215] "deg C" ECU
SG_ ThrottlePos : 24|8@1+ (0.39215686,0) [0|100] "%" ECU
BO_ 1235 VehicleSpeed: 2 Body
SG_ Speed : 0|16@1+ (0.01,0) [0|655.35] "km/h" ECU
[[stream.external_systems]]
type = "CANbus"
interface = "can0"
dbc_file = "vehicle.dbc"
[stream.external_systems.rdf_mapping]
device_id = "vehicle001"
base_iri = "http://automotive.example.com/vehicle"
graph_iri = "urn:automotive:can-data"
# Load vcan kernel module
sudo modprobe vcan
# Create virtual CAN interface
sudo ip link add dev vcan0 type vcan
sudo ip link set up vcan0
# Verify
ifconfig vcan0
# Install CAN utilities
sudo apt-get install can-utils
# Monitor all CAN frames
candump vcan0
# Send test frame
cansend vcan0 123#DEADBEEF
The oxirs CLI provides CANbus monitoring and DBC tools:
# Monitor CAN interface with DBC decoding
oxirs canbus monitor --interface can0 --dbc vehicle.dbc --j1939
# Parse DBC file
oxirs canbus parse-dbc --file vehicle.dbc --detailed
# Decode CAN frame
oxirs canbus decode --id 0x0CF00400 --data DEADBEEF --dbc vehicle.dbc
# Generate SAMM Aspect Models from DBC
oxirs canbus to-samm --dbc vehicle.dbc --output ./models/
# Generate RDF from live CAN data
oxirs canbus to-rdf --interface can0 --dbc vehicle.dbc --output data.ttl --count 1000
# Send CAN frame
oxirs canbus send --interface can0 --id 0x123 --data DEADBEEF
See /tmp/oxirs_cli_phase_d_guide.md for complete CLI documentation.
Dual-licensed under MIT or Apache-2.0.