Package lejos.robotics.filter
Class PublishFilter
- java.lang.Object
-
- lejos.robotics.filter.AbstractFilter
-
- lejos.robotics.filter.PublishFilter
-
- All Implemented Interfaces:
SampleProvider
public class PublishFilter extends AbstractFilter
-
-
Field Summary
Fields Modifier and Type Field Description protected java.net.DatagramSocketdatagramSocketprotected floatfrequencyprotected java.lang.Stringhostprotected float[]latestprotected lejos.robotics.filter.PublishFilter.Listenerlistenerprotected java.lang.Stringnameprotected static intPUBLISH_PORTprotected lejos.robotics.filter.PublishFilter.Publisherpublisherprotected byte[]publishMessageprotected java.net.DatagramPacketpublishPacketprotected java.net.ServerSocketssprotected java.util.ArrayList<java.net.Socket>subscribersprotected static intUDP_PERIOD-
Fields inherited from class lejos.robotics.filter.AbstractFilter
sampleSize, source
-
-
Constructor Summary
Constructors Constructor Description PublishFilter(SampleProvider source, java.lang.String name, float frequency)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfetchSample(float[] sample, int offset)Fetches a sample from a sensor or filter.-
Methods inherited from class lejos.robotics.filter.AbstractFilter
sampleSize
-
-
-
-
Field Detail
-
PUBLISH_PORT
protected static final int PUBLISH_PORT
- See Also:
- Constant Field Values
-
UDP_PERIOD
protected static final int UDP_PERIOD
- See Also:
- Constant Field Values
-
name
protected java.lang.String name
-
host
protected java.lang.String host
-
datagramSocket
protected java.net.DatagramSocket datagramSocket
-
publisher
protected lejos.robotics.filter.PublishFilter.Publisher publisher
-
listener
protected lejos.robotics.filter.PublishFilter.Listener listener
-
latest
protected float[] latest
-
frequency
protected float frequency
-
publishMessage
protected byte[] publishMessage
-
publishPacket
protected java.net.DatagramPacket publishPacket
-
ss
protected java.net.ServerSocket ss
-
subscribers
protected java.util.ArrayList<java.net.Socket> subscribers
-
-
Constructor Detail
-
PublishFilter
public PublishFilter(SampleProvider source, java.lang.String name, float frequency) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
fetchSample
public void fetchSample(float[] sample, int offset)Description copied from interface:SampleProviderFetches a sample from a sensor or filter.- Specified by:
fetchSamplein interfaceSampleProvider- Overrides:
fetchSamplein classAbstractFilter- Parameters:
sample- The array to store the sample in.offset- The elements of the sample are stored in the array starting at the offset position.
-
-