Git Product home page Git Product logo

simple_socketcan_interface's Introduction

Simple sokcet CAN interface

A C++ study project that provides a flexible and extensible framework for working with CAN (Controller Area Network) communication in automotive and industrial applications. It supports both raw CAN and ISO-TP (ISO 15765-2) protocols.

Features

  • Support for raw CAN and ISO-TP protocols
  • Easy-to-use interface for sending and receiving CAN messages
  • Configurable CAN filters
  • Timeout support for read operations

Components

  1. CanDevice: Abstract base class for CAN devices
  2. RawCanDevice: Implementation for raw CAN protocol
  3. IsoTpCanDevice: Implementation for ISO-TP protocol
  4. CanDeviceFactory: Factory for CanDevice creation
  5. CanMessage: Class representing CAN messages

Usage

Here's a basic example of how to use the library:

#include "RawCanDevice.h"
#include "CanMessage.h"

int main() {
    RawCanDevice can("can0");
    can.Open();

    CanMessage::Data data{0x01, 0x02, 0x03, 0x04};
    CanMessage message(0x123, data);
    can.Send(message);

    CanMessage received_message;
    if (can.Read(received_message, 1000)) {
        // Process received message
    }

    can.Close();
    return 0;
}

TO-DO

  • Simple interface
  • Raw Protocol
  • Basic Iso-TP Protocol
  • Full Iso-TP Protocol
  • Error handling
  • Exemple of usage
  • Unit Tests
  • Integration Tests

Usefull commands

  • Opening a virtual CAN bus
sudo modprobe vcan
sudo ip link add dev vcan0 type vcan
sudo ip link set up vcan0
  • Dump Iso-Tp data
            #Txid  #Rxid
isotpdump -s 111 -d 321 vcan0
  • Send Iso-Tp data
                                     #Rxid  #Txid
echo 11 12 13 14 15 16 | isotpsend -s 321 -d 111 vcan0

simple_socketcan_interface's People

Watchers

Nycolas Coelho de Abreu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.