|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
org.openmuc.canopen.lib.CANopenLib
public class CANopenLib
Platform dependent library, needs driver compiled with netdev support.
Runs only on Linux.
Tested with PEAK microcontrol.
Protocol: CANopen
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
static long |
MS_TIMEOUT
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
CANopenLib()
Creates a CANopenLib, with no connection. |
Method Summary | |
---|---|
float |
bigEndianToFloat(byte[] data)
Changes byte[4] from BigEndian data into float. |
short |
bigEndianToInt16(byte[] data)
Changes byte[2] from BigEndian data into signed short. |
int |
bigEndianToInt24(byte[] data)
Changes byte[3] from BigEndian data into signed int. |
int |
bigEndianToInt32(byte[] data)
Changes byte[4] from BigEndian data into signed int. |
void |
close()
Close CAN, method to close the socket. |
void |
connect(java.lang.String ifname)
Connect to CAN |
protected void |
finalize()
|
byte[] |
getData(int modulID,
int index,
int subindex)
Sends a Message to the specific CAN. |
SDOClient |
newSDOClient(int nodeID)
|
CLibrary.can_frame.ByReference |
readFrameWithTimeout(int timeoutMs)
|
void |
run()
|
void |
sendSDOUploadInitiate(byte node,
int index,
short subIndex)
|
void |
sendSDOUploadSegment(byte node,
boolean toggle)
|
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static long MS_TIMEOUT
Constructor Detail |
---|
public CANopenLib()
Method Detail |
---|
public SDOClient newSDOClient(int nodeID)
public void connect(java.lang.String ifname) throws NoDeviceException, java.io.IOException
ifname
- Name of the interface e.g. "can0"
NoDeviceException
- if interface isn't present.
java.io.IOException
- if connection can not be established.protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public void close()
ifname
- Name of the Interface to closepublic void sendSDOUploadInitiate(byte node, int index, short subIndex)
public void sendSDOUploadSegment(byte node, boolean toggle)
public CLibrary.can_frame.ByReference readFrameWithTimeout(int timeoutMs)
public byte[] getData(int modulID, int index, int subindex) throws java.io.IOException, TimeoutException
modulID
- ID of the Module, max=127.index
- The index of the Message, see CANopen.subindex
- The subindex of the Message, see CANopen.
java.io.IOException
- if parameter have wrong format, or read returns wrong data, or no socket.
TimeoutException
- if read times outpublic float bigEndianToFloat(byte[] data)
data
- Array of data bytes, BigEndian.
public short bigEndianToInt16(byte[] data)
data
- Array of data bytes, BigEndian.
public int bigEndianToInt24(byte[] data)
data
- Array of data bytes, BigEndian.
public int bigEndianToInt32(byte[] data)
data
- Array of data bytes, BigEndian.
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |