]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Correctly handle both snooped and received packets.
authorscipio <scipio>
Thu, 8 Feb 2007 00:56:35 +0000 (00:56 +0000)
committerscipio <scipio>
Thu, 8 Feb 2007 00:56:35 +0000 (00:56 +0000)
apps/BaseStationCC2420/BaseStationC.nc
apps/BaseStationCC2420/BaseStationP.nc

index 2411a37ce0c3d8c31a83d61bedb07f1f5a7b323c..e0727e8f7b3993cbd078bbf36ac19c269c301a95 100644 (file)
@@ -82,7 +82,7 @@ implementation {
   
   BaseStationP.RadioSend -> Radio;
   BaseStationP.RadioReceive -> Radio.Receive;
-  BaseStationP.RadioReceive -> Radio.Snoop;
+  BaseStationP.RadioSnoop -> Radio.Snoop;
   BaseStationP.RadioPacket -> Radio;
   BaseStationP.RadioAMPacket -> Radio;
   
index 7fad5ea43e86d8b1562899a68b3cb8c8e86c9b7c..5e261a286010562ab1dcbd26178793f16017fdaf 100644 (file)
@@ -59,6 +59,7 @@ module BaseStationP {
     
     interface AMSend as RadioSend[am_id_t id];
     interface Receive as RadioReceive[am_id_t id];
+    interface Receive as RadioSnoop[am_id_t id];
     interface Packet as RadioPacket;
     interface AMPacket as RadioAMPacket;
 
@@ -128,10 +129,22 @@ implementation
   event void SerialControl.stopDone(error_t error) {}
   event void RadioControl.stopDone(error_t error) {}
 
+  message_t* receive(message_t* msg, void* payload, uint8_t len);
+  
   uint8_t count = 0;
-  event message_t *RadioReceive.receive[am_id_t id](message_t *msg,
+  event message_tRadioReceive.receive[am_id_t id](message_t *msg,
                                                    void *payload,
                                                    uint8_t len) {
+    return receive(msg, payload, len);
+  }
+
+  event message_t* RadioSnoop.receive[am_id_t id](message_t* msg,
+                                                 void* payload,
+                                                 uint8_t len) {
+    return receive(msg, payload, len);
+  }
+
+  message_t* receive(message_t* msg, void* payload, uint8_t len) {
     message_t *ret = msg;
 
     atomic {