Class UdpRemoteConnector
- java.lang.Object
-
- com.thecoderscorner.menu.remote.udp.UdpRemoteConnector
-
- All Implemented Interfaces:
RemoteConnector
public class UdpRemoteConnector extends java.lang.Object implements RemoteConnector
EXPERIMENTAL: DO NOT USE AT THE MOMENT
-
-
Constructor Summary
Constructors Constructor Description UdpRemoteConnector(java.util.concurrent.ScheduledExecutorService executor, long flushFreq, java.lang.String address, int port, MenuCommandProtocol protocol, short deviceId, boolean sendAsDevice)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Force close a connection when its known to be bad, the connector will try and establish a new connection.java.lang.StringgetConnectionName()Gets the name of this connector locallybooleanisConnected()Gets the underlying connection state for this connector.voidregisterConnectionChangeListener(ConnectionChangeListener listener)Register for information about connection statevoidregisterConnectorListener(RemoteConnectorListener listener)register a listener that will receive any messages sent by the menu libraryvoidsendMenuCommand(MenuCommand msg)Sends a command to the menu library running on the embedded hardware.voidstart()Starts the communication channel, so it will attempt to connect with the configured devicevoidstop()Stops the library and attempts to also stop any threads and other resources associated.
-
-
-
Constructor Detail
-
UdpRemoteConnector
public UdpRemoteConnector(java.util.concurrent.ScheduledExecutorService executor, long flushFreq, java.lang.String address, int port, MenuCommandProtocol protocol, short deviceId, boolean sendAsDevice) throws java.io.IOException- Throws:
java.io.IOException
-
-
Method Detail
-
start
public void start()
Description copied from interface:RemoteConnectorStarts the communication channel, so it will attempt to connect with the configured device- Specified by:
startin interfaceRemoteConnector
-
sendMenuCommand
public void sendMenuCommand(MenuCommand msg) throws java.io.IOException
Description copied from interface:RemoteConnectorSends a command to the menu library running on the embedded hardware. If not connected the action is connector dependent.- Specified by:
sendMenuCommandin interfaceRemoteConnector- Parameters:
msg- the message to send.- Throws:
java.io.IOException
-
stop
public void stop()
Description copied from interface:RemoteConnectorStops the library and attempts to also stop any threads and other resources associated.- Specified by:
stopin interfaceRemoteConnector
-
isConnected
public boolean isConnected()
Description copied from interface:RemoteConnectorGets the underlying connection state for this connector.- Specified by:
isConnectedin interfaceRemoteConnector- Returns:
- the underlying connection state.
-
getConnectionName
public java.lang.String getConnectionName()
Description copied from interface:RemoteConnectorGets the name of this connector locally- Specified by:
getConnectionNamein interfaceRemoteConnector
-
registerConnectorListener
public void registerConnectorListener(RemoteConnectorListener listener)
Description copied from interface:RemoteConnectorregister a listener that will receive any messages sent by the menu library- Specified by:
registerConnectorListenerin interfaceRemoteConnector- Parameters:
listener- the listener
-
registerConnectionChangeListener
public void registerConnectionChangeListener(ConnectionChangeListener listener)
Description copied from interface:RemoteConnectorRegister for information about connection state- Specified by:
registerConnectionChangeListenerin interfaceRemoteConnector- Parameters:
listener- the listener
-
close
public void close()
Description copied from interface:RemoteConnectorForce close a connection when its known to be bad, the connector will try and establish a new connection.- Specified by:
closein interfaceRemoteConnector
-
-