Class 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
    • 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" namespace
        maxAge - the maximum age of this UPNP device in secs before considered to be outdated
        vendorFirmware - the vendor firmware
        discoveryUSN - the discovery USN used to find and create this device
        discoveryUDN - 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 supported
        IllegalStateException
      • 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" namespace
        maxAge - the maximum age of this UPNP device in secs before considered to be outdated
        vendorFirmware - 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 supported
        IllegalStateException
      • 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" namespace
        maxAge - 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 supported
        IllegalStateException
    • 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 URL
        baseURL - 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