Package jmri.jmrit.withrottle
Class FacelessServer
- java.lang.Object
-
- jmri.jmrit.withrottle.FacelessServer
-
- All Implemented Interfaces:
java.util.EventListener
,DeviceListener
,DeviceManager
,ZeroConfServiceListener
public class FacelessServer extends java.lang.Object implements DeviceListener, DeviceManager, ZeroConfServiceListener
Copied from UserInterface, but with the UI stuff removed. Sets up to advertise service, and creates a thread for it to run in.listen() has to run in a separate thread.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jmri.jmrit.withrottle.DeviceManager
DeviceManager.DeviceManagerThread
-
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean
isListen
(package private) int
port
(package private) ZeroConfService
service
(package private) java.net.ServerSocket
socket
(package private) UserPreferencesManager
userPreferences
-
Constructor Summary
Constructors Constructor Description FacelessServer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDeviceListener(DeviceListener dl)
Add a device listener that will be added for each new device connection(package private) void
disableServer()
java.util.ArrayList<DeviceServer>
getDeviceList()
(package private) int
getPort()
java.lang.String
getSelectedRosterGroup()
the roster group to send.(package private) ZeroConfService
getZeroConfService()
void
listen()
void
notifyDeviceAddressChanged(DeviceServer device)
A device has changed its address.void
notifyDeviceConnected(DeviceServer device)
A new device has connected.void
notifyDeviceDisconnected(DeviceServer device)
A device has quit and needs to be removed.void
notifyDeviceInfoChanged(DeviceServer device)
Received an UDID, filter out any duplicate.void
removeDeviceListener(DeviceListener dl)
Remove a device listener from the list that will be added for each new device connectionvoid
servicePublished(ZeroConfServiceEvent se)
void
serviceQueued(ZeroConfServiceEvent se)
void
serviceUnpublished(ZeroConfServiceEvent se)
void
setSelectedRosterGroup(java.lang.String group)
Specify a roster group to send-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jmri.jmrit.withrottle.DeviceManager
createServerThread
-
-
-
-
Field Detail
-
userPreferences
UserPreferencesManager userPreferences
-
port
int port
-
service
ZeroConfService service
-
isListen
boolean isListen
-
socket
java.net.ServerSocket socket
-
-
Constructor Detail
-
FacelessServer
FacelessServer()
-
-
Method Detail
-
listen
public void listen()
- Specified by:
listen
in interfaceDeviceManager
-
getZeroConfService
ZeroConfService getZeroConfService()
-
getPort
int getPort()
-
addDeviceListener
public void addDeviceListener(DeviceListener dl)
Add a device listener that will be added for each new device connection- Specified by:
addDeviceListener
in interfaceDeviceManager
- Parameters:
dl
- the device listener to add
-
removeDeviceListener
public void removeDeviceListener(DeviceListener dl)
Remove a device listener from the list that will be added for each new device connection- Specified by:
removeDeviceListener
in interfaceDeviceManager
- Parameters:
dl
- the device listener to remove
-
notifyDeviceConnected
public void notifyDeviceConnected(DeviceServer device)
Description copied from interface:DeviceListener
A new device has connected.- Specified by:
notifyDeviceConnected
in interfaceDeviceListener
- Parameters:
device
- the device that has connected.
-
notifyDeviceDisconnected
public void notifyDeviceDisconnected(DeviceServer device)
Description copied from interface:DeviceListener
A device has quit and needs to be removed.- Specified by:
notifyDeviceDisconnected
in interfaceDeviceListener
- Parameters:
device
- the device that has quit.
-
notifyDeviceInfoChanged
public void notifyDeviceInfoChanged(DeviceServer device)
Received an UDID, filter out any duplicate.- Specified by:
notifyDeviceInfoChanged
in interfaceDeviceListener
- Parameters:
device
- the device to filter for duplicates
-
getDeviceList
public java.util.ArrayList<DeviceServer> getDeviceList()
-
notifyDeviceAddressChanged
public void notifyDeviceAddressChanged(DeviceServer device)
Description copied from interface:DeviceListener
A device has changed its address.- Specified by:
notifyDeviceAddressChanged
in interfaceDeviceListener
- Parameters:
device
- the device with changed address.
-
setSelectedRosterGroup
public void setSelectedRosterGroup(java.lang.String group)
Description copied from interface:DeviceManager
Specify a roster group to send- Specified by:
setSelectedRosterGroup
in interfaceDeviceManager
- Parameters:
group
- the roster group.
-
getSelectedRosterGroup
public java.lang.String getSelectedRosterGroup()
Description copied from interface:DeviceManager
the roster group to send.- Specified by:
getSelectedRosterGroup
in interfaceDeviceManager
- Returns:
- the roster group
-
serviceQueued
public void serviceQueued(ZeroConfServiceEvent se)
- Specified by:
serviceQueued
in interfaceZeroConfServiceListener
-
servicePublished
public void servicePublished(ZeroConfServiceEvent se)
- Specified by:
servicePublished
in interfaceZeroConfServiceListener
-
disableServer
void disableServer()
-
serviceUnpublished
public void serviceUnpublished(ZeroConfServiceEvent se)
- Specified by:
serviceUnpublished
in interfaceZeroConfServiceListener
-
-