public class Device extends Object implements HTTPRequestListener, SearchListener
This class provides the core functionality for UPnP devices, including:
A Device can be either a root device or an embedded device within another device. Each device contains services that provide specific functionality through actions and state variables.
Key features:
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_DESCRIPTION_URI |
static int |
DEFAULT_DISCOVERY_WAIT_TIME |
static int |
DEFAULT_LEASE_TIME |
static String |
DEFAULT_PRESENTATION_URI |
static int |
DEFAULT_STARTUP_WAIT_TIME |
static String |
ELEM_NAME |
static int |
HTTP_DEFAULT_PORT |
static String |
UPNP_ROOTDEVICE |
| Constructor and Description |
|---|
Device() |
Device(File descriptionFile) |
Device(InputStream input) |
Device(Node device) |
Device(Node root,
Node device) |
Device(String descriptionFileName) |
public static final String DEFAULT_DESCRIPTION_URI
public static final int DEFAULT_DISCOVERY_WAIT_TIME
public static final int DEFAULT_LEASE_TIME
public static final String DEFAULT_PRESENTATION_URI
public static final int DEFAULT_STARTUP_WAIT_TIME
public static final String ELEM_NAME
public static final int HTTP_DEFAULT_PORT
public static final String UPNP_ROOTDEVICE
public Device()
public Device(File descriptionFile) throws InvalidDescriptionException
InvalidDescriptionExceptionpublic Device(InputStream input) throws InvalidDescriptionException
InvalidDescriptionExceptionpublic Device(Node device)
public Device(String descriptionFileName) throws InvalidDescriptionException
InvalidDescriptionExceptionpublic void addDevice(Device d)
d - Add Device d to the Devicepublic boolean addIcon(Icon icon)
public void addService(Service s)
s - Add Service s to the Devicepublic void announce()
public void announce(String bindAddr)
public void byebye()
public void byebye(String bindAddr)
public void deviceSearchReceived(SSDPPacket ssdpPacket)
SearchListenerdeviceSearchReceived in interface SearchListenerssdpPacket - received SSDP packet containing search request datapublic void deviceSearchResponse(SSDPPacket ssdpPacket)
public String getAbsoluteURL(String urlString, String baseURLStr, String locationURLStr)
public int getBootId()
public int getConfigId()
public File getDescriptionFile()
public String getDescriptionFilePath()
public DeviceList getDeviceList()
public Node getDeviceNode()
public String getDeviceType()
public long getElapsedTime()
public String getFriendlyName()
public InetAddress[] getHTTPBindAddress()
public int getHTTPPort()
public Icon getIcon(int n)
public IconList getIconList()
public String getInterfaceAddress()
public int getLeaseTime()
public String getLocation()
public String getLocation(boolean preferIPv6)
public String getManufacture()
public String getManufactureURL()
public String getModelDescription()
public String getModelName()
public String getModelNumber()
public String getModelURL()
public String getMulticastIPv4Address()
public String getMulticastIPv6Address()
public Device getParentDevice()
null if this is a root device.public PresentationListener getPresentationListener()
public String getPresentationURL()
public Device getRootDevice()
public Node getRootNode()
public String getSerialNumber()
public ServiceList getServiceList()
public Icon getSmallestIcon()
public int getSSDPAnnounceCount()
public InetAddress[] getSSDPBindAddress()
public String getSSDPIPv4MulticastAddress()
public void getSSDPIPv4MulticastAddress(String ip)
ip - public String getSSDPIPv6MulticastAddress()
public void getSSDPIPv6MulticastAddress(String ip)
ip - public SSDPPacket getSSDPPacket()
public SSDPPacket getSSDPPacket(boolean preferIPv6)
public int getSSDPPort()
public StateVariable getStateVariable(String name)
public StateVariable getStateVariable(String serviceType, String name)
public long getTimeStamp()
public String getUDN()
public String getUPC()
public String getURLBase()
public Object getUserData()
public String getUUID()
public boolean hasPresentationListener()
public boolean hasUDN()
public void httpRequestRecieved(HTTPRequest httpReq)
HTTPRequestListenerhttpRequestRecieved in interface HTTPRequestListenerhttpReq - the received HTTP requestpublic boolean isDevice(String name)
public static boolean isDeviceNode(Node node)
public boolean isDeviceType(String value)
public boolean isExpired()
public boolean isIconBytesURI(String uri)
public boolean isNMPRMode()
public boolean isRootDevice()
public boolean isRunning()
public boolean isWirelessMode()
public boolean loadDescription(File file) throws InvalidDescriptionException
InvalidDescriptionExceptionpublic boolean loadDescription(InputStream input) throws InvalidDescriptionException
InvalidDescriptionExceptionpublic boolean loadDescription(String descString) throws InvalidDescriptionException
InvalidDescriptionExceptionpublic void lock()
public static final void notifyWait()
public boolean postSearchResponse(SSDPPacket ssdpPacket, String st, String usn)
public boolean removePresentationURL()
public void setActionListener(ActionListener listener)
public void setActionListener(ActionListener listener, boolean includeSubDevices)
public void setDeviceNode(Node node)
public void setDeviceType(String value)
public void setFriendlyName(String value)
public void setHTTPBindAddress(InetAddress[] inets)
public void setHTTPPort(int port)
public void setLeaseTime(int value)
public void setLocation(String value)
public void setManufacture(String value)
public void setManufactureURL(String value)
public void setModelDescription(String value)
public void setModelName(String value)
public void setModelNumber(String value)
public void setModelURL(String value)
public void setMulticastIPv4Address(String ip)
ip - The IPv4 address used for Multicast comunicationpublic void setMulticastIPv6Address(String ip)
ip - The IPv address used for Multicast comunicationpublic void setNMPRMode(boolean flag)
public void setPresentationListener(PresentationListener listener)
public void setPresentationURL(String value)
public void setQueryListener(QueryListener listener)
public void setQueryListener(QueryListener listener, boolean includeSubDevices)
public void setRootNode(Node node)
public void setSerialNumber(String value)
public void setSSDPBindAddress(InetAddress[] inets)
inets - The IP that will be used for binding the SSDP service. Use null to
get the default beahviorpublic void setSSDPPacket(SSDPPacket packet)
public void setSSDPPort(int port)
port - The port to use for binding the SSDP servicepublic void setUDN(String value)
public void setUPC(String value)
public void setUserData(Object data)
public void setWirelessMode(boolean flag)
public boolean start()
public boolean stop()
public void unlock()
public void updateConfigId()