[zb4osgi-changeset] [scm] ZigBee 4 OSGi repository change: r619 - in /projects/zb4osgi/trunk: zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/api/impl/ zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/
scm-notify at zb4osgi.aaloa.org
scm-notify at zb4osgi.aaloa.org
Thu Jan 31 20:12:38 CET 2013
Author: stefano.lenzi
Date: Thu Jan 31 20:12:38 2013
New Revision: 619
Log:
Added a TimeoutException and using it for better output message ( fixes #127 )
Added:
projects/zb4osgi/trunk/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeBasedriverTimeOutException.java (with props)
Modified:
projects/zb4osgi/trunk/zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/api/impl/ZigBeeDeviceImpl.java
projects/zb4osgi/trunk/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/CommandActionPanel.java
Added: projects/zb4osgi/trunk/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeBasedriverTimeOutException.java
==============================================================================
--- projects/zb4osgi/trunk/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeBasedriverTimeOutException.java (added)
+++ projects/zb4osgi/trunk/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeBasedriverTimeOutException.java Thu Jan 31 20:12:38 2013
@@ -1,0 +1,44 @@
+/*
+ Copyright 2008-2010 CNR-ISTI, http://isti.cnr.it
+ Institute of Information Science and Technologies
+ of the Italian National Research Council
+
+
+ See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package it.cnr.isti.zigbee.api;
+
+/**
+ *
+ * @author <a href="mailto:stefano.lenzi at isti.cnr.it">Stefano "Kismet" Lenzi</a>
+ * @version $LastChangedRevision$ ($LastChangedDate$)
+ * @since 0.6.0
+ */
+public class ZigBeeBasedriverTimeOutException extends ZigBeeBasedriverException {
+
+ public ZigBeeBasedriverTimeOutException() {
+ super("Timeout expired before receiving any data");
+ }
+
+ public ZigBeeBasedriverTimeOutException(String msg) {
+ super(msg);
+ }
+ public ZigBeeBasedriverTimeOutException(Throwable ex) {
+ super(ex);
+ }
+
+}
Propchange: projects/zb4osgi/trunk/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeBasedriverTimeOutException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: projects/zb4osgi/trunk/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeBasedriverTimeOutException.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: projects/zb4osgi/trunk/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeBasedriverTimeOutException.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: projects/zb4osgi/trunk/zigbee.basedriver.api/src/main/java/it/cnr/isti/zigbee/api/ZigBeeBasedriverTimeOutException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: projects/zb4osgi/trunk/zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/api/impl/ZigBeeDeviceImpl.java
==============================================================================
--- projects/zb4osgi/trunk/zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/api/impl/ZigBeeDeviceImpl.java (original)
+++ projects/zb4osgi/trunk/zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/api/impl/ZigBeeDeviceImpl.java Thu Jan 31 20:12:38 2013
@@ -28,6 +28,7 @@
import it.cnr.isti.zigbee.api.ClusterFilter;
import it.cnr.isti.zigbee.api.ClusterListner;
import it.cnr.isti.zigbee.api.ZigBeeBasedriverException;
+import it.cnr.isti.zigbee.api.ZigBeeBasedriverTimeOutException;
import it.cnr.isti.zigbee.api.ZigBeeDevice;
import it.cnr.isti.zigbee.api.ZigBeeNode;
import it.cnr.isti.zigbee.basedriver.Activator;
@@ -288,8 +289,7 @@
AF_INCOMING_MSG incoming = waiter.getResponse();
m_removeAFMessageListener();
if(incoming == null){
- //TODO Add a timeout exception
- throw new ZigBeeBasedriverException("Timeout expired before receiving an answer");
+ throw new ZigBeeBasedriverTimeOutException();
}
Cluster result = new ClusterImpl(incoming.getData(), incoming.getClusterId());
return result;
Modified: projects/zb4osgi/trunk/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/CommandActionPanel.java
==============================================================================
--- projects/zb4osgi/trunk/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/CommandActionPanel.java (original)
+++ projects/zb4osgi/trunk/zigbee.tester/src/main/java/org/persona/zigbee/tester/gui/CommandActionPanel.java Thu Jan 31 20:12:38 2013
@@ -22,6 +22,8 @@
*/
package org.persona.zigbee.tester.gui;
+import it.cnr.isti.zigbee.api.ZigBeeBasedriverTimeOutException;
+import it.cnr.isti.zigbee.ha.driver.core.ZigBeeHAException;
import it.cnr.isti.zigbee.zcl.library.api.core.Response;
import it.cnr.isti.zigbee.zcl.library.impl.core.ResponseImpl;
@@ -120,10 +122,19 @@
} catch (InvocationTargetException ex){
ByteArrayOutputStream bof = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(bof);
- ex.getTargetException().printStackTrace(ps);
+ if( ex.getTargetException() instanceof ZigBeeHAException) {
+ ZigBeeHAException haex = (ZigBeeHAException) ex.getTargetException();
+ if ( haex.getCause() instanceof ZigBeeBasedriverTimeOutException ) {
+ ps.println("Command cluster sent correctly but no answer from the device");
+ ps.println("More dettails on the issue:");
+ ex.getTargetException().printStackTrace(ps);
+ }
+ } else {
+ ex.getTargetException().printStackTrace(ps);
+ }
ps.flush();
ps.close();
- printReport(params,bof.toString());
+ printReport(params,bof.toString());
} catch (Exception ex){
ByteArrayOutputStream bof = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(bof);
More information about the Commit
mailing list