I'm developing a simple TinyOS program with multihop.

Using Intercept.forward I inject some data into each packet, so that at the
root I can see the path the packet has taken.
I would also like to make some statistics based on the packets a node
receives which it has to drop (because it is not root, and it is not on the
current selected path). For that I thought I could use Snoop.receive

I've installed the program onto 3 modes (a root and two producers). I then
plug into the root to my laptop, and the producers node are located right
next to the root. The root receives the packets correctly, and I can verify
that Intercept.forward is called (by toggling a led). However, Snoop.receive
is never called.

The hardware is TelosB

Below is the relevant code:


    components CollectionC as Collector,  // Collection layer
           ActiveMessageC,                         // AM layer
           new CollectionSenderC(AM_MVIZ_MSG), // Sends multihop RF
           SerialActiveMessageC,                   // Serial messaging
           new SerialAMSenderC(AM_MVIZ_MSG);   // Sends to the serial port

    components CtpP as Ctp;

    components CC2420ActiveMessageC;
     MVizC -> CC2420ActiveMessageC.CC2420Packet;

    MVizC.RadioControl -> ActiveMessageC;
    MVizC.SerialControl -> SerialActiveMessageC;
    MVizC.RoutingControl -> Collector;

    MVizC.Send -> CollectionSenderC;
    MVizC.SerialSend -> SerialAMSenderC.AMSend;
    MVizC.Snoop -> Collector.Snoop[AM_MVIZ_MSG];
    MVizC.Receive -> Collector.Receive[AM_MVIZ_MSG];
    MVizC.Intercept -> Collector.Intercept[AM_MVIZ_MSG];
    MVizC.RootControl -> Collector;
    MVizC.CtpInfo -> Ctp;
    MVizC.LinkEstimator -> Ctp;

event message_t*
        Snoop.receive(message_t* msg, void* payload, uint8_t len) {
            snoop++;
            total++;
            call Leds.ledOn();


            return msg;
        }


    event bool Intercept.forward(message_t* msg, void* payload, uint8_t
len){
        int i;

        mviz_msg_t* omsg = (mviz_msg_t*) payload;
        for(i = 0; i < MOTES; i++){
            if(omsg->path[i] == MOTES+1){
                omsg->path[i] = (uint8_t)TOS_NODE_ID;
                omsg->rssi[i] = call CC2420Packet.getRssi(msg);
                break;
            }
        }

        call Leds.led2On();
        total++;
        return TRUE;
    }

The counters snoop and total are never incremented, and the Led0 is never
turned on.


Med Venlig Hilsen/Best Regards
Jan Christensen
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to