Author: furfari
Date: Fri Apr 11 12:49:04 2008
New Revision: 647286

URL: http://svn.apache.org/viewvc?rev=647286&view=rev
Log:
Updated bundles version in the UPnP script
Added random generation of devices ID in the examples
Review of driver interface documentation

Modified:
    
felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/controller/DevicesInfo.java
    
felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/controller/DriverController.java
    felix/trunk/upnp/doc/config.properties.upnp
    
felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/devices/LightDevice.java
    
felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockDevice.java
    
felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvDevice.java

Modified: 
felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/controller/DevicesInfo.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/controller/DevicesInfo.java?rev=647286&r1=647285&r2=647286&view=diff
==============================================================================
--- 
felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/controller/DevicesInfo.java
 (original)
+++ 
felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/controller/DevicesInfo.java
 Fri Apr 11 12:49:04 2008
@@ -25,32 +25,34 @@
 public interface DevicesInfo{
     /**
      * 
-     * Allow you to get the URL that poinr to the XML description of
+     * Allow you to get the URL of the XML description of
      * a device specified by UUID. 
      * 
      * @param udn the UUID that identify a device
-     * @return The String that rappresent the URL that point to the 
description of the Device
+     * @return a String representing the URL pointing to the description of 
the Device
      */
     public String getLocationURL(String udn);
     
     /**
      * 
-     * Allow you to get the URL that poinr to the XML description of
-     * a service specified by ServiceId and UUID of the device that 
-     * contain the service 
+     * Allow you to get the URL of the XML description of
+     * a service specified by the ServiceId and the UUID of the device that 
+     * contains the service 
      * 
      * @param udn the UUID of the device that contain the service
      * @param serviceId the ServiceId of the service
-     * @return The String that rappresent the URL that point to the 
description of the Service
+     * @return a String representing the URL pointing to the description of 
the Device
      */
     public String getSCPDURL(String udn,String serviceId);  
     
     /**
-     * Allow you to get the absolue URL of a link that is conatin in a device
+     * Allow you to get the absolute URL of a link that is contained in a 
device. 
+     * For example the presentation page of a device might be relative to the 
BASE URL 
+     * declared in the device description.
      * 
      * @param udn the UUID of the UPnP Device 
      * @param link the relative link that you want to resolve
-     * @return The String that rappresent the absolute URL to the resourse 
specified by link
+     * @return a String representing the absolute URL of the resource 
specified by the link
      */
     public String resolveRelativeUrl(String udn, String link);
     

Modified: 
felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/controller/DriverController.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/controller/DriverController.java?rev=647286&r1=647285&r2=647286&view=diff
==============================================================================
--- 
felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/controller/DriverController.java
 (original)
+++ 
felix/trunk/upnp/basedriver/src/main/java/org/apache/felix/upnp/basedriver/controller/DriverController.java
 Fri Apr 11 12:49:04 2008
@@ -26,12 +26,12 @@
 */
 public interface DriverController {
        /**
-        * String for searching all the device on UPnP Network
+        * String for searching all the device on UPnP Networks
         */
     public final static String ALL_DEVICE = "ssdp:all";
     
     /**
-     * String for searching only root device on UPnP Network
+     * String for searching only root device on UPnP Networks
      */
     public final static String ROOT_DEVICE = "upnp:rootdevice";
     /*
@@ -44,7 +44,7 @@
      * Set how much messages should be sent by UPnP Base Driver
      * for debugging purpose
      * 
-     * @param n the level of log that you want to set
+     * @param n the level of log that you want to set (0-4)
      */
     public void setLogLevel(int n);
     
@@ -68,8 +68,8 @@
     public boolean getCyberDebug();
     
     /**
-     * Sent a search message on the UPnP Network, and refresh the device 
-     * founded by UPnP Base Driver 
+     * forces the UPnP base driver to send an M-SEARCH message on the UPnP 
Networks, and refresh the device 
+     * found by UPnP Base Driver 
      * 
      * @param target The SSDP string used for the search
      */

Modified: felix/trunk/upnp/doc/config.properties.upnp
URL: 
http://svn.apache.org/viewvc/felix/trunk/upnp/doc/config.properties.upnp?rev=647286&r1=647285&r2=647286&view=diff
==============================================================================
--- felix/trunk/upnp/doc/config.properties.upnp (original)
+++ felix/trunk/upnp/doc/config.properties.upnp Fri Apr 11 12:49:04 2008
@@ -34,8 +34,8 @@
  file:bundle/org.apache.felix.shell.tui-1.1.0-SNAPSHOT.jar \
  file:bundle/org.apache.felix.bundlerepository-1.1.0-SNAPSHOT.jar \
  file:../org.osgi.core/target/org.osgi.core-1.1.0-SNAPSHOT.jar \
- file:../javax.servlet/target/javax.servlet-0.9.0-SNAPSHOT.jar \
- file:../org.osgi.compendium/target/org.osgi.compendium-0.9.0-SNAPSHOT.jar \
+ file:../javax.servlet/target/javax.servlet-1.0.1-SNAPSHOT.jar \
+ file:../org.osgi.compendium/target/org.osgi.compendium-1.1.0-SNAPSHOT.jar \
  file:../http.jetty/target/org.apache.felix.http.jetty-0.9.0-SNAPSHOT.jar \
  
file:../upnp/basedriver/target/org.apache.felix.upnp.basedriver-0.3.0-SNAPSHOT.jar
 \
  file:../upnp/extra/target/org.apache.felix.upnp.extra-0.3.0-SNAPSHOT.jar \

Modified: 
felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/devices/LightDevice.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/devices/LightDevice.java?rev=647286&r1=647285&r2=647286&view=diff
==============================================================================
--- 
felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/devices/LightDevice.java
 (original)
+++ 
felix/trunk/upnp/samples/binarylight/src/main/java/org/apache/felix/upnp/sample/binaryLight/devices/LightDevice.java
 Fri Apr 11 12:49:04 2008
@@ -23,6 +23,7 @@
 import java.net.UnknownHostException;
 import java.util.Dictionary;
 import java.util.Properties;
+import java.util.Random;
 
 import org.osgi.framework.BundleContext;
 import org.osgi.service.upnp.UPnPDevice;
@@ -41,7 +42,7 @@
 
 public class LightDevice implements UPnPDevice {
 
-       final private String DEVICE_ID = "uuid:Felix-BinaryLight";
+       final private String DEVICE_ID = "uuid:Felix-BinaryLight+" 
+Integer.toHexString(new Random(System.currentTimeMillis()).nextInt());
        private BundleContext context;
        private LightModel model;
        private LightUI ui;

Modified: 
felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockDevice.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockDevice.java?rev=647286&r1=647285&r2=647286&view=diff
==============================================================================
--- 
felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockDevice.java
 (original)
+++ 
felix/trunk/upnp/samples/clock/src/main/java/org/apache/felix/upnp/sample/clock/ClockDevice.java
 Fri Apr 11 12:49:04 2008
@@ -24,6 +24,7 @@
 import java.util.Calendar;
 import java.util.Dictionary;
 import java.util.Properties;
+import java.util.Random;
 
 import org.osgi.framework.BundleContext;
 import org.osgi.service.upnp.UPnPDevice;
@@ -35,7 +36,7 @@
 
 public class ClockDevice implements UPnPDevice {
 
-       final private String DEVICE_ID = "uuid:Felix-Clock";
+       final private String DEVICE_ID = 
"uuid:Felix-Clock+"+Integer.toHexString(new 
Random(System.currentTimeMillis()).nextInt());
        private BundleContext context;
        private TimerService timerService;
        private UPnPService[] services;
@@ -54,7 +55,7 @@
         * 
         */
        private void buildEventNotifyer() {
-                notifier = new 
UPnPEventNotifier(context,this,timerService,null);
+                notifier = new UPnPEventNotifier(context,this,timerService);
        }
 
        private void setupDeviceProperties(){

Modified: 
felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvDevice.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvDevice.java?rev=647286&r1=647285&r2=647286&view=diff
==============================================================================
--- 
felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvDevice.java
 (original)
+++ 
felix/trunk/upnp/samples/tv/src/main/java/org/apache/felix/upnp/sample/tv/TvDevice.java
 Fri Apr 11 12:49:04 2008
@@ -24,6 +24,7 @@
 import java.util.Date;
 import java.util.Dictionary;
 import java.util.Properties;
+import java.util.Random;
 
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
@@ -37,21 +38,22 @@
 import org.osgi.service.upnp.UPnPService;
 
 import org.apache.felix.upnp.extra.util.UPnPEventNotifier;
+import org.apache.felix.upnp.extra.util.UPnPSubscriber;
 
 public class TvDevice implements UPnPDevice,UPnPEventListener,ServiceListener  
{
        
-       final private String DEVICE_ID = "uuid:Felix-TV";
+       final private String DEVICE_ID = "uuid:Felix-TV+" 
+Integer.toHexString(new Random(System.currentTimeMillis()).nextInt());
        private final static String CLOCK_DEVICE_TYPE = 
"urn:schemas-upnp-org:device:clock:1";
-       private final static String CLOCK_SERVICE_TYPE = 
"urn:schemas-upnp-org:service:timer:1";
+       private final static String TIME_SERVICE_TYPE = 
"urn:schemas-upnp-org:service:timer:1";
        
        private final static String LIGHT_DEVICE_TYPE = 
"urn:schemas-upnp-org:device:light:1";
-       private final static String LIGHT_SERVICE_TYPE = 
"urn:schemas-upnp-org:service:power:1";
+       private final static String POWER_SERVICE_TYPE = 
"urn:schemas-upnp-org:service:power:1";
 
        private final static String AIRCON_DEVICE_TYPE = 
"urn:schemas-upnp-org:device:aircon:1";
-       private final static String AIRCON_SERVICE_TYPE = 
"urn:schemas-upnp-org:service:temp:1";
+       private final static String TEMP_SERVICE_TYPE = 
"urn:schemas-upnp-org:service:temp:1";
        
        private final static String WASHER_DEVICE_TYPE = 
"urn:schemas-upnp-org:device:washer:1";
-       private final static String WASHER_SERVICE_TYPE = 
"urn:schemas-upnp-org:service:state:1";
+       private final static String STATUS_SERVICE_TYPE = 
"urn:schemas-upnp-org:service:state:1";
 
        private final String devicesFilter = 
                "(&"+
@@ -85,7 +87,7 @@
         * 
         */
        private void buildEventNotifyer() {
-               notifier = new 
UPnPEventNotifier(Activator.context,this,powerService,null);
+               notifier = new 
UPnPEventNotifier(Activator.context,this,powerService);
                powerState.setNotifier(notifier);
        }
 
@@ -234,14 +236,14 @@
        public void doSubscribe()
        {
                subscriber = new UPnPSubscriber(Activator.context,this);
-               subscriber.subscribe(CLOCK_DEVICE_TYPE, CLOCK_SERVICE_TYPE);
-               subscriber.subscribe(AIRCON_DEVICE_TYPE, AIRCON_SERVICE_TYPE);
-               subscriber.subscribe(LIGHT_DEVICE_TYPE, LIGHT_SERVICE_TYPE);
-               subscriber.subscribe(WASHER_DEVICE_TYPE, WASHER_SERVICE_TYPE);
+               subscriber.subscribeEveryServiceType(CLOCK_DEVICE_TYPE, 
TIME_SERVICE_TYPE);
+               subscriber.subscribeEveryServiceType(AIRCON_DEVICE_TYPE, 
TEMP_SERVICE_TYPE);
+               subscriber.subscribeEveryServiceType(LIGHT_DEVICE_TYPE, 
POWER_SERVICE_TYPE);
+               subscriber.subscribeEveryServiceType(WASHER_DEVICE_TYPE, 
STATUS_SERVICE_TYPE);
        }
        
        public void undoSubscribe(){
-               subscriber.unsubscribe();
+               subscriber.unsubscribeAll();
        }
        
        ArrayList LinkedDevices = new ArrayList();


Reply via email to