Giter Club home page Giter Club logo

libsocket-can-java's Introduction

libsocket-can-java's People

Contributors

frankkusters avatar strssndktn avatar yegorich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libsocket-can-java's Issues

response time problem

Hi

i have one problem with libsocket-can-java.I send a can frame and the microcontroler in another site receive mess and response with ack but i don receive this ack but with candump i see that i receive the can frame but in java no ack.In microcontroler i enter time delay so the microcontroler now receive the message from me and after 10ms response with ack and know in java i receive the ack.What is the time that java is needed?Or this is another problem?Pls help me.

p.s.In java i have main that only receive canframe and is puting in fifo and another thread poll frames from this fifo.

Gligor Shijakovski

Release

Any plans to release this to maven central?

Makefile gnu compiler version?

I ran make and get this:

g++ -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -fPIC -Wall -pedantic -std=gnu++11 -D_REENTRANT -D_GNU_SOURCE -I/opt/java/jdk1.7.0/include -I/opt/java/jdk1.7.0/include/linux -Wl,-soname,jni_socketcan -shared -o lib/libjni_socketcan.so
jni/cansocket.cpp
jni/cansocket.cpp: In function ‘jint Java_de_entropia_can_CanSocket__1fetch_1CAN_1MTU(JNIEnv_, jclass)’:
jni/cansocket.cpp:275:9: error: ‘CAN_MTU’ was not declared in this scope
jni/cansocket.cpp: In function ‘jint Java_de_entropia_can_CanSocket__1fetch_1CAN_1FD_1MTU(JNIEnv_, jclass)’:
jni/cansocket.cpp:281:9: error: ‘CANFD_MTU’ was not declared in this scope
jni/cansocket.cpp: In function ‘jint Java_de_entropia_can_CanSocket__1fetch_1CAN_1RAW_1FD_1FRAMES(JNIEnv_, jclass)’:
jni/cansocket.cpp:312:9: error: ‘CAN_RAW_FD_FRAMES’ was not declared in this scope
jni/cansocket.cpp:313:1: warning: control reaches end of non-void function [-Wreturn-type]
jni/cansocket.cpp: In function ‘jint Java_de_entropia_can_CanSocket__1fetch_1CAN_1FD_1MTU(JNIEnv_, jclass)’:
jni/cansocket.cpp:282:1: warning: control reaches end of non-void function [-Wreturn-type]
jni/cansocket.cpp: In function ‘jint Java_de_entropia_can_CanSocket__1fetch_1CAN_1MTU(JNIEnv_, jclass)’:
jni/cansocket.cpp:276:1: warning: control reaches end of non-void function [-Wreturn-type]
make: *_* [stamps/compile-jni] Error 1

I'm using Kernel version 2.6.32-45-generic and gnu compiler version 4.7 in Ubuntu 10.04. Are these errors due to the "experimental" support of -std=gnu++11 ?

Cheers.

running make

This is exactly what I have been looking for, but I cannot seem to make the shared library. I am running Ubuntu 10.04 and java-6-openjdk.

executing make gives these errors

$ make all
mkdir stamps classes classes.test lib dist
/usr/lib/jvm/java-6-openjdk/bin/javac -g -Xlint:all -d classes src/de/entropia/can/CanSocket.java
src/de/entropia/can/CanSocket.java:53: '{' expected
            try (final InputStream libstream =
               ^
src/de/entropia/can/CanSocket.java:53: illegal start of expression
            try (final InputStream libstream =
                 ^
src/de/entropia/can/CanSocket.java:53: not a statement
            try (final InputStream libstream =
                ^
src/de/entropia/can/CanSocket.java:53: ';' expected
            try (final InputStream libstream =
                                  ^
src/de/entropia/can/CanSocket.java:54: ';' expected
                    CanSocket.class.getResourceAsStream(fileName)) {
                                                                 ^
src/de/entropia/can/CanSocket.java:58: '{' expected
                try (final OutputStream fout = Files.newOutputStream(tempSo,
                   ^
src/de/entropia/can/CanSocket.java:58: illegal start of expression
                try (final OutputStream fout = Files.newOutputStream(tempSo,
                     ^
src/de/entropia/can/CanSocket.java:58: not a statement
                try (final OutputStream fout = Files.newOutputStream(tempSo,
                    ^
src/de/entropia/can/CanSocket.java:58: ';' expected
                try (final OutputStream fout = Files.newOutputStream(tempSo,
                                       ^
src/de/entropia/can/CanSocket.java:60: ';' expected
                        StandardOpenOption.TRUNCATE_EXISTING)) {
                                                             ^
src/de/entropia/can/CanSocket.java:58: 'try' without 'catch' or 'finally'
                try (final OutputStream fout = Files.newOutputStream(tempSo,
                ^
src/de/entropia/can/CanSocket.java:65: 'finally' without 'try'
        } finally {
          ^
src/de/entropia/can/CanSocket.java:53: 'try' without 'catch' or 'finally'
            try (final InputStream libstream =
            ^
src/de/entropia/can/CanSocket.java:70: illegal start of expression
    public static final CanInterface CAN_ALL_INTERFACES = new CanInterface(0);
    ^
src/de/entropia/can/CanSocket.java:70: illegal start of expression
    public static final CanInterface CAN_ALL_INTERFACES = new CanInterface(0);
           ^
src/de/entropia/can/CanSocket.java:70: ';' expected
    public static final CanInterface CAN_ALL_INTERFACES = new CanInterface(0);
                 ^
src/de/entropia/can/CanSocket.java:72: illegal start of expression
    private static native int _getCANID_SFF(final int canid);
    ^
src/de/entropia/can/CanSocket.java:72: illegal start of expression
    private static native int _getCANID_SFF(final int canid);
            ^
src/de/entropia/can/CanSocket.java:72: ';' expected
    private static native int _getCANID_SFF(final int canid);
                  ^
src/de/entropia/can/CanSocket.java:72: ';' expected
    private static native int _getCANID_SFF(final int canid);
                                           ^
src/de/entropia/can/CanSocket.java:72: ';' expected
    private static native int _getCANID_SFF(final int canid);
                                                           ^
src/de/entropia/can/CanSocket.java:73: illegal start of expression
    private static native int _getCANID_EFF(final int canid);
    ^
src/de/entropia/can/CanSocket.java:73: illegal start of expression
    private static native int _getCANID_EFF(final int canid);
            ^
src/de/entropia/can/CanSocket.java:73: ';' expected
    private static native int _getCANID_EFF(final int canid);
                  ^
src/de/entropia/can/CanSocket.java:73: ';' expected
    private static native int _getCANID_EFF(final int canid);
                                           ^
src/de/entropia/can/CanSocket.java:73: ';' expected
    private static native int _getCANID_EFF(final int canid);
                                                           ^
src/de/entropia/can/CanSocket.java:74: illegal start of expression
    private static native int _getCANID_ERR(final int canid);
    ^
src/de/entropia/can/CanSocket.java:74: illegal start of expression
    private static native int _getCANID_ERR(final int canid);
            ^
src/de/entropia/can/CanSocket.java:74: ';' expected
    private static native int _getCANID_ERR(final int canid);
                  ^
src/de/entropia/can/CanSocket.java:74: ';' expected
    private static native int _getCANID_ERR(final int canid);
                                           ^
src/de/entropia/can/CanSocket.java:74: ';' expected
    private static native int _getCANID_ERR(final int canid);
                                                           ^
src/de/entropia/can/CanSocket.java:76: illegal start of expression
    private static native boolean _isSetEFFSFF(final int canid);
    ^
src/de/entropia/can/CanSocket.java:76: illegal start of expression
    private static native boolean _isSetEFFSFF(final int canid);
            ^
src/de/entropia/can/CanSocket.java:76: ';' expected
    private static native boolean _isSetEFFSFF(final int canid);
                  ^
src/de/entropia/can/CanSocket.java:76: ';' expected
    private static native boolean _isSetEFFSFF(final int canid);
                                              ^
src/de/entropia/can/CanSocket.java:76: ';' expected
    private static native boolean _isSetEFFSFF(final int canid);
                                                              ^
src/de/entropia/can/CanSocket.java:77: illegal start of expression
    private static native boolean _isSetRTR(final int canid);
    ^
src/de/entropia/can/CanSocket.java:77: illegal start of expression
    private static native boolean _isSetRTR(final int canid);
            ^
src/de/entropia/can/CanSocket.java:77: ';' expected
    private static native boolean _isSetRTR(final int canid);
                  ^
src/de/entropia/can/CanSocket.java:77: ';' expected
    private static native boolean _isSetRTR(final int canid);
                                           ^
src/de/entropia/can/CanSocket.java:77: ';' expected
    private static native boolean _isSetRTR(final int canid);
                                                           ^
src/de/entropia/can/CanSocket.java:78: illegal start of expression
    private static native boolean _isSetERR(final int canid);
    ^
src/de/entropia/can/CanSocket.java:78: illegal start of expression
    private static native boolean _isSetERR(final int canid);
            ^
src/de/entropia/can/CanSocket.java:78: ';' expected
    private static native boolean _isSetERR(final int canid);
                  ^
src/de/entropia/can/CanSocket.java:78: ';' expected
    private static native boolean _isSetERR(final int canid);
                                           ^
src/de/entropia/can/CanSocket.java:78: ';' expected
    private static native boolean _isSetERR(final int canid);
                                                           ^
src/de/entropia/can/CanSocket.java:80: illegal start of expression
    private static native int _setEFFSFF(final int canid);
    ^
src/de/entropia/can/CanSocket.java:80: illegal start of expression
    private static native int _setEFFSFF(final int canid);
            ^
src/de/entropia/can/CanSocket.java:80: ';' expected
    private static native int _setEFFSFF(final int canid);
                  ^
src/de/entropia/can/CanSocket.java:80: ';' expected
    private static native int _setEFFSFF(final int canid);
                                        ^
src/de/entropia/can/CanSocket.java:80: ';' expected
    private static native int _setEFFSFF(final int canid);
                                                        ^
src/de/entropia/can/CanSocket.java:81: illegal start of expression
    private static native int _setRTR(final int canid);
    ^
src/de/entropia/can/CanSocket.java:81: illegal start of expression
    private static native int _setRTR(final int canid);
            ^
src/de/entropia/can/CanSocket.java:81: ';' expected
    private static native int _setRTR(final int canid);
                  ^
src/de/entropia/can/CanSocket.java:81: ';' expected
    private static native int _setRTR(final int canid);
                                     ^
src/de/entropia/can/CanSocket.java:81: ';' expected
    private static native int _setRTR(final int canid);
                                                     ^
src/de/entropia/can/CanSocket.java:82: illegal start of expression
    private static native int _setERR(final int canid);
    ^
src/de/entropia/can/CanSocket.java:82: illegal start of expression
    private static native int _setERR(final int canid);
            ^
src/de/entropia/can/CanSocket.java:82: ';' expected
    private static native int _setERR(final int canid);
                  ^
src/de/entropia/can/CanSocket.java:82: ';' expected
    private static native int _setERR(final int canid);
                                     ^
src/de/entropia/can/CanSocket.java:82: ';' expected
    private static native int _setERR(final int canid);
                                                     ^
src/de/entropia/can/CanSocket.java:84: illegal start of expression
    private static native int _clearEFFSFF(final int canid);
    ^
src/de/entropia/can/CanSocket.java:84: illegal start of expression
    private static native int _clearEFFSFF(final int canid);
            ^
src/de/entropia/can/CanSocket.java:84: ';' expected
    private static native int _clearEFFSFF(final int canid);
                  ^
src/de/entropia/can/CanSocket.java:84: ';' expected
    private static native int _clearEFFSFF(final int canid);
                                          ^
src/de/entropia/can/CanSocket.java:84: ';' expected
    private static native int _clearEFFSFF(final int canid);
                                                          ^
src/de/entropia/can/CanSocket.java:85: illegal start of expression
    private static native int _clearRTR(final int canid);
    ^
src/de/entropia/can/CanSocket.java:85: illegal start of expression
    private static native int _clearRTR(final int canid);
            ^
src/de/entropia/can/CanSocket.java:85: ';' expected
    private static native int _clearRTR(final int canid);
                  ^
src/de/entropia/can/CanSocket.java:85: ';' expected
    private static native int _clearRTR(final int canid);
                                       ^
src/de/entropia/can/CanSocket.java:85: ';' expected
    private static native int _clearRTR(final int canid);
                                                       ^
src/de/entropia/can/CanSocket.java:86: illegal start of expression
    private static native int _clearERR(final int canid);
    ^
src/de/entropia/can/CanSocket.java:86: illegal start of expression
    private static native int _clearERR(final int canid);
            ^
src/de/entropia/can/CanSocket.java:86: ';' expected
    private static native int _clearERR(final int canid);
                  ^
src/de/entropia/can/CanSocket.java:86: ';' expected
    private static native int _clearERR(final int canid);
                                       ^
src/de/entropia/can/CanSocket.java:86: ';' expected
    private static native int _clearERR(final int canid);
                                                       ^
src/de/entropia/can/CanSocket.java:88: illegal start of expression
    private static native int _openSocketRAW() throws IOException;
    ^
src/de/entropia/can/CanSocket.java:88: illegal start of expression
    private static native int _openSocketRAW() throws IOException;
            ^
src/de/entropia/can/CanSocket.java:88: ';' expected
    private static native int _openSocketRAW() throws IOException;
                  ^
src/de/entropia/can/CanSocket.java:88: ';' expected
    private static native int _openSocketRAW() throws IOException;
                                            ^
src/de/entropia/can/CanSocket.java:88: not a statement
    private static native int _openSocketRAW() throws IOException;
                                                      ^
src/de/entropia/can/CanSocket.java:89: illegal start of expression
    private static native int _openSocketBCM() throws IOException;
    ^
src/de/entropia/can/CanSocket.java:89: illegal start of expression
    private static native int _openSocketBCM() throws IOException;
            ^
src/de/entropia/can/CanSocket.java:89: ';' expected
    private static native int _openSocketBCM() throws IOException;
                  ^
src/de/entropia/can/CanSocket.java:89: ';' expected
    private static native int _openSocketBCM() throws IOException;
                                            ^
src/de/entropia/can/CanSocket.java:89: not a statement
    private static native int _openSocketBCM() throws IOException;
                                                      ^
src/de/entropia/can/CanSocket.java:90: illegal start of expression
    private static native void _close(final int fd) throws IOException;
    ^
src/de/entropia/can/CanSocket.java:90: illegal start of expression
    private static native void _close(final int fd) throws IOException;
            ^
src/de/entropia/can/CanSocket.java:90: ';' expected
    private static native void _close(final int fd) throws IOException;
                  ^
src/de/entropia/can/CanSocket.java:90: illegal start of expression
    private static native void _close(final int fd) throws IOException;
                          ^
src/de/entropia/can/CanSocket.java:90: ';' expected
    private static native void _close(final int fd) throws IOException;
                                     ^
src/de/entropia/can/CanSocket.java:90: ';' expected
    private static native void _close(final int fd) throws IOException;
                                                  ^
src/de/entropia/can/CanSocket.java:90: not a statement
    private static native void _close(final int fd) throws IOException;
                                                           ^
src/de/entropia/can/CanSocket.java:92: illegal start of expression
    private static native int _fetchInterfaceMtu(final int fd,
    ^
src/de/entropia/can/CanSocket.java:92: illegal start of expression
    private static native int _fetchInterfaceMtu(final int fd,
            ^
src/de/entropia/can/CanSocket.java:92: ';' expected
    private static native int _fetchInterfaceMtu(final int fd,
                  ^
src/de/entropia/can/CanSocket.java:92: ';' expected
    private static native int _fetchInterfaceMtu(final int fd,
                                                ^
src/de/entropia/can/CanSocket.java:92: <identifier> expected
    private static native int _fetchInterfaceMtu(final int fd,
                                                              ^
src/de/entropia/can/CanSocket.java:93: ';' expected
        final String ifName) throws IOException;
                           ^
src/de/entropia/can/CanSocket.java:93: not a statement
        final String ifName) throws IOException;
                                    ^
100 errors
make: *** [stamps/compile-src] Error 1

Any Ideas?

Thanks,
Steven

java.lang.IllegalArgumentException: illegal AF_CAN address

I haven't been working on my libsocket-can-java based project for a while and I had to update my system in the meantime. Even though I'm not sure that the issue is related to the newer kernel / system components, I suppose it's got something to do with libsocket-can-java.
Back then I was using Linux kernel 4.9.0 (Debian Stretch) and now it's kernel 5.6.14 (Debian bullseye) and can-utils 2020.02.04-3.

Whereas candump on slcan0 works fine (after slcan0 was set up using

slcan_attach -f -c -s5 -o /dev/ttyACM1
slcand /dev/ttyACM1 slcan0
ifconfig slcan0 up

)

CanSocket socket = new CanSocket( Mode.RAW );
CanInterface canif = new CanInterface( socket, socket_name );
socket.bind( canif );
CanSocket.CanFrame frame = socket.recv();

(simplified) fails using an IllegalArgumentException:

java.lang.IllegalArgumentException: illegal AF_CAN address
	at de.entropia.can.CanSocket._recvFrame(Native Method)
	at de.entropia.can.CanSocket.recv(CanSocket.java:400)

I'm having a hard time finding out whether this is a bug or mistake on my side. Thus I'm hoping for your help.
Thanks a million!

issue with can_id length of 8

Firstly, thanks a lot for the port.

I am using your library to read CAN data on Android, and everything works fine when I send data with something like

cansend can0 123#01

No issue, when using a can_id with a length of 3.

But when I do the same with

cansend can0 12345678#01

just after, the recv from I get this frame :

CanSocket: frame: 0x92345678

And if I send 02345678 I get :
0x82345678
So I have a bit set to true which makes the +8 on the first bytes, but I don't know why.
Any idea where this come from ?
If I do the same with candump, everything works fine.

And weird too, if I send 22345678, I get 0x00000678

Thanks for your help,
Audric

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.