Package org.cybergarage.upnp
Class Device
- java.lang.Object
-
- org.cybergarage.upnp.Device
-
- All Implemented Interfaces:
HTTPRequestListener
,SearchListener
public class Device extends Object implements HTTPRequestListener, SearchListener
-
-
Field Summary
Fields Modifier and Type Field 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
-
Method Summary
-
-
-
Field Detail
-
ELEM_NAME
public static final String ELEM_NAME
- See Also:
- Constant Field Values
-
UPNP_ROOTDEVICE
public static final String UPNP_ROOTDEVICE
- See Also:
- Constant Field Values
-
DEFAULT_STARTUP_WAIT_TIME
public static final int DEFAULT_STARTUP_WAIT_TIME
- See Also:
- Constant Field Values
-
DEFAULT_DISCOVERY_WAIT_TIME
public static final int DEFAULT_DISCOVERY_WAIT_TIME
- See Also:
- Constant Field Values
-
DEFAULT_LEASE_TIME
public static final int DEFAULT_LEASE_TIME
- See Also:
- Constant Field Values
-
HTTP_DEFAULT_PORT
public static final int HTTP_DEFAULT_PORT
- See Also:
- Constant Field Values
-
DEFAULT_DESCRIPTION_URI
public static final String DEFAULT_DESCRIPTION_URI
- See Also:
- Constant Field Values
-
DEFAULT_PRESENTATION_URI
public static final String DEFAULT_PRESENTATION_URI
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Device
public Device()
-
Device
public Device(Node device)
-
Device
public Device(File descriptionFile) throws InvalidDescriptionException
- Throws:
InvalidDescriptionException
-
Device
public Device(InputStream input) throws InvalidDescriptionException
- Throws:
InvalidDescriptionException
- Since:
- 1.8.0
-
Device
public Device(String descriptionFileName) throws InvalidDescriptionException
- Throws:
InvalidDescriptionException
-
-
Method Detail
-
getRootNode
public Node getRootNode()
-
getDeviceNode
public Node getDeviceNode()
-
setRootNode
public void setRootNode(Node node)
-
setDeviceNode
public void setDeviceNode(Node node)
-
lock
public void lock()
-
unlock
public void unlock()
-
getAbsoluteURL
public String getAbsoluteURL(String urlString, String baseURLStr, String locationURLStr)
-
setNMPRMode
public void setNMPRMode(boolean flag)
-
isNMPRMode
public boolean isNMPRMode()
-
setWirelessMode
public void setWirelessMode(boolean flag)
-
isWirelessMode
public boolean isWirelessMode()
-
getSSDPAnnounceCount
public int getSSDPAnnounceCount()
-
getUUID
public String getUUID()
-
getBootId
public int getBootId()
-
updateConfigId
public void updateConfigId()
-
getConfigId
public int getConfigId()
-
getRootDevice
public Device getRootDevice()
-
getParentDevice
public Device getParentDevice()
- Returns:
- A Device that contain this object.
Returnnull
if this is a root device.
-
addService
public void addService(Service s)
Add a Service to device without checking for duplicate or syntax error- Parameters:
s
- Add Service s to the Device
-
addDevice
public void addDevice(Device d)
Add a Device to device without checking for duplicate or syntax error. This method set or reset the root node of the Device and itself
Note: This method should be used to create a dynamic
Device withtout writing any XML that describe the device- Parameters:
d
- Add Device d to the Device
-
getDescriptionFile
public File getDescriptionFile()
-
getDescriptionFilePath
public String getDescriptionFilePath()
-
loadDescription
public boolean loadDescription(InputStream input) throws InvalidDescriptionException
- Throws:
InvalidDescriptionException
- Since:
- 1.8.0
-
loadDescription
public boolean loadDescription(String descString) throws InvalidDescriptionException
- Throws:
InvalidDescriptionException
-
loadDescription
public boolean loadDescription(File file) throws InvalidDescriptionException
- Throws:
InvalidDescriptionException
-
isDeviceNode
public static boolean isDeviceNode(Node node)
-
isRootDevice
public boolean isRootDevice()
-
setSSDPPacket
public void setSSDPPacket(SSDPPacket packet)
-
getSSDPPacket
public SSDPPacket getSSDPPacket()
-
getSSDPPacket
public SSDPPacket getSSDPPacket(boolean preferIPv6)
I2P for multiple location support- Since:
- 0.9.50
-
setLocation
public void setLocation(String value)
-
getLocation
public String getLocation()
-
getLocation
public String getLocation(boolean preferIPv6)
I2P for multiple location support- Since:
- 0.9.50
-
setLeaseTime
public void setLeaseTime(int value)
-
getLeaseTime
public int getLeaseTime()
-
getTimeStamp
public long getTimeStamp()
-
getElapsedTime
public long getElapsedTime()
-
isExpired
public boolean isExpired()
-
getURLBase
public String getURLBase()
-
setDeviceType
public void setDeviceType(String value)
-
getDeviceType
public String getDeviceType()
-
isDeviceType
public boolean isDeviceType(String value)
-
setFriendlyName
public void setFriendlyName(String value)
-
getFriendlyName
public String getFriendlyName()
-
setManufacture
public void setManufacture(String value)
-
getManufacture
public String getManufacture()
-
setManufactureURL
public void setManufactureURL(String value)
-
getManufactureURL
public String getManufactureURL()
-
setModelDescription
public void setModelDescription(String value)
-
getModelDescription
public String getModelDescription()
-
setModelName
public void setModelName(String value)
-
getModelName
public String getModelName()
-
setModelNumber
public void setModelNumber(String value)
-
getModelNumber
public String getModelNumber()
-
setModelURL
public void setModelURL(String value)
-
getModelURL
public String getModelURL()
-
setSerialNumber
public void setSerialNumber(String value)
-
getSerialNumber
public String getSerialNumber()
-
setUDN
public void setUDN(String value)
-
getUDN
public String getUDN()
-
hasUDN
public boolean hasUDN()
-
setUPC
public void setUPC(String value)
-
getUPC
public String getUPC()
-
setPresentationURL
public void setPresentationURL(String value)
-
getPresentationURL
public String getPresentationURL()
-
removePresentationURL
public boolean removePresentationURL()
-
setPresentationListener
public void setPresentationListener(PresentationListener listener)
-
hasPresentationListener
public boolean hasPresentationListener()
-
getPresentationListener
public PresentationListener getPresentationListener()
-
getDeviceList
public DeviceList getDeviceList()
-
isDevice
public boolean isDevice(String name)
-
getServiceList
public ServiceList getServiceList()
-
getStateVariable
public StateVariable getStateVariable(String serviceType, String name)
-
getStateVariable
public StateVariable getStateVariable(String name)
-
isIconBytesURI
public boolean isIconBytesURI(String uri)
-
addIcon
public boolean addIcon(Icon icon)
-
getIconList
public IconList getIconList()
-
getIcon
public Icon getIcon(int n)
-
getSmallestIcon
public Icon getSmallestIcon()
-
notifyWait
public static final void notifyWait()
-
announce
public void announce(String bindAddr)
-
announce
public void announce()
-
byebye
public void byebye(String bindAddr)
-
byebye
public void byebye()
-
postSearchResponse
public boolean postSearchResponse(SSDPPacket ssdpPacket, String st, String usn)
-
deviceSearchResponse
public void deviceSearchResponse(SSDPPacket ssdpPacket)
-
deviceSearchReceived
public void deviceSearchReceived(SSDPPacket ssdpPacket)
- Specified by:
deviceSearchReceived
in interfaceSearchListener
-
setHTTPPort
public void setHTTPPort(int port)
-
getHTTPPort
public int getHTTPPort()
-
setHTTPBindAddress
public void setHTTPBindAddress(InetAddress[] inets)
-
getHTTPBindAddress
public InetAddress[] getHTTPBindAddress()
-
getSSDPIPv4MulticastAddress
public String getSSDPIPv4MulticastAddress()
- Returns:
- SSDPIPv4MulticastAddress
- Since:
- 1.8
-
getSSDPIPv4MulticastAddress
public void getSSDPIPv4MulticastAddress(String ip)
- Parameters:
ip
-- Since:
- 1.8
-
getSSDPIPv6MulticastAddress
public String getSSDPIPv6MulticastAddress()
- Returns:
- SSDPIPv6MulticastAddress
- Since:
- 1.8
-
getSSDPIPv6MulticastAddress
public void getSSDPIPv6MulticastAddress(String ip)
- Parameters:
ip
-- Since:
- 1.8
-
httpRequestRecieved
public void httpRequestRecieved(HTTPRequest httpReq)
- Specified by:
httpRequestRecieved
in interfaceHTTPRequestListener
-
setSSDPPort
public void setSSDPPort(int port)
- Parameters:
port
- The port to use for binding the SSDP service
-
getSSDPPort
public int getSSDPPort()
- Returns:
- The port to use for binding the SSDP service
-
setSSDPBindAddress
public void setSSDPBindAddress(InetAddress[] inets)
- Parameters:
inets
- The IP that will be used for binding the SSDP service. Usenull
to get the default beahvior
-
getSSDPBindAddress
public InetAddress[] getSSDPBindAddress()
- Returns:
- inets The IP that will be used for binding the SSDP service. null means the default setted by the class UPnP
-
setMulticastIPv4Address
public void setMulticastIPv4Address(String ip)
- Parameters:
ip
- The IPv4 address used for Multicast comunication
-
getMulticastIPv4Address
public String getMulticastIPv4Address()
- Returns:
- The IPv4 address used for Multicast comunication
-
setMulticastIPv6Address
public void setMulticastIPv6Address(String ip)
- Parameters:
ip
- The IPv address used for Multicast comunication
-
getMulticastIPv6Address
public String getMulticastIPv6Address()
- Returns:
- The IPv address used for Multicast comunication
-
start
public boolean start()
-
stop
public boolean stop()
-
isRunning
public boolean isRunning()
-
getInterfaceAddress
public String getInterfaceAddress()
-
setActionListener
public void setActionListener(ActionListener listener)
-
setQueryListener
public void setQueryListener(QueryListener listener)
-
setActionListener
public void setActionListener(ActionListener listener, boolean includeSubDevices)
-
setQueryListener
public void setQueryListener(QueryListener listener, boolean includeSubDevices)
-
setUserData
public void setUserData(Object data)
-
getUserData
public Object getUserData()
-
-