[zb4osgi-changeset] [scm] ZigBee 4 OSGi repository change: r1076 - in /projects/zb4osgi/trunk: zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/api/impl/ZigBeeDeviceImpl.java zigbee.dongle.api/src/main/java/it/cnr/isti/zigbee/dongle/api/AFMessageListner.java
scm-notify at zb4osgi.aaloa.org
scm-notify at zb4osgi.aaloa.org
Mon Nov 3 10:18:36 CET 2014
Author: stefano.lenzi
Date: Mon Nov 3 10:18:34 2014
New Revision: 1076
Log:
Consuming messages only when network address and endpoint match ( refs #264 )
Fixed typo in AFMessageListner javadoc
Modified:
projects/zb4osgi/trunk/zigbee.basedriver/src/main/java/it/cnr/isti/zigbee/basedriver/api/impl/ZigBeeDeviceImpl.java
projects/zb4osgi/trunk/zigbee.dongle.api/src/main/java/it/cnr/isti/zigbee/dongle/api/AFMessageListner.java
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 Mon Nov 3 10:18:34 2014
@@ -547,10 +547,19 @@
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())
+ if (msg.isError()) {
+ logger.debug("AF_INCOMING_MSG arrived but it is an error packet so IGNORING it");
+ return;
+ }
+ if ( ( msg.getSrcAddr() & 0xFFFF ) != node.getNetworkAddress()) {
+ logger.debug("AF_INCOMING_MSG arrived but NETWORK ADDRESS does not match so IGNORING it");
return;
+ }
+ if (msg.getSrcEndpoint() != endPointAddress) {
+ logger.debug("AF_INCOMING_MSG arrived ENDPOINT does not match so IGNORING it");
+ return;
+ }
+
logger.debug("AF_INCOMING_MSG arrived for {} message is {}", uuid, msg);
ArrayList<AFMessageConsumer> localConsumers = null;
synchronized (consumers) {
@@ -559,19 +568,13 @@
logger.debug("Notifying {} AFMessageConsumer", localConsumers.size());
for (AFMessageConsumer consumer : localConsumers) {
if (consumer.consume(msg)) {
- logger.debug("AF_INCOMING_MSG Consumed by {}", consumer
- .getClass().getName());
+ logger.debug("AF_INCOMING_MSG Consumed by {}", consumer.getClass().getName());
return;
} else {
- logger.debug("AF_INCOMING_MSG Ignored by {}", consumer
- .getClass().getName());
+ logger.debug("AF_INCOMING_MSG Ignored by {}", consumer.getClass().getName());
}
}
- if ( ( msg.getSrcAddr() & 0xFFFF ) != node.getNetworkAddress())
- return;
- if (msg.getSrcEndpoint() != endPointAddress)
- return;
logger.debug("Notifying cluster listener for received by {}", uuid);
notifyClusterListner(new ClusterImpl(msg.getData(), msg.getClusterId()));
}
Modified: projects/zb4osgi/trunk/zigbee.dongle.api/src/main/java/it/cnr/isti/zigbee/dongle/api/AFMessageListner.java
==============================================================================
--- projects/zb4osgi/trunk/zigbee.dongle.api/src/main/java/it/cnr/isti/zigbee/dongle/api/AFMessageListner.java (original)
+++ projects/zb4osgi/trunk/zigbee.dongle.api/src/main/java/it/cnr/isti/zigbee/dongle/api/AFMessageListner.java Mon Nov 3 10:18:34 2014
@@ -26,7 +26,7 @@
import com.itaca.ztool.api.af.AF_INCOMING_MSG;
/**
- * This class reppresent the callback invoked by the {@link SimpleDriver} whenever a message<br>
+ * This class represent the callback invoked by the {@link SimpleDriver} whenever a message<br>
* that belongs to the <i>Application Framework</i> arrives from the <i>ZigBee Network</i>
*
* @author <a href="mailto:stefano.lenzi at isti.cnr.it">Stefano "Kismet" Lenzi - ISTI-CNR
More information about the Commit
mailing list