You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by do...@apache.org on 2007/12/23 23:24:05 UTC

svn commit: r606627 - in /felix/sandbox/donsez/upnp.thermometer: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/felix/ src/main/java/org/apache/felix/sandbox/ src/main/java/org/apache/felix/sandbo...

Author: donsez
Date: Sun Dec 23 14:23:56 2007
New Revision: 606627

URL: http://svn.apache.org/viewvc?rev=606627&view=rev
Log:
creation of the upnp.thermometer bundle : provides a UPnP thermometer device compliant to UPnP HVAC specification.

Added:
    felix/sandbox/donsez/upnp.thermometer/
    felix/sandbox/donsez/upnp.thermometer/pom.xml   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/
    felix/sandbox/donsez/upnp.thermometer/src/main/
    felix/sandbox/donsez/upnp.thermometer/src/main/java/
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/Activator.java   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/ApplicationStateVariable.java   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/CurrentTemperatureStateVariable.java   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/GetApplicationAction.java   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/GetCurrentTemperatureAction.java   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/GetNameAction.java   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/NameStateVariable.java   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/ResultStateVariable.java   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/SetApplicationAction.java   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/SetNameAction.java   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/TemperatureSensor.java   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/Thermometer.java   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/ThermometerDevice.java   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/gui/
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/gui/SensorFrame.java   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/gui/SensorPanel.java   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/resources/
    felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/
    felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/bgcold.jpg   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/bghot.jpg   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/bgmedium.jpg   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/thermometer.jpg   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/thermometer.png   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/thermometer2.png   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/site/
    felix/sandbox/donsez/upnp.thermometer/src/site/readme.html   (with props)
    felix/sandbox/donsez/upnp.thermometer/src/site/script.txt   (with props)

Added: felix/sandbox/donsez/upnp.thermometer/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/pom.xml?rev=606627&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.thermometer/pom.xml (added)
+++ felix/sandbox/donsez/upnp.thermometer/pom.xml Sun Dec 23 14:23:56 2007
@@ -0,0 +1,92 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project>
+
+	<properties>
+		<repositoryLocation>http://people.apache.org/~donsez/dev/osgi/</repositoryLocation>
+		<description>provides a UPnP thermometer device compliant to UPnP HVAC specifications.</description>
+	</properties>  
+
+  
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.felix.sandbox</groupId>
+  <artifactId>org.apache.felix.sandbox.upnp.thermometer</artifactId>
+  <version>0.1.0</version>
+  <packaging>bundle</packaging>
+  <name>Apache Felix UPnP Thermometer Device</name>
+  <description>${description}</description>
+
+  <dependencies>
+
+	<dependency>
+		<groupId>org.apache.felix</groupId>
+		<artifactId>org.osgi.core</artifactId>
+  		<version>1.1.0-SNAPSHOT</version>
+	</dependency>
+	
+	<dependency>
+		<groupId>org.apache.felix</groupId>
+		<artifactId>org.osgi.compendium</artifactId>
+  		<version>0.9.0-SNAPSHOT</version>
+	</dependency>
+	
+    <dependency>
+	  <groupId>org.apache.felix.sandbox</groupId>
+      <artifactId>org.apache.felix.upnp.devicegen.util</artifactId>
+      <version>0.1.0</version>
+    </dependency>
+
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>          
+          	<!-- docs in http://cwiki.apache.org/FELIX/bundle-plugin-for-maven-bnd.html and http://cwiki.apache.org/FELIX/osgi-plugin-for-maven-2.html -->
+          	
+            <Export-Service>org.osgi.service.upnp.UPnPDevice</Export-Service>
+            <Private-Package>${pom.artifactId}, ${pom.artifactId}.device, ${pom.artifactId}.gui, icon</Private-Package>
+            <Import-Package>*</Import-Package>
+            <Bundle-Activator>${pom.artifactId}.Activator</Bundle-Activator>
+          </instructions>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <!--
+  <repositories>
+    <repository>
+      <id>apache.m2.incubator</id>
+      <name>Apache M2 Incubator Repository</name>
+      <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+    </repository>
+  </repositories>
+  <pluginRepositories>
+    <pluginRepository>
+      <id>apache.m2.incubator</id>
+      <name>Apache M2 Incubator Repository</name>
+      <url>http://people.apache.org/repo/m2-incubating-repository/</url>
+    </pluginRepository>
+  </pluginRepositories>
+  -->
+</project>

Propchange: felix/sandbox/donsez/upnp.thermometer/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/Activator.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/Activator.java?rev=606627&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/Activator.java (added)
+++ felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/Activator.java Sun Dec 23 14:23:56 2007
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.sandbox.upnp.thermometer;
+
+import java.util.Dictionary;
+
+import org.apache.felix.sandbox.upnp.thermometer.device.ThermometerDevice;
+import org.apache.felix.sandbox.upnp.thermometer.gui.SensorFrame;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.upnp.UPnPDevice;
+
+/**
+ * This class is the activator of the bundle
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class Activator implements BundleActivator {
+
+	private ServiceRegistration serviceRegistration;
+	private BundleContext bundleContext;
+	private SensorFrame sensorFrame;
+	private ThermometerDevice thermometerDevice;
+	/**
+	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext context) throws Exception {
+		this.bundleContext = context;
+
+		thermometerDevice = new ThermometerDevice(bundleContext);
+		thermometerDevice.start();
+		
+		Dictionary dict = thermometerDevice.getDescriptions(null);				
+		serviceRegistration = context.registerService(
+				UPnPDevice.class.getName(),
+				thermometerDevice,
+				dict
+			);
+		
+		sensorFrame = new SensorFrame(
+				context,
+				thermometerDevice,
+				(String) dict.get(UPnPDevice.UDN),
+				5000,
+				true
+			);
+		sensorFrame.start();
+	}
+
+	/**
+	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext context) throws Exception {
+		serviceRegistration.unregister();
+		thermometerDevice.stop();
+		sensorFrame.stop();
+	}
+}

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/Activator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/ApplicationStateVariable.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/ApplicationStateVariable.java?rev=606627&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/ApplicationStateVariable.java (added)
+++ felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/ApplicationStateVariable.java Sun Dec 23 14:23:56 2007
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.sandbox.upnp.thermometer.device;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+/**
+ * This class represents the state variable Application
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class ApplicationStateVariable implements UPnPStateVariable{
+	
+	final private String NAME = "Application";
+	final private String[] ALLOWED_VALUES=new String[]{
+			"Room","Outdoor","Pipe","AirDuct"
+	};
+	final private String DEFAULT_VALUE = ALLOWED_VALUES[0];
+
+	private Thermometer thermometer;
+	
+	public ApplicationStateVariable(){
+		thermometer = Thermometer.getInstance();
+	}
+	
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
+	 */
+	public Class getJavaDataType() {
+		return String.class;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
+	 */
+	public String getUPnPDataType() {
+		return TYPE_STRING;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
+	 */
+	public Object getDefaultValue() {
+		return DEFAULT_VALUE;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
+	 */
+	public String[] getAllowedValues() {
+		return ALLOWED_VALUES;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
+	 */
+	public Number getMinimum() {
+		return null;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
+	 */
+	public Number getMaximum() {
+		return null;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
+	 */
+	public Number getStep() {
+		return null;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
+	 */
+	public boolean sendsEvents() {
+		return true;
+	}
+
+	private String application=DEFAULT_VALUE;
+	
+	String getCurrentApplication() {
+		return application;
+	}
+	
+	void setNewApplication(String application) {
+		this.application=application;
+	}
+}

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/ApplicationStateVariable.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/CurrentTemperatureStateVariable.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/CurrentTemperatureStateVariable.java?rev=606627&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/CurrentTemperatureStateVariable.java (added)
+++ felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/CurrentTemperatureStateVariable.java Sun Dec 23 14:23:56 2007
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.sandbox.upnp.thermometer.device;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+/**
+ * This class represents the state variable CurrentTemperature
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class CurrentTemperatureStateVariable implements UPnPStateVariable{
+	
+	final private String NAME = "Temperature";
+	final private Integer DEFAULT_VALUE = null;
+	final private String[] ALLOWED_VALUES = null;
+	final private Number STEP = new Integer(1); // 0.01 ° Celsius
+	final private Number MAX = null;
+	final private Number MIN = null;
+
+	private Thermometer thermometer;
+	
+	public CurrentTemperatureStateVariable(){
+		thermometer = Thermometer.getInstance();
+	}
+	
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
+	 */
+	public Class getJavaDataType() {
+		return Integer.class;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
+	 */
+	public String getUPnPDataType() {
+		return TYPE_I4;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
+	 */
+	public Object getDefaultValue() {
+		return DEFAULT_VALUE;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
+	 */
+	public String[] getAllowedValues() {
+		return null;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
+	 */
+	public Number getMinimum() {
+		return MIN;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
+	 */
+	public Number getMaximum() {
+		return MAX;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
+	 */
+	public Number getStep() {
+		return STEP;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
+	 */
+	public boolean sendsEvents() {
+		return true;
+	}
+	
+	public Integer getCurrentTemperature(){
+		return thermometer.getTemperature();
+	}
+}

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/CurrentTemperatureStateVariable.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/GetApplicationAction.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/GetApplicationAction.java?rev=606627&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/GetApplicationAction.java (added)
+++ felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/GetApplicationAction.java Sun Dec 23 14:23:56 2007
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.sandbox.upnp.thermometer.device;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+/**
+ * This class represents the action GetApplication
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class GetApplicationAction implements UPnPAction {
+
+	final private String NAME = "GetApplication";
+	final private String RESULT_STATUS = "CurrentApplication";
+	final private String[] IN_ARG_NAMES = null;
+	final private String[] OUT_ARG_NAMES = new String[]{RESULT_STATUS};
+	private ApplicationStateVariable application;	
+	
+	public GetApplicationAction(ApplicationStateVariable application){
+		this.application = application;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
+	 */
+	public String getReturnArgumentName() {
+		return null;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
+	 */
+	public String[] getInputArgumentNames() {
+		
+		return IN_ARG_NAMES;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
+	 */
+	public String[] getOutputArgumentNames() {
+		return OUT_ARG_NAMES;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String argumentName) {
+		return application;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+	 */
+	public Dictionary invoke(Dictionary args) throws Exception {
+		String value = application.getCurrentApplication();
+		Hashtable result = new Hashtable();
+		result.put(RESULT_STATUS,value);
+		return result;
+	}
+}

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/GetApplicationAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/GetCurrentTemperatureAction.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/GetCurrentTemperatureAction.java?rev=606627&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/GetCurrentTemperatureAction.java (added)
+++ felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/GetCurrentTemperatureAction.java Sun Dec 23 14:23:56 2007
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.sandbox.upnp.thermometer.device;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+/**
+ * This class represents the action GetCurrentTemperature
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class GetCurrentTemperatureAction implements UPnPAction {
+
+	final private String NAME = "GetCurrentTemperature";
+	final private String RESULT_STATUS = "CurrentTemp";
+	final private String[] IN_ARG_NAMES = null;
+	final private String[] OUT_ARG_NAMES = new String[]{RESULT_STATUS};
+	private CurrentTemperatureStateVariable temperature;	
+	
+	public GetCurrentTemperatureAction(CurrentTemperatureStateVariable temperature){
+		this.temperature = temperature;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
+	 */
+	public String getReturnArgumentName() {
+		return null;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
+	 */
+	public String[] getInputArgumentNames() {
+		return 	IN_ARG_NAMES;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
+	 */
+	public String[] getOutputArgumentNames() {
+		return OUT_ARG_NAMES;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String argumentName) {
+		return temperature;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+	 */
+	public Dictionary invoke(Dictionary args) throws Exception {
+		Integer value = temperature.getCurrentTemperature();
+		Hashtable result = new Hashtable();
+		result.put(RESULT_STATUS,value);
+		return result;
+	}
+}

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/GetCurrentTemperatureAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/GetNameAction.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/GetNameAction.java?rev=606627&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/GetNameAction.java (added)
+++ felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/GetNameAction.java Sun Dec 23 14:23:56 2007
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.sandbox.upnp.thermometer.device;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+/**
+ * This class represents the action GetName
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class GetNameAction implements UPnPAction {
+
+	final private String NAME = "GetName";
+	final private String RESULT_STATUS = "CurrentName";
+	final private String[] IN_ARG_NAMES = null;
+	final private String[] OUT_ARG_NAMES = new String[]{RESULT_STATUS};
+
+	private NameStateVariable name;	
+	
+	public GetNameAction(NameStateVariable name){
+		this.name = name;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
+	 */
+	public String getReturnArgumentName() {
+		return null;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
+	 */
+	public String[] getInputArgumentNames() {
+		
+		return IN_ARG_NAMES;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
+	 */
+	public String[] getOutputArgumentNames() {
+		return OUT_ARG_NAMES;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String argumentName) {
+		return name;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+	 */
+	public Dictionary invoke(Dictionary args) throws Exception {
+		String value = name.getCurrentName();
+		Hashtable result = new Hashtable();
+		result.put(RESULT_STATUS,value);
+		return result;
+	}
+}

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/GetNameAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/NameStateVariable.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/NameStateVariable.java?rev=606627&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/NameStateVariable.java (added)
+++ felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/NameStateVariable.java Sun Dec 23 14:23:56 2007
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.sandbox.upnp.thermometer.device;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+/**
+ * This class represents the state variable Name
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class NameStateVariable implements UPnPStateVariable{
+	
+	final private String NAME = "Name";
+	final private String[] ALLOWED_VALUES=null;
+	final private String DEFAULT_VALUE="";
+
+	private Thermometer thermometer;
+	
+	public NameStateVariable(){
+		thermometer = Thermometer.getInstance();
+	}
+	
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
+	 */
+	public Class getJavaDataType() {
+		return String.class;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
+	 */
+	public String getUPnPDataType() {
+		return TYPE_STRING;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
+	 */
+	public Object getDefaultValue() {
+		return DEFAULT_VALUE;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
+	 */
+	public String[] getAllowedValues() {
+		return ALLOWED_VALUES;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
+	 */
+	public Number getMinimum() {
+		return null;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
+	 */
+	public Number getMaximum() {
+		return null;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
+	 */
+	public Number getStep() {
+		return null;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
+	 */
+	public boolean sendsEvents() {
+		return true;
+	}
+
+	private String currentName=DEFAULT_VALUE;
+	
+	String getCurrentName() {
+		return currentName;
+	}
+	
+	void setNewName(String name) {
+		this.currentName=name;
+	}
+}

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/NameStateVariable.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/ResultStateVariable.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/ResultStateVariable.java?rev=606627&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/ResultStateVariable.java (added)
+++ felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/ResultStateVariable.java Sun Dec 23 14:23:56 2007
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.sandbox.upnp.thermometer.device;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+
+/**
+ * This class represents the state variable ResultState
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class ResultStateVariable implements UPnPStateVariable{
+	
+	final private String NAME = "Result";
+	final private String DEFAULT_VALUE = "";
+	private Thermometer thermometer;
+	
+	
+	public ResultStateVariable(){
+	}
+	
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getJavaDataType()
+	 */
+	public Class getJavaDataType() {
+		return Integer.class;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getUPnPDataType()
+	 */
+	public String getUPnPDataType() {
+		return TYPE_I4;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getDefaultValue()
+	 */
+	public Object getDefaultValue() {
+		return DEFAULT_VALUE;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getAllowedValues()
+	 */
+	public String[] getAllowedValues() {
+		return null;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMinimum()
+	 */
+	public Number getMinimum() {
+		return null;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getMaximum()
+	 */
+	public Number getMaximum() {
+		return null;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#getStep()
+	 */
+	public Number getStep() {
+		return null;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPStateVariable#sendsEvents()
+	 */
+	public boolean sendsEvents() {
+		return false;
+	}	
+}

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/ResultStateVariable.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/SetApplicationAction.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/SetApplicationAction.java?rev=606627&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/SetApplicationAction.java (added)
+++ felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/SetApplicationAction.java Sun Dec 23 14:23:56 2007
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.sandbox.upnp.thermometer.device;
+
+import java.util.Dictionary;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+/**
+ * This class represents the action SetApplication
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class SetApplicationAction implements UPnPAction {
+
+	final private String NAME = "SetApplication";
+	final private String NEW_APPLICATION_VALUE = "NewApplication";
+	final private String[] IN_ARG_NAMES = new String[]{NEW_APPLICATION_VALUE};
+	final private String[] OUT_ARG_NAMES = null;
+	private ApplicationStateVariable application;
+	
+	public SetApplicationAction(ApplicationStateVariable application){
+		this.application = application;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
+	 */
+	public String getReturnArgumentName() {
+		return null;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
+	 */
+	public String[] getInputArgumentNames() {
+		return IN_ARG_NAMES;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
+	 */
+	public String[] getOutputArgumentNames() {
+		return OUT_ARG_NAMES;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String argumentName) {
+		return application;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+	 */
+	public Dictionary invoke(Dictionary args) throws Exception {
+		String value = (String) args.get(NEW_APPLICATION_VALUE);
+		application.setNewApplication(value);
+		return null;
+	}
+}

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/SetApplicationAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/SetNameAction.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/SetNameAction.java?rev=606627&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/SetNameAction.java (added)
+++ felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/SetNameAction.java Sun Dec 23 14:23:56 2007
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.sandbox.upnp.thermometer.device;
+
+import java.util.Dictionary;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+/**
+ * This class represents the action SetName
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class SetNameAction implements UPnPAction {
+
+	final private String NAME = "SetName";
+	final private String NEW_NAME_VALUE = "NewName";
+	final private String[] IN_ARG_NAMES = new String[]{NEW_NAME_VALUE};
+	final private String[] OUT_ARG_NAMES = null;
+	private NameStateVariable name;
+	
+	public SetNameAction(NameStateVariable name){
+		this.name = name;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getName()
+	 */
+	public String getName() {
+		return NAME;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getReturnArgumentName()
+	 */
+	public String getReturnArgumentName() {
+		return null;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getInputArgumentNames()
+	 */
+	public String[] getInputArgumentNames() {
+		return IN_ARG_NAMES;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getOutputArgumentNames()
+	 */
+	public String[] getOutputArgumentNames() {
+		return OUT_ARG_NAMES;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String argumentName) {
+		return name;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPAction#invoke(java.util.Dictionary)
+	 */
+	public Dictionary invoke(Dictionary args) throws Exception {
+		String value = (String) args.get(NEW_NAME_VALUE);
+		name.setNewName(value);
+		return null;
+	}
+}

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/SetNameAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/TemperatureSensor.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/TemperatureSensor.java?rev=606627&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/TemperatureSensor.java (added)
+++ felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/TemperatureSensor.java Sun Dec 23 14:23:56 2007
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.sandbox.upnp.thermometer.device;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osgi.service.upnp.UPnPAction;
+import org.osgi.service.upnp.UPnPService;
+import org.osgi.service.upnp.UPnPStateVariable;
+
+/**
+ * This class represents the service TemperatureSensor
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class TemperatureSensor implements UPnPService {
+		
+	final private String SERVICE_ID = "urn:schemas-upnp-org:serviceId:TemperatureSensor:1";
+	final private String SERVICE_TYPE = "urn:schemas-upnp-org:service:TemperatureSensor:1";
+	final private String VERSION ="1";
+
+	private Map stateVariables = new HashMap();
+	private Map actions = new HashMap();
+	
+	public TemperatureSensor(){
+
+		UPnPStateVariable stateVariable;
+		UPnPAction action;
+
+		stateVariable = new CurrentTemperatureStateVariable();
+		stateVariables.put(stateVariable.getName(),stateVariable);
+		action = new GetCurrentTemperatureAction((CurrentTemperatureStateVariable)stateVariable);
+		actions.put(action.getName(),action);
+
+		stateVariable = new ApplicationStateVariable();
+		stateVariables.put(stateVariable.getName(),stateVariable);
+		action = new GetApplicationAction((ApplicationStateVariable)stateVariable);
+		actions.put(action.getName(),action);
+		action = new SetApplicationAction((ApplicationStateVariable)stateVariable);
+		actions.put(action.getName(),action);
+		
+		stateVariable = new NameStateVariable();
+		stateVariables.put(stateVariable.getName(),stateVariable);
+		action = new GetNameAction((NameStateVariable)stateVariable);
+		actions.put(action.getName(),action);
+		action = new SetNameAction((NameStateVariable)stateVariable);
+		actions.put(action.getName(),action);
+		
+//		result = new ResultStateVariable();
+//		this.states = new UPnPStateVariable[]{temperature,result};		
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPService#getId()
+	 */
+	public String getId() {
+		return SERVICE_ID;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPService#getType()
+	 */
+	public String getType() {
+		return SERVICE_TYPE;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPService#getVersion()
+	 */
+	public String getVersion() {
+		return VERSION;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPService#getActions()
+	 */
+	public UPnPAction[] getActions() {
+		return (UPnPAction[])(actions.values()).toArray(new UPnPAction[]{});
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPService#getAction(java.lang.String)
+	 */
+	public UPnPAction getAction(String name) {
+		return (UPnPAction)actions.get(name);
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPService#getStateVariables()
+	 */
+	public UPnPStateVariable[] getStateVariables() {
+		return (UPnPStateVariable[])(stateVariables.values()).toArray(new UPnPStateVariable[]{});
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPService#getStateVariable(java.lang.String)
+	 */
+	public UPnPStateVariable getStateVariable(String name) {
+		return (UPnPStateVariable)stateVariables.get(name);
+	}
+}

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/TemperatureSensor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/Thermometer.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/Thermometer.java?rev=606627&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/Thermometer.java (added)
+++ felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/Thermometer.java Sun Dec 23 14:23:56 2007
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */package org.apache.felix.sandbox.upnp.thermometer.device;
+
+import java.text.DecimalFormat;
+
+/**
+ * This class represents the business logic of the thermometer
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class Thermometer
+{
+	private DecimalFormat format=new DecimalFormat("#0.0°C");
+
+	// TODO MAX,MIN,INCR should be configurable with configuration admin !
+	private static final int MAX = 2700; // 27°C
+	private static final int MIN = 1200; // 12°C
+	private static final int INCR = 50;  // 0,5°C
+
+	private int currentIncrement=INCR;
+	private int currentTemperature=(MAX+MIN)/2;
+	
+	public Thermometer() {
+		
+	}
+
+	
+	////////////////////////////////////////////////
+	//	paint
+	////////////////////////////////////////////////
+
+	public final static Thermometer getInstance()
+	{
+		return new Thermometer();
+	}
+
+	public String formatTemperature(Integer i)
+	{
+		return format.format(i.intValue()*0.01);
+	}
+
+	public String formatTemperature(int i)
+	{
+		return format.format(i*0.01);
+	}
+
+	public Integer getTemperature(){
+		// System.out.println("TEMP IS "+currentTemperature);
+		return new Integer(currentTemperature);
+	}
+
+	public Integer getMaxTemperature(){
+		return new Integer(MAX);
+	}
+
+	public Integer getMinTemperature(){
+		return new Integer(MIN);
+	}
+		
+	public void changeTemperature()
+	{		
+		currentTemperature+=currentIncrement;
+		if((currentTemperature<=MIN && currentIncrement<0) || (currentTemperature>=MAX  && currentIncrement>0)) currentIncrement=-currentIncrement;
+	}
+
+	public String toString()
+	{
+		return formatTemperature(getTemperature());
+	}	
+}
+

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/Thermometer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/ThermometerDevice.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/ThermometerDevice.java?rev=606627&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/ThermometerDevice.java (added)
+++ felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/ThermometerDevice.java Sun Dec 23 14:23:56 2007
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.sandbox.upnp.thermometer.device;
+
+
+import java.beans.PropertyChangeEvent;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.felix.upnp.devicegen.util.DeviceIcon;
+import org.apache.felix.upnp.devicegen.util.UPnPEventNotifier;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.device.Constants;
+import org.osgi.service.upnp.UPnPDevice;
+import org.osgi.service.upnp.UPnPIcon;
+import org.osgi.service.upnp.UPnPService;
+
+/**
+ * This class represents the UPnPDevice service
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class ThermometerDevice implements UPnPDevice {
+
+	final private String DEVICE_ID = "uuid:Felix-Fictive-Thermometer";
+	private BundleContext context;
+	private UPnPService[] services;
+	private UPnPIcon[] icons;
+
+	private Dictionary dictionary;
+	private UPnPEventNotifier[] notifiers;
+
+	Thermometer thermometer;
+
+	public ThermometerDevice(BundleContext context) {
+		this.context=context;
+		
+		List servicesList=new ArrayList();
+		servicesList.add(new TemperatureSensor());
+		services=(UPnPService[])servicesList.toArray(new UPnPService[]{});
+		
+		thermometer = Thermometer.getInstance();
+
+		/*
+		 services = new UPnPService[]{
+			new TemperatureSensor()
+		};
+		 */
+		icons =new UPnPIcon[]{
+				new DeviceIcon("image/png",32,32,0,16,"/icon/thermometer.png",this.getClass().getClassLoader())
+		};		
+		setupDeviceProperties();
+		buildEventNotifier();
+	}
+
+	/**
+	 * 
+	 */
+	private String myUDN;
+	private String getUDN(){
+		if(myUDN==null){
+		try {
+			myUDN=DEVICE_ID+'@'+InetAddress.getLocalHost().getHostAddress();
+		} catch (UnknownHostException e) {
+			myUDN=DEVICE_ID;
+		}
+		}
+		return myUDN;
+	}
+	
+	/**
+	 * 
+	 */
+	private void buildEventNotifier() {
+		notifiers=new UPnPEventNotifier[services.length];
+		for(int n=0;n<notifiers.length;n++)
+			notifiers[n] = new UPnPEventNotifier(context,this,services[n],null);
+	}
+
+	private void setupDeviceProperties(){
+		dictionary = new Properties();
+		dictionary.put(UPnPDevice.UPNP_EXPORT,"");
+		dictionary.put(Constants.DEVICE_CATEGORY,"UPnP"); // "DEVICE_CATEGORY"
+		dictionary.put(UPnPDevice.DEVICE_CATEGORY,new String[]{UPnPDevice.DEVICE_CATEGORY});
+		dictionary.put(UPnPDevice.FRIENDLY_NAME,"TemperatureSensor");
+		dictionary.put(UPnPDevice.MANUFACTURER,"Apache Felix Project");
+		dictionary.put(UPnPDevice.MANUFACTURER_URL,"http://people.apache.org/~donsez");
+		dictionary.put(UPnPDevice.MODEL_DESCRIPTION,"A temperature (sensor) device to test OSGi to UPnP service export");
+		dictionary.put(UPnPDevice.MODEL_NAME,"Felix Fictive Thermometer");
+		dictionary.put(UPnPDevice.MODEL_NUMBER,"1.0");
+		dictionary.put(UPnPDevice.MODEL_URL,"http://people.apache.org/~donsez/dev/osgi/upnp.thermometer/");
+		dictionary.put(UPnPDevice.PRESENTATION_URL,"http://people.apache.org/~donsez/dev/osgi/upnp.thermometer/presentation.html");
+		dictionary.put(UPnPDevice.SERIAL_NUMBER,"123456789");
+		dictionary.put(UPnPDevice.TYPE,"urn:schemas-upnp-org:device:thermometer:1");
+		dictionary.put(UPnPDevice.UPC,"1213456789"); // should be generated during the first activation
+
+		dictionary.put(UPnPDevice.UDN,getUDN());
+		dictionary.put(UPnPDevice.ID,dictionary.get(UPnPDevice.UDN));
+	}
+	
+	/**
+	 * @see org.osgi.service.upnp.UPnPDevice#getService(java.lang.String)
+	 */
+	public UPnPService getService(String serviceId) {
+		for(int s=0;s<services.length;s++)
+			if(serviceId.equals(services[s].getId())) return services[s];
+		return null;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPDevice#getServices()
+	 */
+	public UPnPService[] getServices() {
+		return services;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPDevice#getIcons(java.lang.String)
+	 */
+	public UPnPIcon[] getIcons(String locale) {
+		return icons;
+	}
+
+	/**
+	 * @see org.osgi.service.upnp.UPnPDevice#getDescriptions(java.lang.String)
+	 */
+	public Dictionary getDescriptions(String locale) {
+		return dictionary;
+	}
+
+	/**
+	 * 
+	 */
+	public void start() {
+	}
+
+	/**
+	 * 
+	 */
+	public void stop() {
+		for(int n=0;n<notifiers.length;n++)		
+			notifiers[n].destroy();	
+	}
+
+	/**
+	 * 
+	 */
+	public void update() {
+		thermometer.changeTemperature();
+		Integer currentTemperature=thermometer.getTemperature();
+		for(int n=0;n<notifiers.length;n++) {	
+			notifiers[n].propertyChange(new PropertyChangeEvent(this,"CurrentTemperature",null,currentTemperature));
+		}				
+	}
+	
+	public Thermometer getThermometer(){
+		return thermometer;
+	}
+}

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/device/ThermometerDevice.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/gui/SensorFrame.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/gui/SensorFrame.java?rev=606627&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/gui/SensorFrame.java (added)
+++ felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/gui/SensorFrame.java Sun Dec 23 14:23:56 2007
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.sandbox.upnp.thermometer.gui;
+
+import java.awt.BorderLayout;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+import javax.swing.JFrame;
+
+import org.apache.felix.sandbox.upnp.thermometer.device.ThermometerDevice;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+/**
+ * This class represents the main GUI JFrame
+ * <p>TODO refactor this class to support other kind of sensors !
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class SensorFrame extends JFrame implements Runnable {
+
+	private String title;
+	private ThermometerDevice sensorDevice;
+	private SensorPanel sensorPanel;
+	private BundleContext bundleContext;
+
+	/**
+	 * @param bundleContext the bundle context
+	 * @param sensorDevice the sensor device
+	 * @param title the title of the frame
+	 * @param refreshPeriod the period in ms between 2 refreshings
+	 */
+	public SensorFrame(final BundleContext bundleContext,
+			final ThermometerDevice sensorDevice,
+			final String title,
+			final long refreshPeriod,
+			final boolean stopBundleOnClose
+	) {
+		super(title);
+		this.bundleContext=bundleContext;
+		this.title=title;
+		this.refreshPeriod=refreshPeriod;
+		this.sensorDevice=sensorDevice;
+		
+		getContentPane().setLayout(new BorderLayout());
+
+		sensorPanel = new SensorPanel(sensorDevice);
+		getContentPane().add(sensorPanel, BorderLayout.CENTER);
+
+		if(stopBundleOnClose){
+		addWindowListener(new WindowAdapter() {
+			public void windowClosing(WindowEvent e) {
+				try {
+					bundleContext.getBundle().stop();
+				} catch (BundleException ex) {
+					ex.printStackTrace();
+				}
+			}
+		});
+		}
+
+		pack();
+		setVisible(true);
+	}
+
+	public SensorPanel getSensorPanel() {
+		return sensorPanel;
+	}
+
+	private ThermometerDevice getSensorDevice() {
+		return sensorDevice;
+	}
+
+	private Thread thread = null;
+
+	private long refreshPeriod;
+
+	public void run() {
+		Thread thisThread = Thread.currentThread();
+
+		while (thread == thisThread) {
+			getSensorDevice().update();
+			getSensorPanel().repaint();
+			try {
+				Thread.sleep(refreshPeriod);
+			} catch (InterruptedException e) {
+			}
+		}
+	}
+
+	public void start() {
+		thread = new Thread(this);
+		thread.start();
+	}
+
+	public void stop() {
+		thread = null;
+		dispose();
+	}
+
+}
+

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/gui/SensorFrame.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/gui/SensorPanel.java
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/gui/SensorPanel.java?rev=606627&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/gui/SensorPanel.java (added)
+++ felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/gui/SensorPanel.java Sun Dec 23 14:23:56 2007
@@ -0,0 +1,230 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.sandbox.upnp.thermometer.gui;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+
+import javax.imageio.ImageIO;
+import javax.swing.JPanel;
+
+import org.apache.felix.sandbox.upnp.thermometer.device.Thermometer;
+import org.apache.felix.sandbox.upnp.thermometer.device.ThermometerDevice;
+
+
+/**
+ * This class represents the sensor panel
+ * <p>TODO refactor this class to support other kind of sensors !
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class SensorPanel extends JPanel // MouseListener
+{
+
+	final ThermometerDevice sensorDevice;
+
+	public SensorPanel(final ThermometerDevice sensorDevice) {
+		this.sensorDevice = sensorDevice;
+		loadImages();
+		initPanel();
+	}
+
+	private static final String bgPaths[] = new String[] {
+		"/icon/bgcold.jpg",
+		"/icon/bgmedium.jpg",
+		"/icon/bghot.jpg"
+		};
+
+	private BufferedImage[] panelImages;
+
+	private void loadImages() {
+		int len = bgPaths.length;
+		panelImages = new BufferedImage[len];
+		for (int index = 0; index < len; index++) {
+			try {
+				panelImages[index] = ImageIO.read(SensorPanel.class
+						.getResourceAsStream(bgPaths[index]));
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+	}
+
+	private BufferedImage getPanelImage() {
+		return panelImages[0];
+	}
+
+	private BufferedImage getPanelImage(int value, int minValue, int maxValue) {
+		int len = panelImages.length;
+
+		int index = (value - minValue) / ((maxValue - minValue)/len);
+
+		return panelImages[index];
+	}
+
+
+	private void initPanel() {
+		BufferedImage panelmage = getPanelImage();
+		setPreferredSize(new Dimension(panelmage.getWidth(), panelmage.getHeight()));
+	}
+
+	private final static String DEFAULT_FONT_NAME = "Arial"; // "Lucida Console";
+
+	private final static int DEFAULT_VALUE_FONT_SIZE = 60;
+
+	private final static int DEFAULT_SECOND_BLOCK_HEIGHT = 8;
+
+	private final static int DEFAULT_SECOND_BLOCK_FONT_SIZE = 10;
+
+	private Font valueFont = null;
+
+	private Font tempBarFont = null;
+
+	private int maxValue = 0;
+
+	private int minValue = 0;
+
+	private static final int NUMBER_OF_BAR = 60;
+
+	private boolean firstAcquisition = true;
+
+	private Font getFont(Graphics g, int size) {
+		Font font = new Font(DEFAULT_FONT_NAME, Font.PLAIN, size);
+		if (font != null)
+			return font;
+		return g.getFont();
+	}
+
+	private Font getValueFont(Graphics g) {
+		if (valueFont == null)
+			valueFont = getFont(g, DEFAULT_VALUE_FONT_SIZE);
+		return valueFont;
+	}
+
+	private Font getSecondFont(Graphics g) {
+		if (tempBarFont == null)
+			tempBarFont = getFont(g, DEFAULT_SECOND_BLOCK_FONT_SIZE);
+		return tempBarFont;
+	}
+
+
+	private void drawSensorInfo(Graphics g) {
+		Thermometer thermometer = sensorDevice.getThermometer();
+
+		// // Value String ////
+		Integer ivalue = thermometer.getTemperature();
+		int value = ivalue.intValue();
+		String valueStr = thermometer.formatTemperature(ivalue);
+
+		int numberOfBar;
+		if (firstAcquisition) {
+			firstAcquisition = false;
+			minValue = value;
+			maxValue = value;
+		}
+
+		if (minValue > thermometer.getMinTemperature().intValue())
+			minValue = thermometer.getMinTemperature().intValue();
+		if (maxValue < thermometer.getMaxTemperature().intValue())
+			maxValue = thermometer.getMaxTemperature().intValue();
+
+		if (value < minValue)
+			minValue = value;
+		if (value > maxValue)
+			maxValue = value;
+		float delta = maxValue - minValue;
+		float fbar = ((value - minValue) / delta) * NUMBER_OF_BAR;
+		numberOfBar = (new Float(fbar)).intValue();
+
+		int winWidth = getWidth();
+		int winHeight = getHeight();
+
+		g.setColor(Color.BLACK);
+
+		// draw the panel image
+		g.drawImage(getPanelImage(value, minValue, maxValue), 0, 0, null);
+
+		// draw the value
+
+		Font valueFont = getValueFont(g);
+		g.setFont(valueFont);
+
+		FontMetrics valueFontMetric = g.getFontMetrics();
+		Rectangle2D valueStrBounds = valueFontMetric.getStringBounds(valueStr,g);
+
+		int valueStrWidth = (int) valueStrBounds.getWidth();
+		int valueStrHeight = (int) valueStrBounds.getHeight();
+		int valueStrX = (winWidth - valueStrWidth) / 2;
+		int valueStrY = (winHeight + valueStrHeight) / 2;
+		int valueStrOffset = valueStrHeight / 8 / 2;
+		/*
+		 * g.drawString( valueStr, valueStrX, valueStrY);
+		 */
+
+		g.drawString(valueStr,
+				(winWidth - (int) valueStrBounds.getWidth()) / 2, valueStrY /*
+																			 * -
+																			 * valueStrHeight
+																			 */
+						- valueStrOffset);
+
+		Font tempFont = getSecondFont(g);
+		g.setFont(tempFont);
+
+		// draws bars
+		int barBlockSize = valueStrWidth / NUMBER_OF_BAR;
+		int barBlockY = valueStrY + valueStrOffset;
+		for (int n = 0; n < numberOfBar; n++) {
+			int x = valueStrX + (barBlockSize * n);
+			g.fillRect(x, barBlockY, barBlockSize - 1,
+					DEFAULT_SECOND_BLOCK_HEIGHT);
+		}
+		// draws minValue and maxValue
+		{
+			int x = valueStrX + (barBlockSize * 0);
+			g
+					.drawString(thermometer.formatTemperature(minValue), x
+							+ barBlockSize, barBlockY + 2
+							* DEFAULT_SECOND_BLOCK_HEIGHT);
+		}
+		{
+			int x = valueStrX + (barBlockSize * 50);
+			g
+					.drawString(thermometer.formatTemperature(maxValue), x
+							+ barBlockSize, barBlockY + 2
+							* DEFAULT_SECOND_BLOCK_HEIGHT);
+
+		}
+
+	}
+
+	private void clear(Graphics g) {
+		g.setColor(Color.GRAY);
+		g.clearRect(0, 0, getWidth(), getHeight());
+	}
+
+	public void paint(Graphics g) {
+		clear(g);
+		drawSensorInfo(g);
+	}
+}
\ No newline at end of file

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/java/org/apache/felix/sandbox/upnp/thermometer/gui/SensorPanel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/bgcold.jpg
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/bgcold.jpg?rev=606627&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/bgcold.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/bghot.jpg
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/bghot.jpg?rev=606627&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/bghot.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/bgmedium.jpg
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/bgmedium.jpg?rev=606627&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/bgmedium.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/thermometer.jpg
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/thermometer.jpg?rev=606627&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/thermometer.jpg
------------------------------------------------------------------------------
    svn:mime-type = image/jpeg

Added: felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/thermometer.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/thermometer.png?rev=606627&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/thermometer.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/thermometer2.png
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/thermometer2.png?rev=606627&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/donsez/upnp.thermometer/src/main/resources/icon/thermometer2.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: felix/sandbox/donsez/upnp.thermometer/src/site/readme.html
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/site/readme.html?rev=606627&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.thermometer/src/site/readme.html (added)
+++ felix/sandbox/donsez/upnp.thermometer/src/site/readme.html Sun Dec 23 14:23:56 2007
@@ -0,0 +1,95 @@
+<html>
+<head>
+<title>Apache Felix UPnP Thermometer Device</title>
+</head>
+<body>
+
+<!-- Start of Felix Bundle Documentation -->
+<hr width="100%" size="2">
+<h1><i><a name="or.apache.felix.sandbox.upnp.thermometer"></a><font color="#0000aa">Apache Felix UPnP Thermometer Device</font></i></h1>
+
+<p>
+<b>Description</b><br>
+This bundle provides 
+a UPnPDevice providing a simulation of the TemperatureSensor described in "UPnP Forum
+TemperatureSensor:1 Service Template For UPnP Device Architecture V 1.0
+Status: Standardized DCP
+Date: May 13th, 2003"
+available
+<a href="http://www.upnp.org/download/standardizeddcps/hvac/TemperatureSensor%201.0.pdf">here</a>
+</p>
+
+
+<p>
+<b>License</b><br>
+ASL 2.0
+</p>
+
+<p>
+<b>Services</b><br>
+<ul>
+<li><code>org.osgi.service.upnp.UPnPDevice</code></li>
+</ul>
+</p>
+
+<p>
+<b>Properties</b><br>
+None<br>
+</p>
+
+<p><b>Requirements</b><br>
+<ul>
+<li><code>org.osgi.service.upnp; version=1.1.0</code></li>
+</ul>
+</p>
+
+<!-- End of Felix Bundle Documentation -->
+
+<hr width="100%" size="2">
+
+<!-- Start of extra information  -->
+
+<p>
+<b>Build</b><br>
+<ol>
+<li>mvn clean install</li>
+</ol>
+</p>
+
+<p>
+<b>Usage</b><br>
+launch commands in the script available <a href="src/site/script.txt">here</a>.
+</p>
+
+<p>
+<b>Tested platforms</b><br>
+<ul>
+<li>Objectweb Oscar</li>
+<li>Apache Felix</li>
+</ul>
+</p>
+
+<p>
+<b>TODO (contributions are welcome)</b><br>
+<ul>
+<li>configure min/max temperatures, period, function (linear, sinus, ...) for a properties file</li>
+<li>add a org.osgi.service.cm.ManagedService to configure min/max temperatures, period, function (linear, sinus, ...), ...</li>
+<li>Refactor the GUI to support other kind of sensors</li>
+<li>Adding history histogram instead of bars gauge</li>
+<li>Connected it to a real temperature sensor (for instance, OneWire thermocron)</li>
+<li>Insure 2.3. Eventing and Moderation in TemperatureSensor1.0.pdf</li>
+<li>...</li>
+</ul>
+</p>
+
+<p>
+<b>Links</b><br>
+<ul>
+<li>UPnP Forum <a href="http://www.upnp.org/">http://www.upnp.org/</a></li>
+<li>UPnP Forum Standardized Device Control Protocol (DCP) <a href="http://www.upnp.org/standardizeddcps/">http://www.upnp.org/standardizeddcps/</a></li>
+<li>...</li>
+</ul>
+</p>
+
+</body>
+</html>

Propchange: felix/sandbox/donsez/upnp.thermometer/src/site/readme.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/sandbox/donsez/upnp.thermometer/src/site/script.txt
URL: http://svn.apache.org/viewvc/felix/sandbox/donsez/upnp.thermometer/src/site/script.txt?rev=606627&view=auto
==============================================================================
--- felix/sandbox/donsez/upnp.thermometer/src/site/script.txt (added)
+++ felix/sandbox/donsez/upnp.thermometer/src/site/script.txt Sun Dec 23 14:23:56 2007
@@ -0,0 +1,14 @@
+# script to launch upnp.thermometer
+
+
+obr remove-url file:C:\Docume~1\donsez\.m2\repository\repository.xml
+obr add-url file:C:\Docume~1\donsez\.m2\repository\repository.xml
+
+
+obr start "Apache Felix UPnP Base Driver"
+obr start "Apache Felix UPnP Tester"
+
+obr start "Apache Felix UPnP Device Generator Utilities"
+
+obr start "Apache Felix UPnP Thermometer Device"
+

Propchange: felix/sandbox/donsez/upnp.thermometer/src/site/script.txt
------------------------------------------------------------------------------
    svn:eol-style = native