de.entropia.can
Class CanSocket

java.lang.Object
  extended by de.entropia.can.CanSocket
All Implemented Interfaces:
Closeable

public final class CanSocket
extends Object
implements Closeable


Nested Class Summary
static class CanSocket.CanFilter
           
static class CanSocket.CanFrame
           
static class CanSocket.CanId
           
static class CanSocket.CanInterface
           
static class CanSocket.Mode
           
 
Field Summary
static CanSocket.CanInterface CAN_ALL_INTERFACES
           
static int CAN_FD_MTU
           
static int CAN_MTU
           
 
Constructor Summary
CanSocket(CanSocket.Mode mode)
           
 
Method Summary
 void bind(CanSocket.CanInterface canInterface)
           
 void close()
           
 boolean getLoopbackMode()
           
 int getMtu(String canif)
           
 boolean getRecvOwnMsgsMode()
           
static void loadLibFromJar(String fileName)
          Loads library from current JAR archive The file from JAR is copied into system temporary directory and then loaded.
 CanSocket.CanFrame recv()
           
 void send(CanSocket.CanFrame frame)
           
 void setCanFilter(int can_id, int can_mask)
           
 void setLoopbackMode(boolean on)
           
 void setRecvOwnMsgsMode(boolean on)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CAN_ALL_INTERFACES

public static final CanSocket.CanInterface CAN_ALL_INTERFACES

CAN_MTU

public static final int CAN_MTU

CAN_FD_MTU

public static final int CAN_FD_MTU
Constructor Detail

CanSocket

public CanSocket(CanSocket.Mode mode)
          throws IOException
Throws:
IOException
Method Detail

loadLibFromJar

public static void loadLibFromJar(String fileName)
                           throws IOException
Loads library from current JAR archive The file from JAR is copied into system temporary directory and then loaded. The temporary file is deleted after exiting. Method uses String as filename because the pathname is "abstract", not system-dependent.

Parameters:
filename - The filename inside JAR as absolute path (beginning with '/'), e.g. /package/File.ext
Throws:
IOException - If temporary file creation or read/write operation fails
IllegalArgumentException - If source file (param path) does not exist
IllegalArgumentException - If the path is not absolute or if the filename is shorter than three characters (restriction of File.createTempFile(java.lang.String, java.lang.String)).

bind

public void bind(CanSocket.CanInterface canInterface)
          throws IOException
Throws:
IOException

send

public void send(CanSocket.CanFrame frame)
          throws IOException
Throws:
IOException

recv

public CanSocket.CanFrame recv()
                        throws IOException
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Throws:
IOException

getMtu

public int getMtu(String canif)
           throws IOException
Throws:
IOException

setLoopbackMode

public void setLoopbackMode(boolean on)
                     throws IOException
Throws:
IOException

getLoopbackMode

public boolean getLoopbackMode()
                        throws IOException
Throws:
IOException

setRecvOwnMsgsMode

public void setRecvOwnMsgsMode(boolean on)
                        throws IOException
Throws:
IOException

getRecvOwnMsgsMode

public boolean getRecvOwnMsgsMode()
                           throws IOException
Throws:
IOException

setCanFilter

public void setCanFilter(int can_id,
                         int can_mask)
                  throws IOException
Throws:
IOException


Copyright © 2013. All Rights Reserved.