public class UdpControllerBuilder extends Object
| Constructor | Description |
|---|---|
UdpControllerBuilder() |
| Modifier and Type | Method | Description |
|---|---|---|
RemoteMenuController |
build() |
Once the above methods have been called to fill in the blanks, then call build to get
the actual instance.
|
UdpControllerBuilder |
withBindAddress(String address) |
Mandatory, the address on which this socket is to bind to receive and send datagrams.
|
UdpControllerBuilder |
withClock(java.time.Clock clock) |
Optional, defaults to system clock but can be overriden
|
UdpControllerBuilder |
withDeviceId(short deviceId) |
Mandatory, specifies the device ID to listen for.
|
UdpControllerBuilder |
withExecutor(ScheduledExecutorService executor) |
Optional, defaults to creating a suitable executor for single connectivity
|
UdpControllerBuilder |
withHeartbeatFrequency(int frequency) |
Optional, defaults to 10 seconds between heartbeats.
|
UdpControllerBuilder |
withLocalName(String name) |
Optional, Set the name of this connection, defaults to NoName
|
UdpControllerBuilder |
withMenuTree(MenuTree tree) |
Mandatory, the menuTree instance to store the menu items retrieved from the remote side.
|
UdpControllerBuilder |
withPort(int port) |
Mandatory, the port locally on which to bind for multicast packets.
|
UdpControllerBuilder |
withProtocol(MenuCommandProtocol protocol) |
Optional, defaults to the standard protocol.
|
UdpControllerBuilder |
withSendAsDevice(boolean asDevice) |
Optional, normally set to false, as usually the Java API is not providing a menu as a device.
|
UdpControllerBuilder |
withSendFreq(long sendFreq) |
Optional, specifies the amount of time to wait before publishing a packet in millis, to try and send more than one
at a time.
|
public UdpControllerBuilder withDeviceId(short deviceId)
deviceId - the identifier of the device we are connecting topublic UdpControllerBuilder withSendFreq(long sendFreq)
sendFreq - the send frequencypublic UdpControllerBuilder withClock(java.time.Clock clock)
clock - the clock to usepublic UdpControllerBuilder withExecutor(ScheduledExecutorService executor)
executor - the executor which must implement ScheduledExecutorServicepublic UdpControllerBuilder withHeartbeatFrequency(int frequency)
frequency - the frequency, must align with remote device.public UdpControllerBuilder withMenuTree(MenuTree tree)
tree - the menu tree to be populated (only use a menu tree with one remote)public UdpControllerBuilder withProtocol(MenuCommandProtocol protocol)
protocol - a protocol object.public UdpControllerBuilder withSendAsDevice(boolean asDevice)
asDevice - false to act as a client, true if you want to act as a device.public UdpControllerBuilder withLocalName(String name)
name - the name the remote will see.public UdpControllerBuilder withBindAddress(String address)
address - address on which to send and receive.public UdpControllerBuilder withPort(int port)
port - the bind portpublic RemoteMenuController build() throws IOException
IOExceptionCopyright © 2018. All rights reserved.