[zb4osgi-changeset] [scm] ZigBee 4 OSGi repository change: r615 - in /projects/zb4osgi/trunk/zigbee.zcl.library: pom.xml src/main/java/it/cnr/isti/zigbee/zcl/library/impl/core/ResponseImpl.java

scm-notify at zb4osgi.aaloa.org scm-notify at zb4osgi.aaloa.org
Wed Jan 30 17:38:14 CET 2013


Author: stefano.lenzi
Date: Wed Jan 30 17:38:14 2013
New Revision: 615

Log:
Added support for nice output of the ZCL Frame


Modified:
    projects/zb4osgi/trunk/zigbee.zcl.library/pom.xml
    projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/core/ResponseImpl.java

Modified: projects/zb4osgi/trunk/zigbee.zcl.library/pom.xml
==============================================================================
--- projects/zb4osgi/trunk/zigbee.zcl.library/pom.xml (original)
+++ projects/zb4osgi/trunk/zigbee.zcl.library/pom.xml Wed Jan 30 17:38:14 2013
@@ -91,6 +91,10 @@
 	<dependencies>
 		<dependency>
 			<groupId>org.aaloa.zb4osgi</groupId>
+			<artifactId>org.aaloa.zb4osgi.zigbee.cc2480.datalink</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.aaloa.zb4osgi</groupId>
 			<artifactId>org.aaloa.zb4osgi.zigbee.basedriver.api</artifactId>
 		</dependency>
 		<dependency>
@@ -148,6 +152,7 @@
 						</Private-Package>
 						<Import-Package>
 							it.cnr.isti.primitvetypes.util,
+							com.itaca.ztool.util,
 							it.cnr.isti.zigbee.api,
 							org.slf4j; provider=paxlogging
 						</Import-Package>

Modified: projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/core/ResponseImpl.java
==============================================================================
--- projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/core/ResponseImpl.java (original)
+++ projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/core/ResponseImpl.java Wed Jan 30 17:38:14 2013
@@ -21,6 +21,8 @@
 */
 
 package it.cnr.isti.zigbee.zcl.library.impl.core;
+
+import com.itaca.ztool.util.ByteUtils;
 
 import it.cnr.isti.zigbee.api.Cluster;
 import it.cnr.isti.zigbee.zcl.library.api.core.Response;
@@ -85,6 +87,17 @@
 		return payload;
 	}
 
+	public static String toString(Response r){
+		return 
+		"[ ZCL Header: " + ByteUtils.toBase16( r.getZCLHeader().toByte() ) 
+				+ ", ZCL Payload: " + ByteUtils.toBase16(r.getPayload()) 
+		+ "]";
+	}
+	
+	public String toString(){
+		return toString(this);
+	}
+
 	public static void checkSpecificCommandFrame(Response response, byte expectedCommandId) throws ZigBeeClusterException{
 		byte commandId = response.getHeaderCommandId();
 		if (commandId != expectedCommandId) {
@@ -96,8 +109,10 @@
 						,response);
 			}
 			throw new ZigBeeClusterException(
-					"Expected SpecificCommandFrame ("+ expectedCommandId +") but Received:" +commandId
-					,response);
+				"Expected SpecificCommandFrame (" + expectedCommandId +") but Received:" 
+					+ commandId + " ZCLFrame was " +response,
+				response
+			);
 		}
 
 	}




More information about the Commit mailing list