Package org.cybergarage.upnp

Examples of org.cybergarage.upnp.Device


    }

    public void startDevice(){
      stopDevice();
      try {
        antsDev = new Device(DESCRIPTION_FILE_NAME);

        Action getTimeAction = antsDev.getAction("GetLANAddress");
        getTimeAction.setActionListener(this);

        ServiceList serviceList = antsDev.getServiceList();
View Full Code Here


   * the port mapping service.
   */
  private void discoverService() {

    for (Iterator iter = _router.getDeviceList().iterator();iter.hasNext();) {
      Device current = (Device)iter.next();
      if (!current.getDeviceType().equals(WAN_DEVICE))
        continue;

      DeviceList l = current.getDeviceList();
        _logger.info("found "+current.getDeviceType()+", size: "+l.size() + ", on: " + current.getFriendlyName());

      for (int i=0;i<current.getDeviceList().size();i++) {
        Device current2 = l.getDevice(i);

        if (!current2.getDeviceType().equals(WANCON_DEVICE))
          continue;

          _logger.info("found "+current2.getDeviceType() + ", on: " + current2.getFriendlyName());

        _service = current2.getService(SERVICE_TYPE);
        return;
      }
    }
  }
View Full Code Here

      return false;

    DeviceList devList = controller.getDeviceList();
    int devCnt = devList.size();
    for (int n=0; n<devCnt; n++) {
      Device dev = devList.getDevice(n);
      if (dev.isDeviceType(MediaServer.DEVICE_TYPE) == false)
        continue;
      System.out.println("[" + n +  "] " + dev.getFriendlyName() + ", " + dev.getLeaseTime() + ", " + dev.getElapsedTime());
    }   

    int nContents = getNContentNodes();
    ContentNode cnode[] = new ContentNode[nContents];
    for (int n=0; n<nContents; n++)
View Full Code Here

    properties.put(UPnPDevice.MODEL_NUMBER, dev.getModelNumber());
    /* MODEL_URL */
    properties.put(UPnPDevice.MODEL_URL, dev.getModelURL());
    /* PARENT_UDN */
    if (!dev.isRootDevice()) {
      Device parent = dev.getParentDevice();
      /*Device root = dev.getRootDevice();
      if (root == null) {
        System.out.println("il device " + dev.getFriendlyName()
            + "non ha root !!!");
      }*/
      properties.put(UPnPDevice.PARENT_UDN, parent.getUDN());
    }
    /* PRESENTATION_URL */
    properties.put(UPnPDevice.PRESENTATION_URL, dev.getPresentationURL());
    /* SERIAL_NUMBER */
    properties.put(UPnPDevice.SERIAL_NUMBER, dev.getSerialNumber());
View Full Code Here

    }else if((childs==null)||(childsUDN==null)){
      return false;
    }else if(childs.length==childsUDN.length){
            DeviceList dl = d.getDeviceList();
            for (int i = 0; i < childs.length; i++) {
                Device dev = (Device)dl.elementAt(i);
                if(!bindInvokes(dev,childs[i]))
                    return false;
            }

      return true;
View Full Code Here

    Properties p = new Properties();

    StringBuffer sb = new StringBuffer("(|");
    Vector v = new Vector();
    v.add(d);
    Device current;
    while (v.size() != 0) {
      current = (Device) v.elementAt(0);
      v.remove(0);
      DeviceList dl = current.getDeviceList();
      for (int i = 0; i < dl.size(); i++) {
        v.add(dl.elementAt(i));
      }
      sb.append("(").append(UPnPDevice.ID).append("=").append(
          current.getUDN()).append(")");
    }
    sb.append(")");
    Filter f = null;
    try {
      f = Activator.bc.createFilter(sb.toString());
View Full Code Here

    Activator.logger.INFO("Done");
   
    Activator.logger.INFO("Removing device....");
    keys=exportedDevices.keys();
    while (keys.hasMoreElements()) {
      Device dev = ((ExportedDeviceInfo)
          exportedDevices.get(keys.nextElement())).getDevice();
      dev.stop();
    }   
    Activator.logger.INFO("Done");
  }
View Full Code Here

    if(udn==null){
      ExportedDeviceInfo edi =
        (ExportedDeviceInfo) exportedDevices.get(
          dev.getProperty(UPnPDevice.UDN)
        );
      Device d = edi.getDevice();
      if(d!=null) {
                Activator.logger.INFO("[Exporter] removing device:" +d.getFriendlyName());
        d.stop();
        exportedDevices.remove(d.getUDN());
      }
      ServiceRegistration srListener=edi.getServiceRegistration();
      if(srListener!=null) srListener.unregister();
     
    }else{
View Full Code Here

   
  /**
   * @see org.osgi.service.upnp.UPnPEventListener#notifyUPnPEvent(java.lang.String, java.lang.String, java.util.Dictionary)
   */
  public void notifyUPnPEvent(String deviceId, String serviceId,Dictionary events) {
    Device dAux = null;
    if(d.getUDN().equals(deviceId)){
      dAux=d;
    }else{
      dAux=d.getDevice(deviceId);
    }
    Service s = dAux.getService(serviceId);
    // fix 2/9/2004 francesco
    Enumeration e = events.keys();
    while (e.hasMoreElements()) {
            StateVariable sv;
            String dataType;
View Full Code Here

   */
  public void removeExpiredDevices() {
    DeviceList devList = getDeviceList();
    int devCnt = devList.size();
    for (int n = 0; n < devCnt; n++) {
      Device dev = devList.getDevice(n);
      if (dev.isExpired() == true) {
                Activator.logger.DEBUG("[Importer] Expired device:"+ dev.getFriendlyName());
        removeDevice(dev);
        removeOSGiExpireDevice(dev);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.cybergarage.upnp.Device

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.