|
jAER project on SourceForge | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Thread
net.sf.jaer.eventio.AEUnicastInput
public class AEUnicastInput
Receives input via datagram (connectionless, UDP) packets from a server.
The socket binds to the port which comes initially from the Preferences for AEUnicastInput. The port can be later changed.
Each packet consists of (by default) 1. a packet sequence integer (32 bits) which can be used to count missed packets 2. AEs. Each AE is a pair int32 address, int32 timestamp. Timestamps are assumed to have 1us tick.
Options allow different choices for use of sequence number, size of address/timestamp, order of address/timestamp, and swapping byte order to account for big/little endian peers.
The datagram socket is not connected to the receiver, i.e., connect() is not called on the socket.
setAddressFirstEnabled(boolean),
setSequenceNumberEnabled(boolean)| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
static int |
MAX_EVENT_BUFFER_SIZE
max size of event packet served to consumer by readPacket |
static long |
MIN_INTERVAL_MS
Maximum time inteval in ms to exchange EventPacketRaw with consumer |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
AEUnicastInput()
Constructs an instance of AEUnicastInput and binds it to the default port. |
|
AEUnicastInput(int port)
|
|
| Method Summary | |
|---|---|
void |
close()
Interrupts the thread which is acquiring data and closes the underlying DatagramSocket. |
java.lang.String |
getHost()
|
int |
getPort()
|
float |
getTimestampMultiplier()
|
boolean |
is4ByteAddrTimestampEnabled()
|
boolean |
isAddressFirstEnabled()
|
boolean |
isSequenceNumberEnabled()
|
boolean |
isSwapBytesEnabled()
|
void |
open()
Opens the input. |
AEPacketRaw |
readPacket()
Returns the latest buffer of events. |
void |
run()
This run method loops forever, filling the current filling buffer so that readPacket can return data that may be processed while the other buffer is being filled. |
void |
set4ByteAddrTimestampEnabled(boolean yes)
Sets whether to use 4 byte address and 4 byte timestamp or 2 byte address and 2 byte timestamp. |
void |
setAddressFirstEnabled(boolean addressFirstEnabled)
If set true, the first int32 of each AE is the address, and the second is the timestamp. |
void |
setHost(java.lang.String host)
Deprecated. doesn't do anything here because we only set local port |
void |
setPort(int port)
Set the local port for receiving events. |
void |
setSequenceNumberEnabled(boolean sequenceNumberEnabled)
If set true (default), then an int32 sequence number is the first word of the packet. |
void |
setSwapBytesEnabled(boolean yes)
To handle big endian event sources/sinks (e.g. |
void |
setTimestampMultiplier(float timestampMultiplier)
Timestamps from the remote host are multiplied by this value to become jAER timestamps. |
java.lang.String |
toString()
|
| 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, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static int MAX_EVENT_BUFFER_SIZE
public static final long MIN_INTERVAL_MS
| Constructor Detail |
|---|
public AEUnicastInput()
This Thread subclass must be started in order to receive event packets.
public AEUnicastInput(int port)
| Method Detail |
|---|
public void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic AEPacketRaw readPacket()
public java.lang.String toString()
toString in class java.lang.Threadpublic void close()
public java.lang.String getHost()
getHost in interface AEUnicastSettings
public void open()
throws java.io.IOException
java.io.IOExceptionpublic void setHost(java.lang.String host)
AEUnicastSettings
setHost in interface AEUnicastSettingshost - the hostnamepublic int getPort()
getPort in interface AEUnicastSettingspublic void setPort(int port)
setPort in interface AEUnicastSettingsport - public boolean isSequenceNumberEnabled()
isSequenceNumberEnabled in interface AEUnicastSettingspublic void setSequenceNumberEnabled(boolean sequenceNumberEnabled)
setSequenceNumberEnabled in interface AEUnicastSettingssequenceNumberEnabled - default truepublic boolean isAddressFirstEnabled()
isAddressFirstEnabled in interface AEUnicastSettingssetAddressFirstEnabled(boolean)public void setAddressFirstEnabled(boolean addressFirstEnabled)
setAddressFirstEnabled in interface AEUnicastSettingsaddressFirstEnabled - default true.public void setSwapBytesEnabled(boolean yes)
AEUnicastSettings
setSwapBytesEnabled in interface AEUnicastSettingspublic boolean isSwapBytesEnabled()
isSwapBytesEnabled in interface AEUnicastSettingspublic float getTimestampMultiplier()
getTimestampMultiplier in interface AEUnicastSettingsAEUnicastSettings.setTimestampMultiplier(float)public void setTimestampMultiplier(float timestampMultiplier)
setTimestampMultiplier in interface AEUnicastSettingstimestampMultiplier - public void set4ByteAddrTimestampEnabled(boolean yes)
AEUnicastSettings
set4ByteAddrTimestampEnabled in interface AEUnicastSettingspublic boolean is4ByteAddrTimestampEnabled()
is4ByteAddrTimestampEnabled in interface AEUnicastSettings
|
jAER project on SourceForge | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||