Skip to content

sitec-systems/jsocketcan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

jSocketCan is an framework for access to Linux SocketCAN from Java. Implements jCanInterface.

  • Control the CAN bus interface
  • Read and write CAN messages

more documentation is available on overview page of javaDoc

License

LGPLv3

Copyright (C) 2016 sitec systems GmbH

Library libsocketcan from Luotao Fu (l.fu@pengutronix.de) from Pengutronix is an Part of jSocketCAN. It is published under GNU Lesser General Public License verion 2.1 and taken from Debian project libsocketcan_0.0.10+git20140721.orig.tar.bz2.

Compatibility

  • Linux - amd64
  • Linux - armhf

Example

Reads module information and prints the file listing of the connected module

try(final Can can = SocketCan.createSocketCan("can0", 500000);)
{
    can.send(new CanFrame(0x123, CanFrame.Type.STANDARD, (byte)8, new byte[]{(byte)55, (byte)1, (byte)2, (byte)3, (byte)4, (byte)5, (byte)6, (byte)7}));
    can.addFilters(new CanFilter(0x21, 0xFF, CanFrame.Type.STANDARD));
    can.addFilters(new CanFilter(0x22, 0xFF, CanFrame.Type.STANDARD));

    System.out.println("Start receive");
    System.out.println(can.receive());
    System.out.println("End receive");
}
catch(final IOException ex)
{
    ex.printStackTrace();
}

About

jSocketCan is an framework for access to Linux SocketCAN over JNA. Implements jCanInterface.

Resources

License

Stars

Watchers

Forks

Packages

No packages published