Package net.sbbi.upnp.devices
Class UPNPRootDevice
- java.lang.Object
-
- net.sbbi.upnp.devices.UPNPDevice
-
- net.sbbi.upnp.devices.UPNPRootDevice
-
public class UPNPRootDevice extends UPNPDevice
Root UPNP device that is contained in a device definition file. Slightly differs from a simple UPNPDevice object. This object will contains all the child devices, this is the top objet in the UPNP device devices hierarchy.- Version:
- 1.0
- Author:
- SuperBonBon
-
-
Field Summary
-
Fields inherited from class net.sbbi.upnp.devices.UPNPDevice
childDevices, deviceIcons, deviceType, friendlyName, manufacturer, manufacturerURL, modelDescription, modelName, modelNumber, modelURL, parent, presentationURL, serialNumber, services, UDN, UPC, USN
-
-
Constructor Summary
Constructors Constructor Description UPNPRootDevice(URL deviceDefLoc, String maxAge)Constructor for the root device, constructs itself from An xml device definition file provided by the UPNP device via http normally.UPNPRootDevice(URL deviceDefLoc, String maxAge, String vendorFirmware)Constructor for the root device, constructs itself from An xml device definition file provided by the UPNP device via http normally.UPNPRootDevice(URL deviceDefLoc, String maxAge, String vendorFirmware, String discoveryUSN, String discoveryUDN)Constructor for the root device, constructs itself from An xml device definition file provided by the UPNP device via http normally.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description URLgetDeviceDefLoc()Retreives the device description file locationStringgetDeviceDefLocData()Retrieves the device definition XML dataStringgetDiscoveryUDN()StringgetDiscoveryUSN()intgetSpecVersionMajor()intgetSpecVersionMinor()org.apache.commons.jxpath.ContainergetUPNPDevice()Used for JXPath parsing, do not use this methodstatic URLgetURL(String url, URL baseURL)Parsing an URL from the descriptionXML fileURLgetURLBase()URL base acceslonggetValidityTime()The validity time for this device in milliseconds,StringgetVendorFirmware()voidresetValidityTime(String newMaxAge)Resets the device validity time-
Methods inherited from class net.sbbi.upnp.devices.UPNPDevice
getChildDevice, getChildDevices, getDeviceIcons, getDeviceType, getDirectParent, getFriendlyName, getManufacturer, getManufacturerURL, getModelDescription, getModelName, getModelNumber, getModelURL, getPresentationURL, getSerialNumber, getService, getServiceByID, getServices, getServices, getTopLevelChildDevices, getUDN, getUPC, getUSN, isRootDevice, toString
-
-
-
-
Constructor Detail
-
UPNPRootDevice
public UPNPRootDevice(URL deviceDefLoc, String maxAge, String vendorFirmware, String discoveryUSN, String discoveryUDN) throws MalformedURLException, IllegalStateException
Constructor for the root device, constructs itself from An xml device definition file provided by the UPNP device via http normally.- Parameters:
deviceDefLoc- the location of the XML device definition file using "the urn:schemas-upnp-org:device-1-0" namespacemaxAge- the maximum age of this UPNP device in secs before considered to be outdatedvendorFirmware- the vendor firmwarediscoveryUSN- the discovery USN used to find and create this devicediscoveryUDN- the discovery UDN used to find and create this device- Throws:
MalformedURLException- if the location URL is invalid and cannot be used to populate this root object and its child devices IllegalStateException if the device has an unsupported version, currently only version 1.0 is supportedIllegalStateException
-
UPNPRootDevice
public UPNPRootDevice(URL deviceDefLoc, String maxAge, String vendorFirmware) throws MalformedURLException, IllegalStateException
Constructor for the root device, constructs itself from An xml device definition file provided by the UPNP device via http normally.- Parameters:
deviceDefLoc- the location of the XML device definition file using "the urn:schemas-upnp-org:device-1-0" namespacemaxAge- the maximum age of this UPNP device in secs before considered to be outdatedvendorFirmware- the vendor firmware- Throws:
MalformedURLException- if the location URL is invalid and cannot be used to populate this root object and its child devices IllegalStateException if the device has an unsupported version, currently only version 1.0 is supportedIllegalStateException
-
UPNPRootDevice
public UPNPRootDevice(URL deviceDefLoc, String maxAge) throws MalformedURLException, IllegalStateException
Constructor for the root device, constructs itself from An xml device definition file provided by the UPNP device via http normally.- Parameters:
deviceDefLoc- the location of the XML device definition file using "the urn:schemas-upnp-org:device-1-0" namespacemaxAge- the maximum age in secs of this UPNP device before considered to be outdated- Throws:
MalformedURLException- if the location URL is invalid and cannot be used to populate this root object and its child devices IllegalStateException if the device has an unsupported version, currently only version 1.0 is supportedIllegalStateException
-
-
Method Detail
-
getValidityTime
public long getValidityTime()
The validity time for this device in milliseconds,- Returns:
- the number of milliseconds remaining before the device object that has been build is considered to be outdated, after this delay the UPNP device should resend an advertisement message or a negative value if the device is outdated
-
resetValidityTime
public void resetValidityTime(String newMaxAge)
Resets the device validity time- Parameters:
newMaxAge- the maximum age in secs of this UPNP device before considered to be outdated
-
getDeviceDefLoc
public URL getDeviceDefLoc()
Retreives the device description file location- Returns:
- an URL
-
getSpecVersionMajor
public int getSpecVersionMajor()
-
getSpecVersionMinor
public int getSpecVersionMinor()
-
getVendorFirmware
public String getVendorFirmware()
-
getDiscoveryUSN
public String getDiscoveryUSN()
-
getDiscoveryUDN
public String getDiscoveryUDN()
-
getURLBase
public URL getURLBase()
URL base acces- Returns:
- URL the URL base, or null if the device does not provide such information
-
getURL
public static final URL getURL(String url, URL baseURL) throws MalformedURLException
Parsing an URL from the descriptionXML file- Parameters:
url- the string representation fo the URLbaseURL- the base device URL, needed if the url param is relative- Returns:
- an URL object defining the url param
- Throws:
MalformedURLException- if the url param or baseURL.toExternalForm() + url cannot be parsed to create an URL object
-
getDeviceDefLocData
public String getDeviceDefLocData()
Retrieves the device definition XML data- Returns:
- the device definition XML data as a String
-
getUPNPDevice
public org.apache.commons.jxpath.Container getUPNPDevice()
Used for JXPath parsing, do not use this method- Returns:
- a Container object for Xpath parsing capabilities
-
-