]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Correctly snoop packets.
authorscipio <scipio>
Thu, 8 Feb 2007 01:00:25 +0000 (01:00 +0000)
committerscipio <scipio>
Thu, 8 Feb 2007 01:00:25 +0000 (01:00 +0000)
apps/BaseStation/BaseStationC.nc
apps/BaseStation/BaseStationP.nc

index 016a8b1e2629d25d981dc07cc6b0bc7acf987d5a..e0727e8f7b3993cbd078bbf36ac19c269c301a95 100644 (file)
@@ -82,6 +82,7 @@ implementation {
   
   BaseStationP.RadioSend -> Radio;
   BaseStationP.RadioReceive -> Radio.Receive;
+  BaseStationP.RadioSnoop -> Radio.Snoop;
   BaseStationP.RadioPacket -> Radio;
   BaseStationP.RadioAMPacket -> Radio;
   
index ff1c2f564277e0da3cfa18fa16cb99634237d111..a918a6db87437fd9ecb53e5d3383ffb54da3fd14 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;
 
@@ -129,9 +130,22 @@ implementation
   event void RadioControl.stopDone(error_t error) {}
 
   uint8_t count = 0;
+
+  message_t* receive(message_t* msg, void* payload, uint8_t len);
+  
+  event message_t *RadioSnoop.receive[am_id_t id](message_t *msg,
+                                                   void *payload,
+                                                   uint8_t len) {
+    return receive(msg, payload, len);
+  }
+  
   event message_t *RadioReceive.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 {