public class DeviceFinder extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
ANNOUNCEMENT_PORT
The port to which devices broadcast announcement messages to report their presence on the network.
|
static int |
MAXIMUM_AGE
The number of milliseconds after which we will consider a device to have disappeared if
we have not received an announcement from it.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addDeviceAnnouncementListener(DeviceAnnouncementListener listener)
Adds the specified device announcement listener to receive device announcements when DJ Link devices
are found on or leave the network.
|
static Set<DeviceAnnouncement> |
currentDevices()
Get the set of DJ Link devices which currently can be seen on the network.
|
static Set<DeviceAnnouncementListener> |
getDeviceAnnouncementListeners()
Get the set of device announcement listeners that are currently registered.
|
static DeviceAnnouncement |
getLatestAnnouncementFrom(int deviceNumber)
Find and return the device announcement that was most recently received from a device identifying itself
with the specified device number, if any.
|
static boolean |
isActive()
Check whether we are presently listening for device announcements.
|
static void |
removeDeviceAnnouncementListener(DeviceAnnouncementListener listener)
Removes the specified device announcement listener so that it no longer receives device announcements when
DJ Link devices are found on or leave the network.
|
static void |
start()
Start listening for device announcements and keeping track of the DJ Link devices visible on the network.
|
static void |
stop()
Stop listening for device announcements.
|
public static final int ANNOUNCEMENT_PORT
public static final int MAXIMUM_AGE
public static boolean isActive()
true if our socket is open and monitoring for DJ Link device announcements on the networkpublic static void start()
throws SocketException
SocketException - if the socket to listen on port 50000 cannot be createdpublic static void stop()
public static Set<DeviceAnnouncement> currentDevices()
VirtualCdj.getLatestStatusFor(DeviceUpdate) to find the current detailed status for that device,
as long as the Virtual CDJ is active.IllegalStateException - if the DeviceFinder is not activepublic static DeviceAnnouncement getLatestAnnouncementFrom(int deviceNumber)
deviceNumber - the device number of interestpublic static void addDeviceAnnouncementListener(DeviceAnnouncementListener listener)
listener is null or already present in the list
of registered listeners, no exception is thrown and no action is performed.
Device announcements are delivered to listeners on the Event Dispatch thread, so it is fine to interact with user interface objects in listener methods. Any code in the listener method must finish quickly, or unhandled events will back up and the user interface will be come unresponsive.
listener - the device announcement listener to addpublic static void removeDeviceAnnouncementListener(DeviceAnnouncementListener listener)
listener is null or not present
in the list of registered listeners, no exception is thrown and no action is performed.listener - the device announcement listener to removepublic static Set<DeviceAnnouncementListener> getDeviceAnnouncementListeners()
Copyright © 2016 Deep Symmetry, LLC. All rights reserved.