[zb4osgi-changeset] [scm] ZigBee 4 OSGi repository change: r979 - in /projects/zb4osgi/sandbox/giancarlo.riolo: zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ zigbee.basedriver.stub/src/main/java/it/cnr/isti/basedriver/stub/api/impl/ zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/api/impl/ zigbee.cc2480.datalink/ zigbee.cc2480.datalink/src/main/java/it/cnr/isti/cc2480/sniffer/ zigbee.ha.driver/src/main/java/it/cnr/isti/zigbee/ha/driver/core/ zigbee.hc.driver/src/main/java/it/cnr/isti/zigbee/hc/driver/core/ zigbee.network.browser/src/main/java/org/aaloa/zb4osgi/network/browser/ui/ zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/ zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/api/core/ zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/core/ zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/global/read/ zigbee.zcl.library/src/test/java/it/cnr/isti/zigbee/zcl/library/impl/general/

scm-notify at zb4osgi.aaloa.org scm-notify at zb4osgi.aaloa.org
Tue Apr 1 12:16:48 CEST 2014


Author: giancarlo.riolo
Date: Tue Apr  1 12:16:48 2014
New Revision: 979

Log:
Cleaning.

Modified:
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeBasedriverException.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeBasedriverTimeOutException.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeException.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.stub/src/main/java/it/cnr/isti/basedriver/stub/api/impl/StubZigBeeNode.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.stub/src/main/java/it/cnr/isti/basedriver/stub/api/impl/StubZigbeeDeviceBase.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/api/impl/ZigBeeDeviceImpl.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/api/impl/ZigBeeNodeImpl.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.cc2480.datalink/pom.xml
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.cc2480.datalink/src/main/java/it/cnr/isti/cc2480/sniffer/GUIPacketSniffer.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.ha.driver/src/main/java/it/cnr/isti/zigbee/ha/driver/core/ZigBeeHAException.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.hc.driver/src/main/java/it/cnr/isti/zigbee/hc/driver/core/ZigBeeHCException.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.network.browser/src/main/java/org/aaloa/zb4osgi/network/browser/ui/NetworkGraph.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/AttributeActionPanel.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/Command.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/CommandActionPanel.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/HAEventActionPanel.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/LogPanel.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/PropertiesViewer.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/TreeNodeBindPopupMenu.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/TreeViewer.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/api/core/Attribute.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/api/core/ZigBeeClusterException.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/core/AttributeImpl.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/global/read/ReadAttributeStatusImpl.java
    projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/test/java/it/cnr/isti/zigbee/zcl/library/impl/general/GroupsClusterTest.java

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeBasedriverException.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeBasedriverException.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeBasedriverException.java Tue Apr  1 12:16:48 2014
@@ -31,6 +31,10 @@
  */
 public class ZigBeeBasedriverException extends ZigBeeException{
 
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -265935153578763887L;
 	public ZigBeeBasedriverException(String msg) {
 		super(msg);
 	}

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeBasedriverTimeOutException.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeBasedriverTimeOutException.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeBasedriverTimeOutException.java Tue Apr  1 12:16:48 2014
@@ -30,7 +30,11 @@
  */
 public class ZigBeeBasedriverTimeOutException extends ZigBeeBasedriverException {
 
-    public ZigBeeBasedriverTimeOutException() {
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = -760208831735995910L;
+	public ZigBeeBasedriverTimeOutException() {
         super("Timeout expired before receiving any data");
     }
 

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeException.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeException.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeException.java Tue Apr  1 12:16:48 2014
@@ -38,6 +38,11 @@
  */
 public class ZigBeeException extends Exception {
 	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -3335517547711817845L;
+
 	public ZigBeeException(String msg) {
 		super(msg);
 	}

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.stub/src/main/java/it/cnr/isti/basedriver/stub/api/impl/StubZigBeeNode.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.stub/src/main/java/it/cnr/isti/basedriver/stub/api/impl/StubZigBeeNode.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.stub/src/main/java/it/cnr/isti/basedriver/stub/api/impl/StubZigBeeNode.java Tue Apr  1 12:16:48 2014
@@ -41,7 +41,6 @@
 		this.nwk = nwk;
 	}
 
-	@SuppressWarnings("unchecked")
 	public Dictionary getDescription() {
 		return null;
 	}

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.stub/src/main/java/it/cnr/isti/basedriver/stub/api/impl/StubZigbeeDeviceBase.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.stub/src/main/java/it/cnr/isti/basedriver/stub/api/impl/StubZigbeeDeviceBase.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver.stub/src/main/java/it/cnr/isti/basedriver/stub/api/impl/StubZigbeeDeviceBase.java Tue Apr  1 12:16:48 2014
@@ -18,7 +18,7 @@
    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 it.cnr.isti.basedriver.stub.api.impl;
 
 import it.cnr.isti.zigbee.api.Cluster;
@@ -34,9 +34,10 @@
 
 /**
  * @author <a href="mailto:stefano.lenzi at isti.cnr.it">Stefano "Kismet" Lenzi</a>
- * @version $LastChangedRevision$ ($LastChangedDate$)
+ * @version $LastChangedRevision$ ($LastChangedDate: 2014-04-01 12:02:50
+ *          +0200 (mar, 01 apr 2014) $)
  * @since 0.1.0
- *
+ * 
  */
 public abstract class StubZigbeeDeviceBase implements ZigBeeDevice {
 
@@ -46,15 +47,14 @@
 	private final short id;
 	private final int[] inputs;
 	private final int[] outputs;
-	private final int profileId;	
+	private final int profileId;
 	private final ZigBeeNode node;
 	private final Properties properties = new Properties();
 	private final String uuid;
-	
-	protected StubZigbeeDeviceBase(
-			final int deviceId, final int deviceVersion, final int id, final int profileId,
-			final int[] inputs, final int[] outputs, final ZigBeeNode node
-	) {
+
+	protected StubZigbeeDeviceBase(final int deviceId, final int deviceVersion,
+			final int id, final int profileId, final int[] inputs,
+			final int[] outputs, final ZigBeeNode node) {
 		this.deviceId = deviceId;
 		this.deviceVersion = (short) deviceVersion;
 		this.id = (short) id;
@@ -64,35 +64,32 @@
 		this.outputs = outputs;
 		this.profileId = profileId;
 		this.node = node;
-		
-		StringBuffer uuidBuilder = new StringBuffer()
-			.append(profileId).append(":")
-			.append(deviceId).append(":")
-			.append(deviceVersion).append(":")
-			.append(id).append("@")
-			.append(node.getIEEEAddress());		
-		
+
+		StringBuffer uuidBuilder = new StringBuffer().append(profileId)
+				.append(":").append(deviceId).append(":").append(deviceVersion)
+				.append(":").append(id).append("@")
+				.append(node.getIEEEAddress());
+
 		uuid = uuidBuilder.toString();
-		
+
 		properties.put(ZigBeeDevice.PROFILE_ID, Integer.toString(profileId));
 		properties.put(ZigBeeDevice.DEVICE_ID, Integer.toString(deviceId));
 		properties.put(ZigBeeDevice.ENDPOINT, Integer.toString(id));
 		properties.put(ZigBeeDevice.CLUSTERS_INPUT_ID, inputs);
 		properties.put(ZigBeeDevice.CLUSTERS_OUTPUT_ID, outputs);
 		properties.put(ZigBeeNode.IEEE_ADDRESS, node.getIEEEAddress());
-		properties.put(ZigBeeDevice.UUID, uuidBuilder.toString());		
+		properties.put(ZigBeeDevice.UUID, uuidBuilder.toString());
 	}
 
 	public boolean addClusterListener(ClusterListner listner) {
 		return listeners.add(listner);
 	}
-	
+
 	public String getUniqueIdenfier() {
 		return uuid;
-	}	
-	
-	@SuppressWarnings("unchecked")
-	public Dictionary getDescription(){
+	}
+
+	public Dictionary getDescription() {
 		return properties;
 	}
 	public int getDeviceId() {
@@ -119,24 +116,29 @@
 		return profileId;
 	}
 
-	public abstract Cluster stubInvoke(Cluster cluster) throws ZigBeeBasedriverException;
-	
+	public abstract Cluster stubInvoke(Cluster cluster)
+			throws ZigBeeBasedriverException;
+
 	public Cluster invoke(Cluster cluster) throws ZigBeeBasedriverException {
-		if( providesInputCluster( cluster.getId() & 0xFFFF ) == false ){
-			throw new ZigBeeBasedriverException("Cluster not registered as input so i can't be invoked");
+		if (providesInputCluster(cluster.getId() & 0xFFFF) == false) {
+			throw new ZigBeeBasedriverException(
+					"Cluster not registered as input so i can't be invoked");
 		}
 		Cluster c = stubInvoke(cluster);
-		if ( providesInputCluster( c.getId() & 0xFFFF ) == false){
-			throw new ZigBeeBasedriverException("Cluster not registered as input so i can't be invoked");
+		if (providesInputCluster(c.getId() & 0xFFFF) == false) {
+			throw new ZigBeeBasedriverException(
+					"Cluster not registered as input so i can't be invoked");
 		}
 		return c;
 	}
 
-	public abstract void stubSend(Cluster cluster) throws ZigBeeBasedriverException;
+	public abstract void stubSend(Cluster cluster)
+			throws ZigBeeBasedriverException;
 
 	public void send(Cluster cluster) throws ZigBeeBasedriverException {
-		if( providesInputCluster( cluster.getId() & 0xFFFF ) == false ){
-			throw new ZigBeeBasedriverException("Cluster not registered as input so i can't be invoked");
+		if (providesInputCluster(cluster.getId() & 0xFFFF) == false) {
+			throw new ZigBeeBasedriverException(
+					"Cluster not registered as input so i can't be invoked");
 		}
 		stubSend(cluster);
 	}
@@ -153,27 +155,29 @@
 		return listeners.add(listner);
 	}
 
-	public ZigBeeNode getPhysicalNode(){
+	public ZigBeeNode getPhysicalNode() {
 		return node;
 	}
-	
-	public boolean bindTo(ZigBeeDevice device, int clusterId) throws ZigBeeBasedriverException{
-		//TODO it should implemented somehow
+
+	public boolean bindTo(ZigBeeDevice device, int clusterId)
+			throws ZigBeeBasedriverException {
+		// TODO it should implemented somehow
 		return false;
 	}
-	
-	public boolean unbindFrom(ZigBeeDevice device, int clusterId) throws ZigBeeBasedriverException{
-		//TODO it should implemented somehow
+
+	public boolean unbindFrom(ZigBeeDevice device, int clusterId)
+			throws ZigBeeBasedriverException {
+		// TODO it should implemented somehow
 		return false;
 	}
-	
+
 	public boolean bind(int clusterId) throws ZigBeeBasedriverException {
-		//TODO it should implemented somehow
+		// TODO it should implemented somehow
 		return false;
 	}
-	
+
 	public boolean unbind(int arg0) throws ZigBeeBasedriverException {
-		//TODO it should implemented somehow
+		// TODO it should implemented somehow
 		return false;
-	}	
+	}
 }

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/api/impl/ZigBeeDeviceImpl.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/api/impl/ZigBeeDeviceImpl.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/api/impl/ZigBeeDeviceImpl.java Tue Apr  1 12:16:48 2014
@@ -18,7 +18,7 @@
    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 it.cnr.isti.zigbee.basedriver.api.impl;
 
@@ -59,478 +59,534 @@
 import com.itaca.ztool.api.zdo.ZDO_UNBIND_RSP;
 
 /**
- *
+ * 
  * @author <a href="mailto:stefano.lenzi at isti.cnr.it">Stefano "Kismet" Lenzi</a>
  * @author <a href="mailto:francesco.furfari at isti.cnr.it">Francesco Furfari</a>
- * @version $LastChangedRevision$ ($LastChangedDate$)
+ * @version $LastChangedRevision$ ($LastChangedDate: 2013-10-09 16:27:35
+ *          +0200(mer, 09 ott 2013) $)
  * @since 0.1.0
- *
+ * 
  */
-public class ZigBeeDeviceImpl implements ZigBeeDevice, AFMessageListner, AFMessageProducer {
-
-    private static long TIMEOUT;
-    private static final long DEFAULT_TIMEOUT = 5000;
-    private static final Logger logger = LoggerFactory.getLogger(ZigBeeDeviceImpl.class);
-
-    private final int[] inputs;
-    private final int[] outputs;
-    private final short deviceId;
-    private final short profileId;
-    private final byte deviceVersion;
-
-    private ZigBeeNode node = null;
-    private final Properties properties = new Properties();
-    private final SimpleDriver driver;
-    private final byte endPointAddress;
-
-    private final TIntHashSet boundCluster = new TIntHashSet();
-    private final HashSet<ClusterListner> listeners = new HashSet<ClusterListner>();
-    private final HashSet<AFMessageConsumer> consumers = new HashSet<AFMessageConsumer>();
-    private String uuid = null;
-
-    public ZigBeeDeviceImpl(final SimpleDriver drv, final ZigBeeNode n, byte ep) throws ZigBeeBasedriverException{
-        if ( drv == null || n == null) {
-            logger.error( "Creating {} with some nulls parameters {}", new Object[]{ ZigBeeDevice.class, drv, n, ep } );
-            throw new NullPointerException("Cannot create a device with a null SimpleDriver or a null ZigBeeNode");
-        }
-        driver = drv;
-        endPointAddress = ep;
-
-        final ZDO_SIMPLE_DESC_RSP result = doRetrieveSimpleDescription( n );
-        short[] ins = result.getInputClustersList();
-        inputs = new int[ins.length];
-        for (int i = 0; i < ins.length; i++) {
-            inputs[i] = ins[i];
-        }
-        Arrays.sort(inputs);
-        short[] outs = result.getOutputClustersList();
-        outputs = new int[outs.length];
-        for (int i = 0; i < outs.length; i++) {
-            outputs[i] = outs[i];
-        }
-        Arrays.sort(outputs);
-
-        deviceId = result.getDeviceId();
-        profileId = result.getProfileId();
-        deviceVersion = result.getDeviceVersion();
-
-        setPhysicalNode( n );
-
-        properties.put(ZigBeeDevice.PROFILE_ID, Integer.toString((profileId & 0xFFFF)));
-        properties.put(ZigBeeDevice.DEVICE_ID, Integer.toString((deviceId & 0xFFFF)));
-        properties.put(ZigBeeDevice.DEVICE_VERSION, Integer.toString((deviceVersion & 0xFF)));
-        properties.put(ZigBeeDevice.ENDPOINT, Integer.toString((endPointAddress & 0xFF)));
-        properties.put(ZigBeeDevice.CLUSTERS_INPUT_ID, inputs);
-        properties.put(ZigBeeDevice.CLUSTERS_OUTPUT_ID, outputs);
-        properties.put(ZigBeeDevice.ZIGBEE_IMPORT, drv.getClass());
-
-        properties.put(Constants.DEVICE_CATEGORY, new String[]{ZigBeeDevice.DEVICE_CATEGORY});
-
-        try{
-            TIMEOUT = Long.parseLong(Activator.getBundleContext().getProperty("org.aaloa.zb4osgi.zigbee.basedriver.timeout"));
-        }catch(Exception ex){
-            TIMEOUT = DEFAULT_TIMEOUT;
-            logger.debug("Unable to read org.aaloa.zb4osgi.zigbee.basedriver.timeout - setting to default value {}ms", DEFAULT_TIMEOUT);
-        }
-    }
-
-    /**
-     * Generates the UUID from the actual value of the variables
-     */
-    private String generateUUID() {
-        StringBuffer sb_uuid = new StringBuffer()
-            .append(profileId).append(":")
-            .append(deviceId).append(":")
-            .append(deviceVersion).append("@")
-            .append(node.getIEEEAddress()).append(":")
-            .append(endPointAddress);
-        return sb_uuid.toString();
-    }
-
-
-    /**
-     * This method set the ZigBeeNode for the device, it updates the linked variable as need.<br>
-     * It updates the node only if it differs from the old node.
-     *
-     * @param n the new {@link ZigBeeNode} for the device
-     * @return <code>true</code> if and only if the {@link ZigBeeNode} has been updated
-     * @since 0.6.0 - Revision 72
-     *
-     */
-    public boolean setPhysicalNode(ZigBeeNode n) {
-        if ( node == null && n != null || node != n && node.equals( n ) == false ) {
-            node = n;
-            uuid = generateUUID();
-            properties.put(ZigBeeNode.IEEE_ADDRESS, node.getIEEEAddress());
-            properties.put(ZigBeeNode.NWK_ADDRESS, node.getNetworkAddress());
-            properties.put(ZigBeeDevice.UUID, uuid);
-
-            properties.put(Constants.DEVICE_SERIAL, uuid);
-            return true;
-        }else if ( node == n || node != null && node.equals( n ) ){
-            return false;
-        }else if( node != null && !node.getIEEEAddress().equals( n.getIEEEAddress() ) ) {
-            node = n;
-            uuid = generateUUID();
-            properties.put(ZigBeeNode.IEEE_ADDRESS, node.getIEEEAddress());
-            properties.put(ZigBeeDevice.UUID, uuid);
-
-            properties.put(Constants.DEVICE_SERIAL, uuid);
-            return true;
-        } else if ( node != null && !node.getIEEEAddress().equals( n.getIEEEAddress() ) ) {
-            node = n;
-            properties.put(ZigBeeNode.NWK_ADDRESS, node.getNetworkAddress());
-            return true;
-        }
-        return false;
-    }
-
-    private ZDO_SIMPLE_DESC_RSP doRetrieveSimpleDescription(ZigBeeNode n) throws ZigBeeBasedriverException {
-        //TODO Move into SimpleDriver?!?!?
-        final short nwk = (short) n.getNetworkAddress();
-        int i = 1;
-        final String nwkAddress = NetworkAddress.toString(nwk);
-        ZDO_SIMPLE_DESC_RSP result = null;
-
-        while (i <= Activator.getCurrentConfiguration().getMessageRetryCount()) {        	
-            logger.info(
-                    "Inspecting ZigBee EndPoint <{},{}>", nwkAddress, endPointAddress
-            );
-            result = driver.sendZDOSimpleDescriptionRequest(
-                    new ZDO_SIMPLE_DESC_REQ( nwk, endPointAddress )
-            );           
-            if( result == null) {
-                //long waiting = (long) (Math.random() * (double) Activator.getCurrentConfiguration().getMessageRetryDelay())
-                final long waiting = Activator.getCurrentConfiguration().getMessageRetryDelay();
-                ThreadUtils.waitNonPreemptive(waiting);
-                i++;
-                logger.debug(
-                        "Inspecting ZigBee EndPoint <{},{}> failed during it {}-th attempts. " +
-                        "Waiting for {}ms before retrying",
-                        new Object[]{nwkAddress, endPointAddress, i, waiting}
-                );
-
-            } else {
-                break;
-            }
-        }
-
-        if( result == null ){
-            logger.error(
-                    "Unable to receive a ZDO_SIMPLE_DESC_RSP for endpoint {} on node {}",
-                    NetworkAddress.toString(nwk),endPointAddress
-            );
-            throw new ZigBeeBasedriverException("Unable to receive a ZDO_SIMPLE_DESC_RSP from endpoint");
-        }
-
-        return result;
-    }
-
-    @SuppressWarnings("unchecked")
-    public Dictionary getDescription(){
-        return properties;
-    }
-
-    public int getDeviceId() {
-        return deviceId;
-    }
-
-    public short getDeviceVersion() {
-        return deviceVersion;
-    }
-
-    public String getUniqueIdenfier() {
-        return uuid;
-    }
-
-    public short getId() {
-        return endPointAddress;
-    }
-
-    public int[] getInputClusters() {
-        return inputs;
-    }
-
-    public int[] getOutputClusters() {
-        return outputs;
-    }
-
-    public int getProfileId() {
-        return profileId;
-    }
-
-    public ZigBeeNode getPhysicalNode(){
-        return node;
-    }
-
-    public void send(Cluster input) throws ZigBeeBasedriverException {
-        final AFLayer af = AFLayer.getAFLayer(driver);
-        final byte sender = af.getSendingEndpoint(this, input);
-        final byte transaction = af.getNextTransactionId(sender);
-        final byte[] msg = input.getClusterMsg();
-
-        //TODO Create radius and options according to the current configuration
-        AF_DATA_CONFIRM response =  driver.sendAFDataRequest(new AF_DATA_REQUEST(
-                (short) node.getNetworkAddress(),(byte) endPointAddress, sender, input.getId(),
-                transaction, (byte) 0 /*options*/, (byte) 0 /*radius*/, msg
-        ));
-
-        if( response == null){
-            throw new ZigBeeBasedriverException("Unable to send cluster on the ZigBee network due to general error");
-        } else if (response.getStatus() != 0 ) {
-            throw new ZigBeeBasedriverException("Unable to send cluster on the ZigBee network:"+response.getErrorMsg());
-        }
-    }
-
-    public Cluster invoke(Cluster input) throws ZigBeeBasedriverException {
-        final AFLayer af = AFLayer.getAFLayer(driver);
-        final byte sender = af.getSendingEndpoint(this, input);
-        /*
-        //FIX Removed because transaction is always 0 for the response due to a bug of CC2480
-        final byte transaction = af.getNextTransactionId(sender);
-        the next line is a workaround for the problem
-        */
-        final byte transaction = 0;
-        final byte[] msg = input.getClusterMsg();
-
-        m_addAFMessageListener();
-
-        //Registering the waiter before sending the message, so that they will be captured
-        WaitForClusterResponse waiter = new WaitForClusterResponse(
-                this, transaction, input.getId(), TIMEOUT
-        );
-
-        //TODO Create radius and options according to the current configuration
-        AF_DATA_CONFIRM response =  driver.sendAFDataRequest(new AF_DATA_REQUEST(
-                (short) node.getNetworkAddress(),(byte) endPointAddress, sender, input.getId(),
-                transaction, (byte) 0 /*options*/, (byte) 0 /*radius*/, msg
-        ));
-
-        if( response == null){
-            m_removeAFMessageListener();
-            throw new ZigBeeBasedriverException("Unable to send cluster on the ZigBee network due to general error - is the device sleeping?");
-        } else if (response.getStatus() != 0 ) {
-            m_removeAFMessageListener();
-            throw new ZigBeeBasedriverException("Unable to send cluster on the ZigBee network:"+response.getErrorMsg());
-        } else {
-            //FIX Can't be singleton because only a the invoke method can be invoked by multiple-thread
-            //FIX Can't be singleton because the invoke method can be invoked by multiple-thread
-            AF_INCOMING_MSG incoming = waiter.getResponse();
-            m_removeAFMessageListener();
-            if(incoming == null){
-                throw new ZigBeeBasedriverTimeOutException();
-            }
-            Cluster result = new ClusterImpl(incoming.getData(), incoming.getClusterId());
-            return result;
-        }
-    }
-
-    public boolean providesInputCluster(int id) {
-        for (int i = 0; i < inputs.length; i++) {
-            if(inputs[i] == id) return true;
-        }
-        return false;
-    }
-
-    public boolean providesOutputCluster(int id) {
-        for (int i = 0; i < outputs.length; i++) {
-            if(outputs[i] == id) return true;
-        }
-        return false;
-    }
-
-    public boolean bindTo(ZigBeeDevice device, int clusterId) throws ZigBeeBasedriverException {
-        logger.debug("Binding from device {} to {} for cluster {}", new Object[]{
-                getUniqueIdenfier(), device.getUniqueIdenfier(), new Integer(clusterId)
-        });
-
-        /*
-         * //THINK Should you we deny the possibility to have duplicate entry inside the binding table?
-         * The ZigBee specification see page 63, seems to allow duplicate entry inside the binding table.
-         */
-
-        final ZDO_BIND_RSP response = driver.sendZDOBind(new ZDO_BIND_REQ(
-                (short) getPhysicalNode().getNetworkAddress(), (short) clusterId,
-                IEEEAddress.fromColonNotation(getPhysicalNode().getIEEEAddress()), (byte) endPointAddress,
-                IEEEAddress.fromColonNotation(device.getPhysicalNode().getIEEEAddress()), (byte) device.getDeviceId()
-        ));
-        if( response == null || response.Status != 0){
-            logger.debug("ZDO_BIND_REQ failed, unable to bind from device {} to {} for cluster {}", new Object[]{
-                getUniqueIdenfier(), device.getUniqueIdenfier(), new Integer(clusterId)
-            });
-            return false;
-        }
-        return true;
-    }
-
-    public boolean unbindFrom(ZigBeeDevice device, int clusterId) throws ZigBeeBasedriverException {
-        logger.debug("Un-binding from device {} to {} for cluster {}", new Object[]{
-                getUniqueIdenfier(), device.getUniqueIdenfier(), new Integer(clusterId)
-        });
-
-        final ZDO_UNBIND_RSP response = driver.sendZDOUnbind(new ZDO_UNBIND_REQ(
-                (short) getPhysicalNode().getNetworkAddress(), (short) clusterId,
-                IEEEAddress.fromColonNotation(getPhysicalNode().getIEEEAddress()), (byte) endPointAddress,
-                IEEEAddress.fromColonNotation(device.getPhysicalNode().getIEEEAddress()), (byte) device.getDeviceId()
-        ));
-        if( response == null || response.Status != 0){
-            logger.debug("ZDO_BIND_REQ failed, unable to un-bind from device {} to {} for cluster {}", new Object[]{
-                getUniqueIdenfier(), device.getUniqueIdenfier(), new Integer(clusterId)
-            });
-            return false;
-        }
-        return true;
-    }
-
-
-    public boolean bind(int clusterId) throws ZigBeeBasedriverException {
-        logger.debug("Binding from cluster {} of device {}", clusterId, getUniqueIdenfier());
-        if( boundCluster.contains(clusterId) ) {
-            logger.debug("Cluster already bound");
-            return true;
-        }
-
-        byte dstEP = AFLayer.getAFLayer(driver).getSendingEndpoint(this, clusterId);
-        final ZDO_BIND_RSP response = driver.sendZDOBind(new ZDO_BIND_REQ(
-                (short) getPhysicalNode().getNetworkAddress(), (short) clusterId,
-                IEEEAddress.fromColonNotation(getPhysicalNode().getIEEEAddress()), (byte) endPointAddress,
-                driver.getIEEEAddress(), (byte) dstEP
-        ));
-        if( response == null || response.Status != 0){
-            logger.debug("ZDO_BIND_REQ failed, unable to bind");
-            return false;
-        }
-        boundCluster.add(clusterId);
-        return true;
-    }
-
-    public boolean unbind(int clusterId) throws ZigBeeBasedriverException {
-        logger.debug("Unbinding from cluster {} of device {}", clusterId, getUniqueIdenfier());
-        if( ! boundCluster.contains(clusterId) ) {
-            logger.debug("Cluster already unbound");
-            return true;
-        }
-
-        byte dstEP = AFLayer.getAFLayer(driver).getSendingEndpoint(this, clusterId);
-
-        final ZDO_UNBIND_RSP response = driver.sendZDOUnbind(new ZDO_UNBIND_REQ(
-                (short) getPhysicalNode().getNetworkAddress(), (short) clusterId,
-                IEEEAddress.fromColonNotation(getPhysicalNode().getIEEEAddress()), (byte) endPointAddress,
-                driver.getIEEEAddress(), (byte) dstEP
-        ));
-        if( response == null || response.Status != 0){
-            logger.debug("ZDO_BIND_REQ failed, unable to unbind");
-            return false;
-        }
-        boundCluster.remove(clusterId);
-        return true;
-    }
-
-    private void m_addAFMessageListener() {
-        if(listeners.isEmpty() && consumers.size() == 0){
-            logger.debug( "Registered {} as {}", this, AFMessageListner.class.getName() );
-            driver.addAFMessageListner(this);
-        }else{
-            logger.debug( "Skipped to registered {} as {}", this, AFMessageListner.class.getName() );
-            logger.trace(
-                    "Skipped registration due to: listeners.isEmpty() = {}  or consumers.size() = {}",
-                    listeners.isEmpty(), consumers.size()
-            );
-        }
-    }
-
-    private void m_removeAFMessageListener() {
-        if(listeners.isEmpty() && consumers.size() == 0){
-            logger.debug( "Unregistered {} as {}", this, AFMessageListner.class.getName() );
-            driver.removeAFMessageListener(this);
-        }else{
-            logger.debug( "Skipped unregistration of {} as {}", this, AFMessageListner.class.getName() );
-            logger.trace(
-                    "Skipped unregistration due to: listeners.isEmpty() = {}  or consumers.size() = {}",
-                    listeners.isEmpty(), consumers.size()
-            );
-        }
-    }
-
-    public boolean addClusterListener(ClusterListner listener){
-        m_addAFMessageListener();
-
-        return listeners.add(listener);
-    }
-
-    public boolean removeClusterListener(ClusterListner listener){
-        boolean result = listeners.remove(listener);
-        m_removeAFMessageListener();
-        return result;
-    }
-
-    private void notifyClusterListner(Cluster c){
-        ArrayList<ClusterListner> localCopy;
-        synchronized (listeners) {
-            localCopy = new ArrayList<ClusterListner>(listeners);
-        }
-        if(localCopy.size() > 0){
-            logger.debug("Notifying {} ClusterListner of {}", localCopy.size(), c.getClusterMsg());
-
-            for (ClusterListner listner : localCopy) {
-                try{
-                    final ClusterFilter filter = listner.getClusterFilter();
-                    if ( filter == null ) {
-                        listner.handleCluster(this, c);
-                    } else  if ( filter.match(c) == true ) {
-                        listner.handleCluster(this, c);
-                    }
-                }
-                catch( Throwable t ){
-                    logger.error("Error during dispatching of Cluster <{},{}>", c.getId(), c.getClusterMsg());
-                    logger.error("Error caused by:", t);
-                }
-            }
-        }
-    }
-
-    public void notify(AF_INCOMING_MSG msg) {
-        //THINK Do the notification in a separated Thread?
-        //THINK Should consume messages only if they were sent from this device?!?!
-        if ( msg.isError() ) return;
-        logger.debug("AF_INCOMING_MSG arrived for {} message is {}", uuid, msg);
-        ArrayList<AFMessageConsumer> localConsumers = null;
-        synchronized (consumers) {
-            localConsumers = new ArrayList<AFMessageConsumer>(consumers);
-        }
-        logger.debug("Notifying {} AFMessageConsumer", localConsumers.size());
-        for (AFMessageConsumer consumer : localConsumers) {
-            if ( consumer.consume(msg) ) {
-                logger.debug("AF_INCOMING_MSG Consumed by {}", consumer.getClass().getName());
-                return;
-            } else {
-                logger.debug("AF_INCOMING_MSG Ignored by {}", consumer.getClass().getName());
-            }
-        }
-
-        if ( msg.getSrcAddr() != node.getNetworkAddress() ) return;
-        if ( msg.getSrcEndpoint() != endPointAddress ) return;
-        logger.debug("Notifying cluster listener for received by {}", uuid);
-        notifyClusterListner(new ClusterImpl(msg.getData(), msg.getClusterId()));
-    }
-
-    public boolean addAFMessageConsumer(AFMessageConsumer consumer) {
-        synchronized (consumers) {
-            return consumers.add(consumer);
-        }
-    }
-
-    public boolean removeAFMessageConsumer(AFMessageConsumer consumer) {
-        synchronized (consumers) {
-            return consumers.remove(consumer);
-        }
-    }
-
-    /**
-     * @since 0.4.0
-     */
-    public String toString(){
-        return getUniqueIdenfier();
-    }
+public class ZigBeeDeviceImpl
+		implements
+			ZigBeeDevice,
+			AFMessageListner,
+			AFMessageProducer {
+
+	private static long TIMEOUT;
+	private static final long DEFAULT_TIMEOUT = 5000;
+	private static final Logger logger = LoggerFactory
+			.getLogger(ZigBeeDeviceImpl.class);
+
+	private final int[] inputs;
+	private final int[] outputs;
+	private final short deviceId;
+	private final short profileId;
+	private final byte deviceVersion;
+
+	private ZigBeeNode node = null;
+	private final Properties properties = new Properties();
+	private final SimpleDriver driver;
+	private final byte endPointAddress;
+
+	private final TIntHashSet boundCluster = new TIntHashSet();
+	private final HashSet<ClusterListner> listeners = new HashSet<ClusterListner>();
+	private final HashSet<AFMessageConsumer> consumers = new HashSet<AFMessageConsumer>();
+	private String uuid = null;
+
+	public ZigBeeDeviceImpl(final SimpleDriver drv, final ZigBeeNode n, byte ep)
+			throws ZigBeeBasedriverException {
+		if (drv == null || n == null) {
+			logger.error("Creating {} with some nulls parameters {}",
+					new Object[]{ZigBeeDevice.class, drv, n, ep});
+			throw new NullPointerException(
+					"Cannot create a device with a null SimpleDriver or a null ZigBeeNode");
+		}
+		driver = drv;
+		endPointAddress = ep;
+
+		final ZDO_SIMPLE_DESC_RSP result = doRetrieveSimpleDescription(n);
+		short[] ins = result.getInputClustersList();
+		inputs = new int[ins.length];
+		for (int i = 0; i < ins.length; i++) {
+			inputs[i] = ins[i];
+		}
+		Arrays.sort(inputs);
+		short[] outs = result.getOutputClustersList();
+		outputs = new int[outs.length];
+		for (int i = 0; i < outs.length; i++) {
+			outputs[i] = outs[i];
+		}
+		Arrays.sort(outputs);
+
+		deviceId = result.getDeviceId();
+		profileId = result.getProfileId();
+		deviceVersion = result.getDeviceVersion();
+
+		setPhysicalNode(n);
+
+		properties.put(ZigBeeDevice.PROFILE_ID,
+				Integer.toString((profileId & 0xFFFF)));
+		properties.put(ZigBeeDevice.DEVICE_ID,
+				Integer.toString((deviceId & 0xFFFF)));
+		properties.put(ZigBeeDevice.DEVICE_VERSION,
+				Integer.toString((deviceVersion & 0xFF)));
+		properties.put(ZigBeeDevice.ENDPOINT,
+				Integer.toString((endPointAddress & 0xFF)));
+		properties.put(ZigBeeDevice.CLUSTERS_INPUT_ID, inputs);
+		properties.put(ZigBeeDevice.CLUSTERS_OUTPUT_ID, outputs);
+		properties.put(ZigBeeDevice.ZIGBEE_IMPORT, drv.getClass());
+
+		properties.put(Constants.DEVICE_CATEGORY,
+				new String[]{ZigBeeDevice.DEVICE_CATEGORY});
+
+		try {
+			TIMEOUT = Long.parseLong(Activator.getBundleContext().getProperty(
+					"org.aaloa.zb4osgi.zigbee.basedriver.timeout"));
+		} catch (Exception ex) {
+			TIMEOUT = DEFAULT_TIMEOUT;
+			logger.debug(
+					"Unable to read org.aaloa.zb4osgi.zigbee.basedriver.timeout - setting to default value {}ms",
+					DEFAULT_TIMEOUT);
+		}
+	}
+
+	/**
+	 * Generates the UUID from the actual value of the variables
+	 */
+	private String generateUUID() {
+		StringBuffer sb_uuid = new StringBuffer().append(profileId).append(":")
+				.append(deviceId).append(":").append(deviceVersion).append("@")
+				.append(node.getIEEEAddress()).append(":")
+				.append(endPointAddress);
+		return sb_uuid.toString();
+	}
+
+	/**
+	 * This method set the ZigBeeNode for the device, it updates the linked
+	 * variable as need.<br>
+	 * It updates the node only if it differs from the old node.
+	 * 
+	 * @param n
+	 *            the new {@link ZigBeeNode} for the device
+	 * @return <code>true</code> if and only if the {@link ZigBeeNode} has been
+	 *         updated
+	 * @since 0.6.0 - Revision 72
+	 * 
+	 */
+	public boolean setPhysicalNode(ZigBeeNode n) {
+		if (node == null && n != null || node != n && node.equals(n) == false) {
+			node = n;
+			uuid = generateUUID();
+			properties.put(ZigBeeNode.IEEE_ADDRESS, node.getIEEEAddress());
+			properties.put(ZigBeeNode.NWK_ADDRESS, node.getNetworkAddress());
+			properties.put(ZigBeeDevice.UUID, uuid);
+
+			properties.put(Constants.DEVICE_SERIAL, uuid);
+			return true;
+		} else if (node == n || node != null && node.equals(n)) {
+			return false;
+		} else if (node != null
+				&& !node.getIEEEAddress().equals(n.getIEEEAddress())) {
+			node = n;
+			uuid = generateUUID();
+			properties.put(ZigBeeNode.IEEE_ADDRESS, node.getIEEEAddress());
+			properties.put(ZigBeeDevice.UUID, uuid);
+
+			properties.put(Constants.DEVICE_SERIAL, uuid);
+			return true;
+		} else if (node != null
+				&& !node.getIEEEAddress().equals(n.getIEEEAddress())) {
+			node = n;
+			properties.put(ZigBeeNode.NWK_ADDRESS, node.getNetworkAddress());
+			return true;
+		}
+		return false;
+	}
+
+	private ZDO_SIMPLE_DESC_RSP doRetrieveSimpleDescription(ZigBeeNode n)
+			throws ZigBeeBasedriverException {
+		// TODO Move into SimpleDriver?!?!?
+		final short nwk = (short) n.getNetworkAddress();
+		int i = 1;
+		final String nwkAddress = NetworkAddress.toString(nwk);
+		ZDO_SIMPLE_DESC_RSP result = null;
+
+		while (i <= Activator.getCurrentConfiguration().getMessageRetryCount()) {
+			logger.info("Inspecting ZigBee EndPoint <{},{}>", nwkAddress,
+					endPointAddress);
+			result = driver
+					.sendZDOSimpleDescriptionRequest(new ZDO_SIMPLE_DESC_REQ(
+							nwk, endPointAddress));
+			if (result == null) {
+				// long waiting = (long) (Math.random() * (double)
+				// Activator.getCurrentConfiguration().getMessageRetryDelay())
+				final long waiting = Activator.getCurrentConfiguration()
+						.getMessageRetryDelay();
+				ThreadUtils.waitNonPreemptive(waiting);
+				i++;
+				logger.debug(
+						"Inspecting ZigBee EndPoint <{},{}> failed during it {}-th attempts. "
+								+ "Waiting for {}ms before retrying",
+						new Object[]{nwkAddress, endPointAddress, i, waiting});
+
+			} else {
+				break;
+			}
+		}
+
+		if (result == null) {
+			logger.error(
+					"Unable to receive a ZDO_SIMPLE_DESC_RSP for endpoint {} on node {}",
+					NetworkAddress.toString(nwk), endPointAddress);
+			throw new ZigBeeBasedriverException(
+					"Unable to receive a ZDO_SIMPLE_DESC_RSP from endpoint");
+		}
+
+		return result;
+	}
+
+	public Dictionary getDescription() {
+		return properties;
+	}
+
+	public int getDeviceId() {
+		return deviceId;
+	}
+
+	public short getDeviceVersion() {
+		return deviceVersion;
+	}
+
+	public String getUniqueIdenfier() {
+		return uuid;
+	}
+
+	public short getId() {
+		return endPointAddress;
+	}
+
+	public int[] getInputClusters() {
+		return inputs;
+	}
+
+	public int[] getOutputClusters() {
+		return outputs;
+	}
+
+	public int getProfileId() {
+		return profileId;
+	}
+
+	public ZigBeeNode getPhysicalNode() {
+		return node;
+	}
+
+	public void send(Cluster input) throws ZigBeeBasedriverException {
+		final AFLayer af = AFLayer.getAFLayer(driver);
+		final byte sender = af.getSendingEndpoint(this, input);
+		final byte transaction = af.getNextTransactionId(sender);
+		final byte[] msg = input.getClusterMsg();
+
+		// TODO Create radius and options according to the current configuration
+		AF_DATA_CONFIRM response = driver
+				.sendAFDataRequest(new AF_DATA_REQUEST((short) node
+						.getNetworkAddress(), (byte) endPointAddress, sender,
+						input.getId(), transaction, (byte) 0 /* options */,
+						(byte) 0 /* radius */, msg));
+
+		if (response == null) {
+			throw new ZigBeeBasedriverException(
+					"Unable to send cluster on the ZigBee network due to general error");
+		} else if (response.getStatus() != 0) {
+			throw new ZigBeeBasedriverException(
+					"Unable to send cluster on the ZigBee network:"
+							+ response.getErrorMsg());
+		}
+	}
+
+	public Cluster invoke(Cluster input) throws ZigBeeBasedriverException {
+		final AFLayer af = AFLayer.getAFLayer(driver);
+		final byte sender = af.getSendingEndpoint(this, input);
+		/*
+		 * //FIX Removed because transaction is always 0 for the response due to
+		 * a bug of CC2480 final byte transaction =
+		 * af.getNextTransactionId(sender); the next line is a workaround for
+		 * the problem
+		 */
+		final byte transaction = 0;
+		final byte[] msg = input.getClusterMsg();
+
+		m_addAFMessageListener();
+
+		// Registering the waiter before sending the message, so that they will
+		// be captured
+		WaitForClusterResponse waiter = new WaitForClusterResponse(this,
+				transaction, input.getId(), TIMEOUT);
+
+		// TODO Create radius and options according to the current configuration
+		AF_DATA_CONFIRM response = driver
+				.sendAFDataRequest(new AF_DATA_REQUEST((short) node
+						.getNetworkAddress(), (byte) endPointAddress, sender,
+						input.getId(), transaction, (byte) 0 /* options */,
+						(byte) 0 /* radius */, msg));
+
+		if (response == null) {
+			m_removeAFMessageListener();
+			throw new ZigBeeBasedriverException(
+					"Unable to send cluster on the ZigBee network due to general error - is the device sleeping?");
+		} else if (response.getStatus() != 0) {
+			m_removeAFMessageListener();
+			throw new ZigBeeBasedriverException(
+					"Unable to send cluster on the ZigBee network:"
+							+ response.getErrorMsg());
+		} else {
+			// FIX Can't be singleton because only a the invoke method can be
+			// invoked by multiple-thread
+			// FIX Can't be singleton because the invoke method can be invoked
+			// by multiple-thread
+			AF_INCOMING_MSG incoming = waiter.getResponse();
+			m_removeAFMessageListener();
+			if (incoming == null) {
+				throw new ZigBeeBasedriverTimeOutException();
+			}
+			Cluster result = new ClusterImpl(incoming.getData(),
+					incoming.getClusterId());
+			return result;
+		}
+	}
+
+	public boolean providesInputCluster(int id) {
+		for (int i = 0; i < inputs.length; i++) {
+			if (inputs[i] == id)
+				return true;
+		}
+		return false;
+	}
+
+	public boolean providesOutputCluster(int id) {
+		for (int i = 0; i < outputs.length; i++) {
+			if (outputs[i] == id)
+				return true;
+		}
+		return false;
+	}
+
+	public boolean bindTo(ZigBeeDevice device, int clusterId)
+			throws ZigBeeBasedriverException {
+		logger.debug("Binding from device {} to {} for cluster {}",
+				new Object[]{getUniqueIdenfier(), device.getUniqueIdenfier(),
+						new Integer(clusterId)});
+
+		/*
+		 * //THINK Should you we deny the possibility to have duplicate entry
+		 * inside the binding table? The ZigBee specification see page 63, seems
+		 * to allow duplicate entry inside the binding table.
+		 */
+
+		final ZDO_BIND_RSP response = driver.sendZDOBind(new ZDO_BIND_REQ(
+				(short) getPhysicalNode().getNetworkAddress(),
+				(short) clusterId, IEEEAddress
+						.fromColonNotation(getPhysicalNode().getIEEEAddress()),
+				(byte) endPointAddress, IEEEAddress.fromColonNotation(device
+						.getPhysicalNode().getIEEEAddress()), (byte) device
+						.getDeviceId()));
+		if (response == null || response.Status != 0) {
+			logger.debug(
+					"ZDO_BIND_REQ failed, unable to bind from device {} to {} for cluster {}",
+					new Object[]{getUniqueIdenfier(),
+							device.getUniqueIdenfier(), new Integer(clusterId)});
+			return false;
+		}
+		return true;
+	}
+
+	public boolean unbindFrom(ZigBeeDevice device, int clusterId)
+			throws ZigBeeBasedriverException {
+		logger.debug("Un-binding from device {} to {} for cluster {}",
+				new Object[]{getUniqueIdenfier(), device.getUniqueIdenfier(),
+						new Integer(clusterId)});
+
+		final ZDO_UNBIND_RSP response = driver
+				.sendZDOUnbind(new ZDO_UNBIND_REQ((short) getPhysicalNode()
+						.getNetworkAddress(), (short) clusterId, IEEEAddress
+						.fromColonNotation(getPhysicalNode().getIEEEAddress()),
+						(byte) endPointAddress, IEEEAddress
+								.fromColonNotation(device.getPhysicalNode()
+										.getIEEEAddress()), (byte) device
+								.getDeviceId()));
+		if (response == null || response.Status != 0) {
+			logger.debug(
+					"ZDO_BIND_REQ failed, unable to un-bind from device {} to {} for cluster {}",
+					new Object[]{getUniqueIdenfier(),
+							device.getUniqueIdenfier(), new Integer(clusterId)});
+			return false;
+		}
+		return true;
+	}
+
+	public boolean bind(int clusterId) throws ZigBeeBasedriverException {
+		logger.debug("Binding from cluster {} of device {}", clusterId,
+				getUniqueIdenfier());
+		if (boundCluster.contains(clusterId)) {
+			logger.debug("Cluster already bound");
+			return true;
+		}
+
+		byte dstEP = AFLayer.getAFLayer(driver).getSendingEndpoint(this,
+				clusterId);
+		final ZDO_BIND_RSP response = driver.sendZDOBind(new ZDO_BIND_REQ(
+				(short) getPhysicalNode().getNetworkAddress(),
+				(short) clusterId, IEEEAddress
+						.fromColonNotation(getPhysicalNode().getIEEEAddress()),
+				(byte) endPointAddress, driver.getIEEEAddress(), (byte) dstEP));
+		if (response == null || response.Status != 0) {
+			logger.debug("ZDO_BIND_REQ failed, unable to bind");
+			return false;
+		}
+		boundCluster.add(clusterId);
+		return true;
+	}
+
+	public boolean unbind(int clusterId) throws ZigBeeBasedriverException {
+		logger.debug("Unbinding from cluster {} of device {}", clusterId,
+				getUniqueIdenfier());
+		if (!boundCluster.contains(clusterId)) {
+			logger.debug("Cluster already unbound");
+			return true;
+		}
+
+		byte dstEP = AFLayer.getAFLayer(driver).getSendingEndpoint(this,
+				clusterId);
+
+		final ZDO_UNBIND_RSP response = driver
+				.sendZDOUnbind(new ZDO_UNBIND_REQ((short) getPhysicalNode()
+						.getNetworkAddress(), (short) clusterId, IEEEAddress
+						.fromColonNotation(getPhysicalNode().getIEEEAddress()),
+						(byte) endPointAddress, driver.getIEEEAddress(),
+						(byte) dstEP));
+		if (response == null || response.Status != 0) {
+			logger.debug("ZDO_BIND_REQ failed, unable to unbind");
+			return false;
+		}
+		boundCluster.remove(clusterId);
+		return true;
+	}
+
+	private void m_addAFMessageListener() {
+		if (listeners.isEmpty() && consumers.size() == 0) {
+			logger.debug("Registered {} as {}", this,
+					AFMessageListner.class.getName());
+			driver.addAFMessageListner(this);
+		} else {
+			logger.debug("Skipped to registered {} as {}", this,
+					AFMessageListner.class.getName());
+			logger.trace(
+					"Skipped registration due to: listeners.isEmpty() = {}  or consumers.size() = {}",
+					listeners.isEmpty(), consumers.size());
+		}
+	}
+
+	private void m_removeAFMessageListener() {
+		if (listeners.isEmpty() && consumers.size() == 0) {
+			logger.debug("Unregistered {} as {}", this,
+					AFMessageListner.class.getName());
+			driver.removeAFMessageListener(this);
+		} else {
+			logger.debug("Skipped unregistration of {} as {}", this,
+					AFMessageListner.class.getName());
+			logger.trace(
+					"Skipped unregistration due to: listeners.isEmpty() = {}  or consumers.size() = {}",
+					listeners.isEmpty(), consumers.size());
+		}
+	}
+
+	public boolean addClusterListener(ClusterListner listener) {
+		m_addAFMessageListener();
+
+		return listeners.add(listener);
+	}
+
+	public boolean removeClusterListener(ClusterListner listener) {
+		boolean result = listeners.remove(listener);
+		m_removeAFMessageListener();
+		return result;
+	}
+
+	private void notifyClusterListner(Cluster c) {
+		ArrayList<ClusterListner> localCopy;
+		synchronized (listeners) {
+			localCopy = new ArrayList<ClusterListner>(listeners);
+		}
+		if (localCopy.size() > 0) {
+			logger.debug("Notifying {} ClusterListner of {}", localCopy.size(),
+					c.getClusterMsg());
+
+			for (ClusterListner listner : localCopy) {
+				try {
+					final ClusterFilter filter = listner.getClusterFilter();
+					if (filter == null) {
+						listner.handleCluster(this, c);
+					} else if (filter.match(c) == true) {
+						listner.handleCluster(this, c);
+					}
+				} catch (Throwable t) {
+					logger.error("Error during dispatching of Cluster <{},{}>",
+							c.getId(), c.getClusterMsg());
+					logger.error("Error caused by:", t);
+				}
+			}
+		}
+	}
+
+	public void notify(AF_INCOMING_MSG msg) {
+		// THINK Do the notification in a separated Thread?
+		// THINK Should consume messages only if they were sent from this
+		// device?!?!
+		if (msg.isError())
+			return;
+		logger.debug("AF_INCOMING_MSG arrived for {} message is {}", uuid, msg);
+		ArrayList<AFMessageConsumer> localConsumers = null;
+		synchronized (consumers) {
+			localConsumers = new ArrayList<AFMessageConsumer>(consumers);
+		}
+		logger.debug("Notifying {} AFMessageConsumer", localConsumers.size());
+		for (AFMessageConsumer consumer : localConsumers) {
+			if (consumer.consume(msg)) {
+				logger.debug("AF_INCOMING_MSG Consumed by {}", consumer
+						.getClass().getName());
+				return;
+			} else {
+				logger.debug("AF_INCOMING_MSG Ignored by {}", consumer
+						.getClass().getName());
+			}
+		}
+
+		if (msg.getSrcAddr() != node.getNetworkAddress())
+			return;
+		if (msg.getSrcEndpoint() != endPointAddress)
+			return;
+		logger.debug("Notifying cluster listener for received by {}", uuid);
+		notifyClusterListner(new ClusterImpl(msg.getData(), msg.getClusterId()));
+	}
+
+	public boolean addAFMessageConsumer(AFMessageConsumer consumer) {
+		synchronized (consumers) {
+			return consumers.add(consumer);
+		}
+	}
+
+	public boolean removeAFMessageConsumer(AFMessageConsumer consumer) {
+		synchronized (consumers) {
+			return consumers.remove(consumer);
+		}
+	}
+
+	/**
+	 * @since 0.4.0
+	 */
+	public String toString() {
+		return getUniqueIdenfier();
+	}
 
 }

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/api/impl/ZigBeeNodeImpl.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/api/impl/ZigBeeNodeImpl.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/api/impl/ZigBeeNodeImpl.java Tue Apr  1 12:16:48 2014
@@ -18,7 +18,7 @@
    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 it.cnr.isti.zigbee.basedriver.api.impl;
 
@@ -32,98 +32,100 @@
 import com.itaca.ztool.api.ZToolAddress64;
 
 /**
- *
+ * 
  * @author <a href="mailto:stefano.lenzi at isti.cnr.it">Stefano "Kismet" Lenzi</a>
  * @author <a href="mailto:francesco.furfari at isti.cnr.it">Francesco Furfari</a>
- * @version $LastChangedRevision$ ($LastChangedDate$)
+ * @version $LastChangedRevision$ ($LastChangedDate: 2013-10-30 10:52:39
+ *          +0100(mer, 30 ott 2013) $)
  * @since 0.1.0
- *
+ * 
  */
 public class ZigBeeNodeImpl implements ZigBeeNode {
 
-    private int nwkAddress;
-    final private String ieeeAddress;
-    final private Properties description;
+	private int nwkAddress;
+	final private String ieeeAddress;
+	final private Properties description;
 
-    /**
-     *
-     * @param nwk
-     * @param ieee
-     * @param pan
-     * @since 0.6.0 - Revision 67
-     */
-    public ZigBeeNodeImpl(int nwk, String ieee, short pan){
-        this.nwkAddress = nwk;
-        this.ieeeAddress = ieee;
-        IEEEAddress.fromColonNotation( ieee ); //Only for checking the IEEE format
+	/**
+	 * 
+	 * @param nwk
+	 * @param ieee
+	 * @param pan
+	 * @since 0.6.0 - Revision 67
+	 */
+	public ZigBeeNodeImpl(int nwk, String ieee, short pan) {
+		this.nwkAddress = nwk;
+		this.ieeeAddress = ieee;
+		IEEEAddress.fromColonNotation(ieee); // Only for checking the IEEE
+												// format
 
-        description  = new Properties();
-        description.put( ZigBeeNode.IEEE_ADDRESS, ieee );
-        description.put( ZigBeeNode.NWK_ADDRESS, nwk );
-        description.put( ZigBeeNode.PAN_ID, pan );
-    }
+		description = new Properties();
+		description.put(ZigBeeNode.IEEE_ADDRESS, ieee);
+		description.put(ZigBeeNode.NWK_ADDRESS, nwk);
+		description.put(ZigBeeNode.PAN_ID, pan);
+	}
 
-    /**
-     *
-     * @param nwk
-     * @param ieee
-     * @param pan
-     * @since 0.6.0 - Revision 67
-     */
-    public ZigBeeNodeImpl(int nwk, String ieee){
-        this( nwk, ieee, Activator.getCurrentConfiguration().getPanId() );
-    }
+	/**
+	 * 
+	 * @param nwk
+	 * @param ieee
+	 * @param pan
+	 * @since 0.6.0 - Revision 67
+	 */
+	public ZigBeeNodeImpl(int nwk, String ieee) {
+		this(nwk, ieee, Activator.getCurrentConfiguration().getPanId());
+	}
 
+	public ZigBeeNodeImpl(int nwk, ZToolAddress64 ieee) {
+		this.ieeeAddress = IEEEAddress.toString(ieee.getLong());
+		description = new Properties();
+		description.put(ZigBeeNode.IEEE_ADDRESS, ieee);
+		description.put(ZigBeeNode.PAN_ID, Activator.getCurrentConfiguration()
+				.getPanId());
+		setNetworkAddress(nwk);
+	}
 
-    public ZigBeeNodeImpl(int nwk, ZToolAddress64 ieee){
-        this.ieeeAddress = IEEEAddress.toString(ieee.getLong());
-        description  = new Properties();
-        description.put( ZigBeeNode.IEEE_ADDRESS, ieee );
-        description.put( ZigBeeNode.PAN_ID, Activator.getCurrentConfiguration().getPanId() );
-        setNetworkAddress( nwk );
-    }
+	public Dictionary getDescription() {
+		return description;
+	}
 
+	public String getIEEEAddress() {
+		return ieeeAddress;
+	}
 
-    @SuppressWarnings("unchecked")
-    public Dictionary getDescription() {
-        return description;
-    }
+	/**
+	 * 
+	 * @param nwk
+	 *            the new network address
+	 * 
+	 * @since 0.6.0 - Revision 74
+	 */
+	public void setNetworkAddress(int nwk) {
+		nwkAddress = nwk;
+		description.put(ZigBeeNode.NWK_ADDRESS, nwk);
+	}
 
-    public String getIEEEAddress() {
-        return ieeeAddress;
-    }
+	public int getNetworkAddress() {
+		return nwkAddress;
+	}
 
-    /**
-     *
-     * @param nwk the new network address
-     *
-     * @since 0.6.0 - Revision 74
-     */
-    public void setNetworkAddress(int nwk) {
-        nwkAddress = nwk;
-        description.put( ZigBeeNode.NWK_ADDRESS, nwk );
-    }
+	public String toString() {
+		return nwkAddress + "(" + ieeeAddress + ") ";
+	}
 
-    public int getNetworkAddress() {
-        return nwkAddress;
-    }
+	public boolean equals(Object obj) {
+		if (obj == this) {
+			return true;
+		} else if (obj instanceof ZigBeeNode) {
+			ZigBeeNode node = (ZigBeeNode) obj;
+			return nwkAddress == node.getNetworkAddress()
+					&& ieeeAddress.equals(node.getIEEEAddress());
+		} else {
+			return false;
+		}
+	}
 
-    public String toString() {
-        return nwkAddress + "(" + ieeeAddress + ") ";
-    }
-
-    public boolean equals(Object obj) {
-        if ( obj == this ) {
-            return true;
-        }else if ( obj instanceof ZigBeeNode ){
-            ZigBeeNode node = (ZigBeeNode) obj;
-            return nwkAddress == node.getNetworkAddress() && ieeeAddress.equals( node.getIEEEAddress() );
-        }else{
-            return false;
-        }
-    }
-
-    public int hashCode() {
-        return ieeeAddress.hashCode();
-    }
+	public int hashCode() {
+		return ieeeAddress.hashCode();
+	}
 }

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.cc2480.datalink/pom.xml
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.cc2480.datalink/pom.xml (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.cc2480.datalink/pom.xml Tue Apr  1 12:16:48 2014
@@ -108,8 +108,7 @@
 		<dependency>
 			<groupId>org.aaloa.zb4osgi</groupId>
 			<artifactId>org.aaloa.zb4osgi.zigbee.common</artifactId>
-			<version>0.5.0</version>
-		</dependency>
+			</dependency>
 		<dependency>
 			<groupId>org.aaloa.zb4osgi.bundle</groupId>
 			<artifactId>org.aaloa.zb4osgi.bundle.rxtx</artifactId>

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.cc2480.datalink/src/main/java/it/cnr/isti/cc2480/sniffer/GUIPacketSniffer.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.cc2480.datalink/src/main/java/it/cnr/isti/cc2480/sniffer/GUIPacketSniffer.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.cc2480.datalink/src/main/java/it/cnr/isti/cc2480/sniffer/GUIPacketSniffer.java Tue Apr  1 12:16:48 2014
@@ -53,7 +53,12 @@
     extends javax.swing.JFrame
     implements SnifferInterface {
 
-    private static final Logger logger = LoggerFactory.getLogger( GUIPacketSniffer.class );
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 6574161785640230306L;
+
+	private static final Logger logger = LoggerFactory.getLogger( GUIPacketSniffer.class );
 
     private static final SimplePacketFormat PACKET_FORMATTER = new SimplePacketFormat();
 
@@ -108,7 +113,12 @@
     private class SnifferTableModel
         extends AbstractTableModel {
 
-        private final Object[] columns = new Object[] {
+        /**
+		 * 
+		 */
+		private static final long serialVersionUID = 6459033421363510648L;
+
+		private final Object[] columns = new Object[] {
             new String[] {
                 "Time", "Direction", "Type", "Packet", "Payload"
             }, new Class[] {
@@ -134,7 +144,7 @@
             return rows.get( row )[col];
         }
 
-        public Class getColumnClass( int col ) {
+        public Class<?> getColumnClass( int col ) {
             return ( (Class[]) columns[1] ).getClass();
         }
 

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.ha.driver/src/main/java/it/cnr/isti/zigbee/ha/driver/core/ZigBeeHAException.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.ha.driver/src/main/java/it/cnr/isti/zigbee/ha/driver/core/ZigBeeHAException.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.ha.driver/src/main/java/it/cnr/isti/zigbee/ha/driver/core/ZigBeeHAException.java Tue Apr  1 12:16:48 2014
@@ -35,6 +35,11 @@
  */
 public class ZigBeeHAException extends ZigBeeException {
 
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1406265825475519905L;
+
 	public ZigBeeHAException(String msg) {
 		super(msg);
 	}

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.hc.driver/src/main/java/it/cnr/isti/zigbee/hc/driver/core/ZigBeeHCException.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.hc.driver/src/main/java/it/cnr/isti/zigbee/hc/driver/core/ZigBeeHCException.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.hc.driver/src/main/java/it/cnr/isti/zigbee/hc/driver/core/ZigBeeHCException.java Tue Apr  1 12:16:48 2014
@@ -35,7 +35,12 @@
  */
 public class ZigBeeHCException extends ZigBeeException {
 
-    public ZigBeeHCException(String msg) {
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 7109711006584414246L;
+
+	public ZigBeeHCException(String msg) {
         super(msg);
     }
 

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.network.browser/src/main/java/org/aaloa/zb4osgi/network/browser/ui/NetworkGraph.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.network.browser/src/main/java/org/aaloa/zb4osgi/network/browser/ui/NetworkGraph.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.network.browser/src/main/java/org/aaloa/zb4osgi/network/browser/ui/NetworkGraph.java Tue Apr  1 12:16:48 2014
@@ -54,7 +54,11 @@
 
 public class NetworkGraph extends JFrame {
     
-    private SparseMultigraph<ZigBeeVertex, ZigBeeEdge> graph = new SparseMultigraph<ZigBeeVertex, ZigBeeEdge>();
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = -6626710419721479862L;
+	private SparseMultigraph<ZigBeeVertex, ZigBeeEdge> graph = new SparseMultigraph<ZigBeeVertex, ZigBeeEdge>();
     private VisualizationViewer<ZigBeeVertex,ZigBeeEdge> viewer = null;
 	private JToolBar jToolBar;
 	private JPanel statusBar;

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/AttributeActionPanel.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/AttributeActionPanel.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/AttributeActionPanel.java Tue Apr  1 12:16:48 2014
@@ -61,6 +61,14 @@
  *
  */
 public class AttributeActionPanel extends JPanel {
+	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1187197175017233743L;
+	/**
+	 * 
+	 */
 	
 	private final static Logger loggerDemo = LoggerFactory.getLogger("demo");
 	Attribute attribute;
@@ -124,6 +132,11 @@
 		}
 		JButton doAction = new JButton("Write");
 		doAction.addActionListener(new AbstractAction(){
+			/**
+			 * 
+			 */
+			private static final long serialVersionUID = 1L;
+
 			public void actionPerformed(ActionEvent e) {
 				Object newValue = null;
 				try {
@@ -160,6 +173,11 @@
 		}
 		JButton doAction = new JButton("Read");
 		doAction.addActionListener(new AbstractAction(){
+			/**
+			 * 
+			 */
+			private static final long serialVersionUID = 1L;
+
 			public void actionPerformed(ActionEvent e) {
 				try {
 					Object result = attribute.getValue();
@@ -187,7 +205,11 @@
 		JButton doAction = new JButton("Subscribe");
 		doAction.addActionListener(new AbstractAction(){
 		    
-		    public void doSubscribe(ReportListener listener) {
+		    /**
+			 * 
+			 */
+			private static final long serialVersionUID = 1L;
+			public void doSubscribe(ReportListener listener) {
 		        
                 final Subscription sub = attribute.getSubscription();
                 try{

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/Command.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/Command.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/Command.java Tue Apr  1 12:16:48 2014
@@ -36,6 +36,10 @@
 public class Command {
 	
 	public class CommandParsingException extends IllegalArgumentException {
+		/**
+		 * 
+		 */
+		private static final long serialVersionUID = 1396230279824610647L;
 		public String value;
 		public int index;
 		

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/CommandActionPanel.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/CommandActionPanel.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/CommandActionPanel.java Tue Apr  1 12:16:48 2014
@@ -68,6 +68,11 @@
  */
 public class CommandActionPanel extends JPanel {
 	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
 	final static Logger logger = LoggerFactory.getLogger(CommandActionPanel.class);
 	
 	Command action;
@@ -95,6 +100,11 @@
 		buttonPanel = new JPanel();
 		JButton doAction = new JButton("Execute Specific Cluster Command");
 		doAction.addActionListener(new AbstractAction(){
+			/**
+			 * 
+			 */
+			private static final long serialVersionUID = 1L;
+
 			public void actionPerformed(ActionEvent e) {
 
 				String[] params = null;
@@ -149,14 +159,14 @@
 					result.setText("Invokation successed without error, but without return values");
 					return;
 				}
-				final Class clz = returned.getClass();
+				final Class<? extends Object> clz = returned.getClass();
 				if ( clz.isPrimitive() || clz == String.class ){
 					result.setText(returned.toString());
 				} else if ( returned instanceof Response){
 					Response r = (Response) returned;
 					String str = r.toString();
 					try {
-						final Class clzToString = clz.getMethod("toString").getDeclaringClass();
+						final Class<?> clzToString = clz.getMethod("toString").getDeclaringClass();
 						if ( clzToString == Object.class || clzToString == ResponseImpl.class) {
 							//TODO A default response to String in a ResponseBase class or Response.stringValueOf(Response) should be provided
 							str = "The response object do not provide any String representation of itself\n";
@@ -226,6 +236,10 @@
 
 //thanks to Thomas Wagner 12/10/2005
 class ArgumentsModel extends  AbstractTableModel {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
 	int size = 0;
 	private MyTable table;	
     String[] types = new String[]{""};
@@ -271,11 +285,15 @@
 // thanks to Thomas Wagner 12/10/2005
 class MyTable extends JTable { 
 
-	private Hashtable cellEditors;
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	private Hashtable<Integer, TableCellEditor> cellEditors;
 	
 	public MyTable(TableModel dm) {
 		super(dm);
-		cellEditors = new Hashtable();
+		cellEditors = new Hashtable<Integer, TableCellEditor>();
 	}
 
 	public void setMyCellEditor(TableCellEditor editor,int col){
@@ -299,7 +317,11 @@
 
 class SliderEditor extends AbstractCellEditor implements TableCellEditor
 {
-    JPanel editor;
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	JPanel editor;
     JTextField text;
     JSlider slider;
     public SliderEditor(int min, int max, int value){

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/HAEventActionPanel.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/HAEventActionPanel.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/HAEventActionPanel.java Tue Apr  1 12:16:48 2014
@@ -45,6 +45,10 @@
  */
 public class HAEventActionPanel extends JPanel {
 	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 572969514672982031L;
 	HAEvent event;
 	JPanel buttonPanel;
 	

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/LogPanel.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/LogPanel.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/LogPanel.java Tue Apr  1 12:16:48 2014
@@ -38,7 +38,11 @@
  *
  */
 public class LogPanel extends JPanel {
-    private static JTextArea logArea = new JTextArea(4,50);
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 9042188374562242146L;
+	private static JTextArea logArea = new JTextArea(4,50);
     private static JPanel statusBar = new JPanel(new BorderLayout());
     private static JLabel statusText = new JLabel();
     

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/PropertiesViewer.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/PropertiesViewer.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/PropertiesViewer.java Tue Apr  1 12:16:48 2014
@@ -54,7 +54,11 @@
  */
 public class PropertiesViewer extends JPanel {
 
-    AttributeActionPanel attributePanel;
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = -3181670269001968195L;
+	AttributeActionPanel attributePanel;
     CommandActionPanel commandPanel;
     HAEventActionPanel eventPanel;
 	DataModel dataModel;
@@ -185,6 +189,10 @@
 }
 
 class DataModel extends  AbstractTableModel {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 2094592918201988677L;
 	int size = 0;
 	String[] names = new String[]{""};
 	String[] values = new String[]{""};
@@ -215,7 +223,12 @@
 
 class LinkCellRenderer extends DefaultTableCellRenderer
 {
-    public LinkCellRenderer(){
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 123271155225735344L;
+
+	public LinkCellRenderer(){
         super();
     }
     

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/TreeNodeBindPopupMenu.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/TreeNodeBindPopupMenu.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/TreeNodeBindPopupMenu.java Tue Apr  1 12:16:48 2014
@@ -55,7 +55,11 @@
     extends JPopupMenu
     implements PopupMenuListener {
 
-    JTree tree;
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = -3175875257203883428L;
+	JTree tree;
     final JMenu bind;
     final Action action;
     HADeviceTreeNode lastNode = null;
@@ -68,7 +72,12 @@
         add( bind );
         action = new AbstractAction(){
 
-            public void actionPerformed( ActionEvent e ) {
+            /**
+			 * 
+			 */
+			private static final long serialVersionUID = 7784951706085415028L;
+
+			public void actionPerformed( ActionEvent e ) {
                 final JMenuItem item = (JMenuItem) e.getSource();
                 final String uuidTo = item.getText();
                 final Cluster binding = (Cluster) lastNode.getUserObject();

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/TreeViewer.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/TreeViewer.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/TreeViewer.java Tue Apr  1 12:16:48 2014
@@ -70,6 +70,10 @@
 public class TreeViewer extends JPanel 	implements DeviceNodeListener 
 {
 	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -359691042081435209L;
 	private HADeviceTreeNode root;
 	private DefaultTreeModel treeModel;
 	private JTree tree;
@@ -123,8 +127,7 @@
 		root.add(new HADeviceTreeNode(node, root));
 		treeModel.nodeStructureChanged(root);
 	}
-	
-	@SuppressWarnings("unchecked")
+		
 	public void rootDeviceUnplugged(String udn){
 		Enumeration list = root.children();
 		LogPanel.log("Unregistering udn = '" + udn + "'"); 

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/api/core/Attribute.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/api/core/Attribute.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/api/core/Attribute.java Tue Apr  1 12:16:48 2014
@@ -18,68 +18,74 @@
    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 it.cnr.isti.zigbee.zcl.library.api.core;
 
-
 /**
- * This class represent an Attribute as defined by the <i>ZigBee Cluster Library</i> specification
- *
+ * This class represent an Attribute as defined by the <i>ZigBee Cluster
+ * Library</i> specification
+ * 
  * @author <a href="mailto:stefano.lenzi at isti.cnr.it">Stefano "Kismet" Lenzi</a>
  * @author <a href="mailto:francesco.furfari at isti.cnr.it">Francesco Furfari</a>
- * @version $LastChangedRevision$ ($LastChangedDate$)
+ * @version $LastChangedRevision$ ($LastChangedDate: 2014-04-01 12:02:50
+ *          +0200 (mar, 01 apr 2014) $)
  * @since 0.1.0
- *
+ * 
  */
 public interface Attribute {
 
-    /**
-     * @return the <b>16-bit</b> identifier of the attribute as specified by the cluster
-     */
-    public int getId();
+	/**
+	 * @return the <b>16-bit</b> identifier of the attribute as specified by the
+	 *         cluster
+	 */
+	public int getId();
 
-    /**
-     * @return the {@link String} associated to this attribute as specified by the cluster
-     */
-    public String getName();
+	/**
+	 * @return the {@link String} associated to this attribute as specified by
+	 *         the cluster
+	 */
+	public String getName();
 
-    /**
-     * @return the java {@link Class} used to represent the attribute value
-     */
-    @SuppressWarnings("unchecked")
-    public Class<?> getType();
+	/**
+	 * @return the java {@link Class} used to represent the attribute value
+	 */
 
-    /**
-     * @return the {@link ZigBeeType} that describes the attribute type
-     */
-    public ZigBeeType getZigBeeType();
+	public Class<?> getType();
 
-    /**
-     * @return the true if and only if the attribute can be written
-     */
-    public boolean isWritable();
+	/**
+	 * @return the {@link ZigBeeType} that describes the attribute type
+	 */
+	public ZigBeeType getZigBeeType();
 
-    /**
-     * @return the true if and only if the attribute support the {@link Subscription}
-     */
-    public boolean isReportable();
+	/**
+	 * @return the true if and only if the attribute can be written
+	 */
+	public boolean isWritable();
 
-    /**
-     * @return the current value of the attribute
-     */
-    public Object getValue() throws ZigBeeClusterException;
+	/**
+	 * @return the true if and only if the attribute support the
+	 *         {@link Subscription}
+	 */
+	public boolean isReportable();
 
-    /**
-     * If the attribute can be written ({@link #isWritable()} this method set its value.
-     *
-     * @param o the value of to set the attribute to
-     */
-    public void setValue(Object o) throws ZigBeeClusterException;
+	/**
+	 * @return the current value of the attribute
+	 */
+	public Object getValue() throws ZigBeeClusterException;
 
-    /**
-     * @return the {@link Subscription}
-     */
-    public Subscription getSubscription();
+	/**
+	 * If the attribute can be written ({@link #isWritable()} this method set
+	 * its value.
+	 * 
+	 * @param o
+	 *            the value of to set the attribute to
+	 */
+	public void setValue(Object o) throws ZigBeeClusterException;
+
+	/**
+	 * @return the {@link Subscription}
+	 */
+	public Subscription getSubscription();
 
 }

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/api/core/ZigBeeClusterException.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/api/core/ZigBeeClusterException.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/api/core/ZigBeeClusterException.java Tue Apr  1 12:16:48 2014
@@ -33,6 +33,10 @@
  */
 public class ZigBeeClusterException extends ZigBeeException {
 
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 7959927532738218313L;
 	private Response response;
 
 	public ZigBeeClusterException(String msg) {

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/core/AttributeImpl.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/core/AttributeImpl.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/core/AttributeImpl.java Tue Apr  1 12:16:48 2014
@@ -18,7 +18,7 @@
    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 it.cnr.isti.zigbee.zcl.library.impl.core;
 
@@ -55,21 +55,24 @@
  * @author <a href="mailto:stefano.lenzi at isti.cnr.it">Stefano "Kismet" Lenzi</a>
  * @author <a href="mailto:francesco.furfari at isti.cnr.it">Francesco Furfari</a>
  * @author <a href="mailto:alessandro.giari at isti.cnr.it">Alessandro Giari</a>
- * @version $LastChangedRevision$ ($LastChangedDate$)
+ * @version $LastChangedRevision$ ($LastChangedDate: 2014-04-01 12:02:50
+ *          +0200 (mar, 01 apr 2014) $)
  * @since 0.1.0
- *
+ * 
  */
-public class AttributeImpl implements Attribute{
-
-	private static final Logger logger = LoggerFactory.getLogger(AttributeImpl.class);
-	
+public class AttributeImpl implements Attribute {
+
+	private static final Logger logger = LoggerFactory
+			.getLogger(AttributeImpl.class);
+
 	final private Object LazyInstantiation = new Object();
 	private ZigBeeDevice zbDevice;
 	private ZCLCluster zclCluster;
 	private Subscription subscription;
 	private AttributeDescriptor descriptor;
 
-	public AttributeImpl(ZigBeeDevice zbDevice, ZCLCluster zclCluster, AttributeDescriptor descriptor) {
+	public AttributeImpl(ZigBeeDevice zbDevice, ZCLCluster zclCluster,
+			AttributeDescriptor descriptor) {
 		this.zbDevice = zbDevice;
 		this.zclCluster = zclCluster;
 		this.descriptor = descriptor;
@@ -78,133 +81,144 @@
 	public int getId() {
 		return descriptor.getId();
 	}
-	
+
 	public String getName() {
 		return descriptor.getName();
-	}	
-
-	@SuppressWarnings("unchecked")
+	}
+
 	public Class<?> getType() {
 		return descriptor.getType();
 	}
-	
-	public ZigBeeType getZigBeeType(){
+
+	public ZigBeeType getZigBeeType() {
 		return descriptor.getZigBeeType();
 	}
 
 	public boolean isReportable() {
 		return descriptor.isReportable();
 	}
-	
+
 	public boolean isWritable() {
 		return descriptor.isWritable();
 	}
-	
+
 	public void setValue(Object o) throws ZigBeeClusterException {
-		if( isWritable() == false ) {
-			throw new ZigBeeClusterException(
-					"Trying to set the attribute "+getName()+"("+getId()+") that is Read Only"
-			);
+		if (isWritable() == false) {
+			throw new ZigBeeClusterException("Trying to set the attribute "
+					+ getName() + "(" + getId() + ") that is Read Only");
 		}
 		doClusterWideWrite(o);
 	}
+
 	public Object getValue() throws ZigBeeClusterException {
 		return doClusterWideRead();
 	}
-	
+
 	public Subscription getSubscription() {
-		if ( isReportable() == false ) 
+		if (isReportable() == false)
 			return null;
-		
+
 		synchronized (LazyInstantiation) {
-			if (subscription == null){
-				if ( getZigBeeType().isAnalog() ) {
-					subscription = new AnalogSubscriptionImpl(zbDevice, zclCluster, this);
+			if (subscription == null) {
+				if (getZigBeeType().isAnalog()) {
+					subscription = new AnalogSubscriptionImpl(zbDevice,
+							zclCluster, this);
 				} else {
-					subscription = new SubscriptionImpl(zbDevice, zclCluster, this);
+					subscription = new SubscriptionImpl(zbDevice, zclCluster,
+							this);
 				}
 			}
 		}
 		return subscription;
 	}
-	
+
 	private Object doClusterWideRead() throws ZigBeeClusterException {
-		
-		ReadAttributeCommand readAttrCom = new ReadAttributeCommand(new int[]{getId()});
-		ZCLFrame frame = new ZCLFrame(readAttrCom,zclCluster.isDefaultResponseEnabled());
+
+		ReadAttributeCommand readAttrCom = new ReadAttributeCommand(
+				new int[] { getId() });
+		ZCLFrame frame = new ZCLFrame(readAttrCom,
+				zclCluster.isDefaultResponseEnabled());
 		ClusterImpl input;
-		input = new ClusterImpl(zclCluster.getId(),frame);
+		input = new ClusterImpl(zclCluster.getId(), frame);
 		Cluster cluster = null;
 		try {
 			cluster = zbDevice.invoke(input);
-			Response response = new ResponseImpl(cluster,zclCluster.getId());
-			if ( response.getZCLHeader().getTransactionId() != frame.getHeader().getTransactionId() ){
+			Response response = new ResponseImpl(cluster, zclCluster.getId());
+			if (response.getZCLHeader().getTransactionId() != frame.getHeader()
+					.getTransactionId()) {
 				logger.error(
-						"Received mismatching transaction response, " +
-						"we have to change heuristic for dispatching. Received {} while sent {}", 
-						response.getZCLHeader().getTransactionId(),frame.getHeader().getTransactionId()
-				);
+						"Received mismatching transaction response, "
+								+ "we have to change heuristic for dispatching. Received {} while sent {}",
+						response.getZCLHeader().getTransactionId(), frame
+								.getHeader().getTransactionId());
 				return null;
 			}
-			AttributeDescriptor[] requestedAttributes = new AttributeDescriptor[]{descriptor};
-			
-			switch ( response.getZCLHeader().getCommandId() ) {
-				case ReadAttributesResponse.ID:
-					ReadAttributesResponse readResponse = new ReadAttributesResponseImpl(response,requestedAttributes);
-					ReadAttributesStatus attributeStatus = readResponse.getReadAttributeStatus()[0];
-					if( attributeStatus.getStatus() == Status.SUCCESS.id ) {
-						return attributeStatus.getAttributeData();
-					} else {
-						Status state = Status.getStatus(attributeStatus.getStatus());
-						throw new ZigBeeClusterException(
-								"Read Attribute of "+getId()+" failed." +
-								"Due to "+state+" that means "+state.description 
-						);
-					}
-				case DefaultResponse.ID:
-					//Means that the read command is not supported
-					final DefaultResponse result = new DefaultResponseImpl(response);
-					Status state = result.getStatus();
-					throw new ZigBeeClusterException(
-						"Read Attribute of "+getId()+" failed because command is not supported." 
-								+ "Due to "+state+" that means "+state.description 
-								+ " Follows the ZCLFrame recieved "+ ResponseImpl.toString( response )
-					);
-					
-				default:
-					throw new ZigBeeClusterException(
-						"Read Attribute of "+getId()+" failed due to: Unsupported answer: " + response
-							+ " Follows the ZCLFrame recieved "+ ResponseImpl.toString( response )
-					);
+			AttributeDescriptor[] requestedAttributes = new AttributeDescriptor[] { descriptor };
+
+			switch (response.getZCLHeader().getCommandId()) {
+			case ReadAttributesResponse.ID:
+				ReadAttributesResponse readResponse = new ReadAttributesResponseImpl(
+						response, requestedAttributes);
+				ReadAttributesStatus attributeStatus = readResponse
+						.getReadAttributeStatus()[0];
+				if (attributeStatus.getStatus() == Status.SUCCESS.id) {
+					return attributeStatus.getAttributeData();
+				} else {
+					Status state = Status
+							.getStatus(attributeStatus.getStatus());
+					throw new ZigBeeClusterException("Read Attribute of "
+							+ getId() + " failed." + "Due to " + state
+							+ " that means " + state.description);
+				}
+			case DefaultResponse.ID:
+				// Means that the read command is not supported
+				final DefaultResponse result = new DefaultResponseImpl(response);
+				Status state = result.getStatus();
+				throw new ZigBeeClusterException("Read Attribute of " + getId()
+						+ " failed because command is not supported."
+						+ "Due to " + state + " that means "
+						+ state.description + " Follows the ZCLFrame recieved "
+						+ ResponseImpl.toString(response));
+
+			default:
+				throw new ZigBeeClusterException("Read Attribute of " + getId()
+						+ " failed due to: Unsupported answer: " + response
+						+ " Follows the ZCLFrame recieved "
+						+ ResponseImpl.toString(response));
 			}
 		} catch (ZigBeeBasedriverException e) {
 			throw new ZigBeeClusterException(e);
 		}
 	}
-	
-	private void doClusterWideWrite(Object o) throws ZigBeeClusterException  {
-		WriteAttributeRecord writeAttrComRec = new WriteAttributeRecordImpl(this,o);
-		WriteAttributeCommand writeAttrCom = new WriteAttributeCommand(new WriteAttributeRecord[]{writeAttrComRec});
-		ZCLFrame frame = new ZCLFrame(writeAttrCom,zclCluster.isDefaultResponseEnabled());
-		ClusterImpl input = new ClusterImpl(zclCluster.getId(),frame);
+
+	private void doClusterWideWrite(Object o) throws ZigBeeClusterException {
+		WriteAttributeRecord writeAttrComRec = new WriteAttributeRecordImpl(
+				this, o);
+		WriteAttributeCommand writeAttrCom = new WriteAttributeCommand(
+				new WriteAttributeRecord[] { writeAttrComRec });
+		ZCLFrame frame = new ZCLFrame(writeAttrCom,
+				zclCluster.isDefaultResponseEnabled());
+		ClusterImpl input = new ClusterImpl(zclCluster.getId(), frame);
 		try {
 			Cluster cluster = zbDevice.invoke(input);
-			Response response = new ResponseImpl(cluster,zclCluster.getId());
-			AttributeDescriptor[] requestedAttributes = new AttributeDescriptor[]{descriptor};
-			WriteAttributesResponse writeResposne = new WriteAttributesResponseImpl(response,requestedAttributes);
-			WriteAttributesStatus attributeStatus = writeResposne.getWriteAttributesStatus()[0];
-			if( attributeStatus.getStatus() != Status.SUCCESS.id ){
+			Response response = new ResponseImpl(cluster, zclCluster.getId());
+			AttributeDescriptor[] requestedAttributes = new AttributeDescriptor[] { descriptor };
+			WriteAttributesResponse writeResposne = new WriteAttributesResponseImpl(
+					response, requestedAttributes);
+			WriteAttributesStatus attributeStatus = writeResposne
+					.getWriteAttributesStatus()[0];
+			if (attributeStatus.getStatus() != Status.SUCCESS.id) {
 				Status state = Status.getStatus(attributeStatus.getStatus());
-				throw new ZigBeeClusterException(
-						"Unable to write value " + o.toString() 
-						+ ". It failed with error "+state+"("+state.id+"):"+state.description
-						+ ". Follows the ZCLFrame recieved "+ ResponseImpl.toString( writeResposne )
-				);
-			}
-		}  catch (ZigBeeBasedriverException e) {
+				throw new ZigBeeClusterException("Unable to write value "
+						+ o.toString() + ". It failed with error " + state
+						+ "(" + state.id + "):" + state.description
+						+ ". Follows the ZCLFrame recieved "
+						+ ResponseImpl.toString(writeResposne));
+			}
+		} catch (ZigBeeBasedriverException e) {
 			throw new ZigBeeClusterException(e);
 		}
-		return ;
+		return;
 	}
 
 	public Object getDefaultValue() throws ZigBeeClusterException {

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/global/read/ReadAttributeStatusImpl.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/global/read/ReadAttributeStatusImpl.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/global/read/ReadAttributeStatusImpl.java Tue Apr  1 12:16:48 2014
@@ -18,7 +18,7 @@
    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 it.cnr.isti.zigbee.zcl.library.impl.global.read;
 
@@ -27,40 +27,42 @@
 import it.cnr.isti.zigbee.zcl.library.api.core.ZigBeeType;
 import it.cnr.isti.zigbee.zcl.library.api.global.ReadAttributesStatus;
 import it.cnr.isti.zigbee.zcl.library.impl.attribute.AttributeDescriptor;
+
 /**
  * 
  * @author <a href="mailto:stefano.lenzi at isti.cnr.it">Stefano "Kismet" Lenzi</a>
  * @author <a href="mailto:francesco.furfari at isti.cnr.it">Francesco Furfari</a>
- * @version $LastChangedRevision$ ($LastChangedDate$)
- *
+ * @version $LastChangedRevision$ ($LastChangedDate: 2013-08-06 18:00:05
+ *          +0200(mar, 06 ago 2013) $)
+ * 
  */
 public class ReadAttributeStatusImpl implements ReadAttributesStatus {
 
 	private byte status;
-	
+
 	private int attributeId;
-	
+
 	private byte dataType;
-	
-	@SuppressWarnings("unchecked")
-	private Class clazz;
-	
+
+	private Class<?> clazz;
+
 	private Object data;
 
-	public ReadAttributeStatusImpl(
-			AttributeDescriptor descriptor, ZBDeserializer deserializer) {
+	public ReadAttributeStatusImpl(AttributeDescriptor descriptor,
+			ZBDeserializer deserializer) {
 
-		attributeId = deserializer.read_short();			
+		attributeId = deserializer.read_short();
 		status = deserializer.read_byte();
 		if (Status.getStatus(status).equals(Status.SUCCESS)) {
 			dataType = deserializer.read_byte();
-			final ZigBeeType type = ZigBeeType.getType(dataType);  
+			final ZigBeeType type = ZigBeeType.getType(dataType);
 			clazz = type.getJavaClass();
 			data = deserializer.readZigBeeType(type);
 		}
-		
+
 		// TODO Attribute Check
-		// indeed the order could be different, so we should receive all the list
+		// indeed the order could be different, so we should receive all the
+		// list
 		// and in any case we could also avoid to throw an Exception
 
 	}
@@ -81,8 +83,7 @@
 		return status;
 	}
 
-	@SuppressWarnings("unchecked")
-	public Class getDataClass(){
+	public Class<?> getDataClass() {
 		return clazz;
 	}
 }

Modified: projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/test/java/it/cnr/isti/zigbee/zcl/library/impl/general/GroupsClusterTest.java
==============================================================================
--- projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/test/java/it/cnr/isti/zigbee/zcl/library/impl/general/GroupsClusterTest.java (original)
+++ projects/zb4osgi/sandbox/giancarlo.riolo/zigbee.zcl.library/src/test/java/it/cnr/isti/zigbee/zcl/library/impl/general/GroupsClusterTest.java Tue Apr  1 12:16:48 2014
@@ -19,9 +19,8 @@
    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 it.cnr.isti.zigbee.zcl.library.impl.general;
-
 
 import static org.easymock.EasyMock.anyObject;
 import static org.easymock.EasyMock.createMock;
@@ -43,64 +42,71 @@
 import org.junit.Test;
 
 /**
- *
+ * 
  * @author <a href="mailto:stefano.lenzi at isti.cnr.it">Stefano "Kismet" Lenzi</a>
- * @version $LastChangedRevision$ ($LastChangedDate$)
+ * @version $LastChangedRevision$ ($LastChangedDate: 2014-04-01 12:02:50
+ *          +0200 (mar, 01 apr 2014) $)
  * @since 0.8.0
- *
+ * 
  */
 public class GroupsClusterTest {
 
-    private ZigBeeDevice createMockDevice(final byte[] response) throws ZigBeeBasedriverException {
-        ZigBeeDevice mock = createMock(ZigBeeDevice.class);
+	private ZigBeeDevice createMockDevice(final byte[] response)
+			throws ZigBeeBasedriverException {
+		ZigBeeDevice mock = createMock(ZigBeeDevice.class);
 
-        expect(mock.invoke( (Cluster) anyObject()))
-            .andReturn( new RawClusterImpl( Groups.ID, response ) );
-        replay( mock );
-        return mock;
-    }
+		expect(mock.invoke((Cluster) anyObject())).andReturn(
+				new RawClusterImpl(Groups.ID, response));
+		replay(mock);
+		return mock;
+	}
 
-    @Test
-    public void testAddGroup() {
-        GroupsCluster cluster = null;
-        ZigBeeDevice device = null;
-        try {
-            device = createMockDevice( new byte[]{0x09, 0x18, Groups.ADD_GROUP_ID, 0x00, 0x00, (byte) 0xf0 } );
-            cluster = new GroupsCluster(device);
-        } catch (ZigBeeBasedriverException ignored) {
-        }
-        try {
-            AddGroupResponse response = (AddGroupResponse) cluster.addGroup(0xFF00,"hello world!");
-            assertEquals( Status.SUCCESS, response.getStatus() );
-            assertEquals( 0xf000, response.getGroupId() );
-        } catch (ZigBeeClusterException ex) {
-            fail("Unexpected exception "+ex);
-            ex.printStackTrace();
-        }
-    }
+	@Test
+	public void testAddGroup() {
+		GroupsCluster cluster = null;
+		ZigBeeDevice device = null;
+		try {
+			device = createMockDevice(new byte[] { 0x09, 0x18,
+					Groups.ADD_GROUP_ID, 0x00, 0x00, (byte) 0xf0 });
+			cluster = new GroupsCluster(device);
+		} catch (ZigBeeBasedriverException ignored) {
+		}
+		try {
+			AddGroupResponse response = (AddGroupResponse) cluster.addGroup(
+					0xFF00, "hello world!");
+			assertEquals(Status.SUCCESS, response.getStatus());
+			assertEquals(0xf000, response.getGroupId());
+		} catch (ZigBeeClusterException ex) {
+			fail("Unexpected exception " + ex);
+			ex.printStackTrace();
+		}
+	}
 
-    @Test
-    public void testGetGroupMembership() {
-        GroupsCluster cluster = null;
-        ZigBeeDevice device = null;
-        try {
-            device = device = createMockDevice(
-                new byte[]{0x09, 0x18, Groups.GET_GROUP_MEMBERSHIP_ID,
-                        0x10, 0x04, //Capacity, Group Count
-                        0x10, 0x00, 0x00, 0x02, (byte) 0xF0, 0x00, 0x00, (byte) 0xFF //Group List
-                }
-            );;
-            cluster = new GroupsCluster(device);
-        } catch (ZigBeeBasedriverException ignored) {
-        }
-        try {
-            GetGroupMembershipResponse response = (GetGroupMembershipResponse) cluster.getGroupMembership(new int[]{0x03, 0x0A});
-            assertEquals( 0x10, response.getCapacity() );
-            assertEquals( 0x04, response.getGroupList().length );
-            assertArrayEquals( new int[]{ 0x0010, 0x0200, 0x00F0, 0xFF00 } , response.getGroupList() );
-        } catch (ZigBeeClusterException ex) {
-            fail("Unexpected exception "+ex);
-            ex.printStackTrace();
-        }
-    }
+	@Test
+	public void testGetGroupMembership() {
+		GroupsCluster cluster = null;
+		ZigBeeDevice device = null;
+		try {
+			device = createMockDevice(new byte[] { 0x09, 0x18,
+					Groups.GET_GROUP_MEMBERSHIP_ID, 0x10,
+					0x04, // Capacity, Group Count
+					0x10, 0x00, 0x00, 0x02, (byte) 0xF0, 0x00, 0x00,
+					(byte) 0xFF // Group List
+			});
+			;
+			cluster = new GroupsCluster(device);
+		} catch (ZigBeeBasedriverException ignored) {
+		}
+		try {
+			GetGroupMembershipResponse response = (GetGroupMembershipResponse) cluster
+					.getGroupMembership(new int[] { 0x03, 0x0A });
+			assertEquals(0x10, response.getCapacity());
+			assertEquals(0x04, response.getGroupList().length);
+			assertArrayEquals(new int[] { 0x0010, 0x0200, 0x00F0, 0xFF00 },
+					response.getGroupList());
+		} catch (ZigBeeClusterException ex) {
+			fail("Unexpected exception " + ex);
+			ex.printStackTrace();
+		}
+	}
 }




More information about the Commit mailing list