Thanks for your reply Djemma. Any help will be great.
I have tried on Telosb on a Testbed as well as also in Avroa simulator. I
can receive packets but no snooping. I have tried different network
typologies too. Here is a simple code that I have used:
------------------------------------------------------------------------------------------
configuration TestSnoopAppC {}
implementation {
components MainC, TestSnoopC as App;
components new AMSenderC(6);
components new AMReceiverC(6);
components new AMSnooperC(6) as Snoop;
components new TimerMilliC();
components PrintfC, SerialStartC;
components ActiveMessageC;
App.Boot -> MainC.Boot;
App.Snoop -> Snoop;
App.Receive -> AMReceiverC;
App.AMSend -> AMSenderC;
App.AMControl -> ActiveMessageC;
App.MilliTimer -> TimerMilliC;
App.Packet -> AMSenderC;
}
-----------------------------------------------------------------------------------------
#include "Timer.h"
#include "printf.h"
module TestSnoopC @safe() {
uses {
interface Boot;
interface Receive;
interface Receive as Snoop;
interface AMSend;
interface Timer<TMilli> as MilliTimer;
interface SplitControl as AMControl;
interface Packet;
}
}
implementation {
typedef nx_struct snoop_data {
nx_uint16_t counter;
} snoop_t;
message_t packet;
bool locked;
uint16_t counter = 0;
event void Boot.booted() {
call AMControl.start();
}
event void AMControl.startDone(error_t err) {
if (err == SUCCESS) {
call MilliTimer.startPeriodic(1000);
}
else {
call AMControl.start();
}
}
event void AMControl.stopDone(error_t err) {
// do nothing
}
event void MilliTimer.fired() {
uint8_t addr = 5;
counter++;
if (locked) {
return;
}
else {
snoop_t* rcm = (snoop_t*)call Packet.getPayload(&packet,
sizeof(snoop_t));
if (rcm == NULL) {
return;
}
rcm->counter = counter;
if (call AMSend.send(addr, &packet, sizeof(snoop_t)) == SUCCESS) {
locked = TRUE;
}
}
}
event message_t* Snoop.receive(message_t* bufPtr,
void* payload, uint8_t len) {
printf("\n%u Snoop is called. YES!", TOS_NODE_ID);
printfflush();
return bufPtr;
}
event message_t* Receive.receive(message_t* bufPtr,
void* payload, uint8_t len) {
if (len != sizeof(snoop_t)) {return bufPtr;}
else {
snoop_t* rcm = (snoop_t*)payload;
printf("\n%u Receive %u", TOS_NODE_ID, rcm->counter);
printfflush();
return bufPtr;
}
}
event void AMSend.sendDone(message_t* bufPtr, error_t error) {
if (&packet == bufPtr) {
locked = FALSE;
}
}
}
On Tue, Feb 4, 2014 at 8:15 AM, Djemaa Adel <[email protected]> wrote:
> hello,
> give us please more specifications of your question.
> are you using simulation envirement with TOSSIM, or real nodes?
> good luck
>
>
> 2014-02-02 Faisal Aslam <[email protected]>:
>
>> Hi,
>>
>> I want to snoop the data packets. The send and unicast receive works fine
>> but no packets are received at the snooping nodes.
>>
>> Any ideas what I may have been doing wrong?
>>
>> best regards,
>> Faisal
>>
>>
>> _______________________________________________
>> Tinyos-help mailing list
>> [email protected]
>> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>>
>
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help