Class Device

java.lang.Object
net.sbbi.upnp.devices.Device
Direct Known Subclasses:
RootDevice

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

    • deviceType

      public final String deviceType
    • friendlyName

      public final String friendlyName
    • manufacturer

      public final String manufacturer
    • manufacturerURL

      public final URL manufacturerURL
    • presentationURL

      public final URL presentationURL
    • modelDescription

      public final String modelDescription
    • modelName

      public final String modelName
    • modelNumber

      public final String modelNumber
    • modelURL

      public final String modelURL
    • serialNumber

      public final String serialNumber
    • UDN

      public final String UDN
    • USN

      public final String USN
    • UPC

      public final long UPC
    • services

      public final Service[] services
    • childDevices

      public final Device[] childDevices
    • parent

      public final Device parent
  • Constructor Details

    • Device

      public Device(Node deviceCtx, Device parent, URL urlBase)
      Parameters:
      deviceCtx -
      parent -
      urlBase -
  • Method Details

    • 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
    • getChildDevices

      public 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(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(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(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 List<Service> getServices(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 String toString()
      Overrides:
      toString in class Object