Class Device

  • Direct Known Subclasses:
    RootDevice

    public class Device
    extends java.lang.Object
    This class represents an UPNP device, this device contains a set of services that will be needed to access the device functionalities.
    • Constructor Summary

      Constructors 
      Constructor Description
      Device​(org.w3c.dom.Node deviceCtx, Device parent, java.net.URL urlBase)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Device getChildDevice​(java.lang.String deviceURI)
      Looks for a child UPNP device definition file, the whole devices tree will be searched, starting from the current device node.
      java.util.List<Device> getChildDevices()
      Generates a list of all the child ( not only top level, full childrens hierarchy included ) UPNPDevice objects for this device.
      Device getDirectParent()
      Return the parent UPNPDevice, null if the device is an UPNPRootDevice
      Service getService​(java.lang.String serviceURI)
      Looks for a UPNP device service definition object for the given service URI (Type)
      Service getServiceByID​(java.lang.String serviceID)
      Looks for a UPNP device service definition object for the given service ID
      java.util.List<Service> getServices​(java.lang.String serviceURI)
      Looks for the all the UPNP device service definition object for the current UPNP device object.
      static java.net.URL getURL​(java.lang.String url, java.net.URL baseURL)
      Parsing an URL from the descriptionXML file
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • deviceType

        public final java.lang.String deviceType
      • friendlyName

        public final java.lang.String friendlyName
      • manufacturer

        public final java.lang.String manufacturer
      • manufacturerURL

        public final java.net.URL manufacturerURL
      • presentationURL

        public final java.net.URL presentationURL
      • modelDescription

        public final java.lang.String modelDescription
      • modelName

        public final java.lang.String modelName
      • modelNumber

        public final java.lang.String modelNumber
      • modelURL

        public final java.lang.String modelURL
      • serialNumber

        public final java.lang.String serialNumber
      • UDN

        public final java.lang.String UDN
      • USN

        public final java.lang.String USN
      • UPC

        public final long UPC
      • services

        public final Service[] services
      • childDevices

        public final Device[] childDevices
      • parent

        public final Device parent
    • Constructor Detail

      • Device

        public Device​(org.w3c.dom.Node deviceCtx,
                      Device parent,
                      java.net.URL urlBase)
        Parameters:
        deviceCtx -
        parent -
        urlBase -
    • Method Detail

      • getURL

        public static final java.net.URL getURL​(java.lang.String url,
                                                java.net.URL baseURL)
                                         throws java.net.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:
        java.net.MalformedURLException - if the url param or baseURL.toExternalForm() + url cannot be parsed to create an URL object
      • getChildDevices

        public java.util.List<Device> getChildDevices()
        Generates a list of all the child ( not only top level, full childrens hierarchy included ) UPNPDevice objects for this device.
        Returns:
        the generated list or null if no child devices bound
      • getDirectParent

        public Device getDirectParent()
        Return the parent UPNPDevice, null if the device is an UPNPRootDevice
        Returns:
        the parent device instance
      • getChildDevice

        public Device getChildDevice​(java.lang.String deviceURI)
        Looks for a child UPNP device definition file, the whole devices tree will be searched, starting from the current device node.
        Parameters:
        deviceURI - the device URI to search
        Returns:
        An UPNPDevice if anything matches or null
      • getService

        public Service getService​(java.lang.String serviceURI)
        Looks for a UPNP device service definition object for the given service URI (Type)
        Parameters:
        serviceURI - the URI of the service
        Returns:
        A matching UPNPService object or null
      • getServiceByID

        public Service getServiceByID​(java.lang.String serviceID)
        Looks for a UPNP device service definition object for the given service ID
        Parameters:
        serviceID - the ID of the service
        Returns:
        A matching UPNPService object or null
      • getServices

        public java.util.List<Service> getServices​(java.lang.String serviceURI)
        Looks for the all the UPNP device service definition object for the current UPNP device object. This method can be used to retrieve multiple same kind ( same service type ) of services with different services id on a device
        Parameters:
        serviceURI - the URI of the service
        Returns:
        A matching List of UPNPService objects or null
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object