java.lang.Object
org.cybergarage.upnp.Device
- All Implemented Interfaces:
org.cybergarage.http.HTTPRequestListener,org.cybergarage.upnp.device.SearchListener
- Direct Known Subclasses:
MediaServer
public class Device
extends Object
implements org.cybergarage.http.HTTPRequestListener, org.cybergarage.upnp.device.SearchListener
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a Device to device without checking for duplicate or syntax error.booleanvoidAdd a Service to device without checking for duplicate or syntax errorvoidannounce()voidvoidbyebye()voidvoiddeviceSearchReceived(org.cybergarage.upnp.ssdp.SSDPPacket ssdpPacket) voiddeviceSearchResponse(org.cybergarage.upnp.ssdp.SSDPPacket ssdpPacket) getAbsoluteURL(String urlString) getAbsoluteURL(String urlString, String baseURLStr, String locationURLStr) intintorg.cybergarage.xml.NodelongintgetIcon(int n) getIconByURI(String uri) intgetLocationURL(String host) org.cybergarage.upnp.device.PresentationListenerorg.cybergarage.xml.NodegetService(String name) getServiceByControlURL(String searchUrl) getServiceByEventSubURL(String searchUrl) getServiceBySCPDURL(String searchUrl) intvoidvoidorg.cybergarage.upnp.ssdp.SSDPPacketintgetStateVariable(String name) getStateVariable(String serviceType, String name) getSubscriberService(String uuid) longgetUDN()getUPC()getUUID()booleanbooleanhasUDN()voidhttpRequestRecieved(org.cybergarage.http.HTTPRequest httpReq) booleanstatic booleanisDeviceNode(org.cybergarage.xml.Node node) booleanisDeviceType(String value) booleanbooleanisIconBytesURI(String uri) booleanbooleanbooleanbooleanbooleanloadDescription(File file) booleanloadDescription(InputStream input) booleanloadDescription(String descString) voidlock()static final voidbooleanpostSearchResponse(org.cybergarage.upnp.ssdp.SSDPPacket ssdpPacket, String st, String usn) booleanvoidsetActionListener(org.cybergarage.upnp.control.ActionListener listener) voidsetActionListener(org.cybergarage.upnp.control.ActionListener listener, boolean includeSubDevices) voidsetDeviceNode(org.cybergarage.xml.Node node) voidsetDeviceType(String value) voidsetFriendlyName(String value) voidsetHTTPBindAddress(InetAddress[] inets) voidsetHTTPPort(int port) voidsetLeaseTime(int value) voidsetLocation(String value) voidsetManufacture(String value) voidsetManufactureURL(String value) voidsetModelDescription(String value) voidsetModelName(String value) voidsetModelNumber(String value) voidsetModelURL(String value) voidvoidvoidsetNMPRMode(boolean flag) voidsetPresentationListener(org.cybergarage.upnp.device.PresentationListener listener) voidsetPresentationURL(String value) voidsetQueryListener(org.cybergarage.upnp.control.QueryListener listener) voidsetQueryListener(org.cybergarage.upnp.control.QueryListener listener, boolean includeSubDevices) voidsetRootNode(org.cybergarage.xml.Node node) voidsetSerialNumber(String value) voidsetSSDPBindAddress(InetAddress[] inets) voidsetSSDPPacket(org.cybergarage.upnp.ssdp.SSDPPacket packet) voidsetSSDPPort(int port) voidvoidvoidsetUserData(Object data) voidsetWirelessMode(boolean flag) booleanstart()booleanstop()voidunlock()void
-
Field Details
-
ELEM_NAME
- See Also:
-
UPNP_ROOTDEVICE
- See Also:
-
DEFAULT_STARTUP_WAIT_TIME
public static final int DEFAULT_STARTUP_WAIT_TIME- See Also:
-
DEFAULT_DISCOVERY_WAIT_TIME
public static final int DEFAULT_DISCOVERY_WAIT_TIME- See Also:
-
DEFAULT_LEASE_TIME
public static final int DEFAULT_LEASE_TIME- See Also:
-
HTTP_DEFAULT_PORT
public static final int HTTP_DEFAULT_PORT- See Also:
-
DEFAULT_DESCRIPTION_URI
- See Also:
-
DEFAULT_PRESENTATION_URI
- See Also:
-
-
Constructor Details
-
Device
public Device(org.cybergarage.xml.Node root, org.cybergarage.xml.Node device) -
Device
public Device() -
Device
public Device(org.cybergarage.xml.Node device) -
Device
- Throws:
org.cybergarage.upnp.device.InvalidDescriptionException
-
Device
- Throws:
org.cybergarage.upnp.device.InvalidDescriptionException- Since:
- 1.8.0
-
Device
public Device(String descriptionFileName) throws org.cybergarage.upnp.device.InvalidDescriptionException - Throws:
org.cybergarage.upnp.device.InvalidDescriptionException
-
-
Method Details
-
getRootNode
public org.cybergarage.xml.Node getRootNode() -
getDeviceNode
public org.cybergarage.xml.Node getDeviceNode() -
setRootNode
public void setRootNode(org.cybergarage.xml.Node node) -
setDeviceNode
public void setDeviceNode(org.cybergarage.xml.Node node) -
lock
public void lock() -
unlock
public void unlock() -
getAbsoluteURL
-
getAbsoluteURL
-
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
-
getBootId
public int getBootId() -
updateConfigId
public void updateConfigId() -
getConfigId
public int getConfigId() -
getRootDevice
-
getParentDevice
- Returns:
- A Device that contain this object.
Returnnullif this is a root device.
-
addService
Add a Service to device without checking for duplicate or syntax error- Parameters:
s- Add Service s to the Device
-
addDevice
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
-
getDescriptionFilePath
-
loadDescription
public boolean loadDescription(InputStream input) throws org.cybergarage.upnp.device.InvalidDescriptionException - Throws:
org.cybergarage.upnp.device.InvalidDescriptionException- Since:
- 1.8.0
-
loadDescription
public boolean loadDescription(String descString) throws org.cybergarage.upnp.device.InvalidDescriptionException - Throws:
org.cybergarage.upnp.device.InvalidDescriptionException
-
loadDescription
public boolean loadDescription(File file) throws org.cybergarage.upnp.device.InvalidDescriptionException - Throws:
org.cybergarage.upnp.device.InvalidDescriptionException
-
isDeviceNode
public static boolean isDeviceNode(org.cybergarage.xml.Node node) -
isRootDevice
public boolean isRootDevice() -
setSSDPPacket
public void setSSDPPacket(org.cybergarage.upnp.ssdp.SSDPPacket packet) -
getSSDPPacket
public org.cybergarage.upnp.ssdp.SSDPPacket getSSDPPacket() -
setLocation
-
getLocation
-
setLeaseTime
public void setLeaseTime(int value) -
getLeaseTime
public int getLeaseTime() -
getTimeStamp
public long getTimeStamp() -
getElapsedTime
public long getElapsedTime() -
isExpired
public boolean isExpired() -
getURLBase
-
setDeviceType
-
getDeviceType
-
isDeviceType
-
setFriendlyName
-
getFriendlyName
-
setManufacture
-
getManufacture
-
setManufactureURL
-
getManufactureURL
-
setModelDescription
-
getModelDescription
-
setModelName
-
getModelName
-
setModelNumber
-
getModelNumber
-
setModelURL
-
getModelURL
-
setSerialNumber
-
getSerialNumber
-
setUDN
-
getUDN
-
hasUDN
public boolean hasUDN() -
setUPC
-
getUPC
-
setPresentationURL
-
getPresentationURL
-
removePresentationURL
public boolean removePresentationURL() -
setPresentationListener
public void setPresentationListener(org.cybergarage.upnp.device.PresentationListener listener) -
hasPresentationListener
public boolean hasPresentationListener() -
getPresentationListener
public org.cybergarage.upnp.device.PresentationListener getPresentationListener() -
getDeviceList
-
isDevice
-
getDevice
-
getDeviceByDescriptionURI
-
getServiceList
-
getService
-
getServiceBySCPDURL
-
getServiceByControlURL
-
getServiceByEventSubURL
-
getSubscriberService
-
getStateVariable
-
getStateVariable
-
getAction
-
isIconBytesURI
-
getIconByURI
-
addIcon
-
getIconList
-
getIcon
-
getSmallestIcon
-
getLocationURL
-
notifyWait
public static final void notifyWait() -
announce
-
announce
public void announce() -
byebye
-
byebye
public void byebye() -
postSearchResponse
-
deviceSearchResponse
public void deviceSearchResponse(org.cybergarage.upnp.ssdp.SSDPPacket ssdpPacket) -
deviceSearchReceived
public void deviceSearchReceived(org.cybergarage.upnp.ssdp.SSDPPacket ssdpPacket) - Specified by:
deviceSearchReceivedin interfaceorg.cybergarage.upnp.device.SearchListener
-
setHTTPPort
public void setHTTPPort(int port) -
getHTTPPort
public int getHTTPPort() -
setHTTPBindAddress
-
getHTTPBindAddress
-
getSSDPIPv4MulticastAddress
- Returns:
- Since:
- 1.8
-
getSSDPIPv4MulticastAddress
- Parameters:
ip-- Since:
- 1.8
-
getSSDPIPv6MulticastAddress
- Returns:
- Since:
- 1.8
-
getSSDPIPv6MulticastAddress
- Parameters:
ip-- Since:
- 1.8
-
httpRequestRecieved
public void httpRequestRecieved(org.cybergarage.http.HTTPRequest httpReq) - Specified by:
httpRequestRecievedin interfaceorg.cybergarage.http.HTTPRequestListener
-
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
- Parameters:
inets- The IP that will be used for binding the SSDP service. Usenullto get the default beahvior
-
getSSDPBindAddress
- Returns:
- inets The IP that will be used for binding the SSDP service. null means the default setted by the class UPnP
-
setMulticastIPv4Address
- Parameters:
ip- The IPv4 address used for Multicast comunication
-
getMulticastIPv4Address
- Returns:
- The IPv4 address used for Multicast comunication
-
setMulticastIPv6Address
- Parameters:
ip- The IPv address used for Multicast comunication
-
getMulticastIPv6Address
- Returns:
- The IPv address used for Multicast comunication
-
start
public boolean start() -
stop
public boolean stop() -
isRunning
public boolean isRunning() -
getInterfaceAddress
-
setActionListener
public void setActionListener(org.cybergarage.upnp.control.ActionListener listener) -
setQueryListener
public void setQueryListener(org.cybergarage.upnp.control.QueryListener listener) -
setActionListener
public void setActionListener(org.cybergarage.upnp.control.ActionListener listener, boolean includeSubDevices) -
setQueryListener
public void setQueryListener(org.cybergarage.upnp.control.QueryListener listener, boolean includeSubDevices) -
setUserData
-
getUserData
-