hi all,
I want to send a data to a node which is not in senders transmission range.
So, i am planning to use multihop trnasmission. (T2 & TOSSIM)
So, i tried to extract the things that the multihop transmission is needed
from the MultihopOscilloscope application. that means, i am not interested
in sending data to the root node via the serial communication.  So i ignored
that part and re-written an application only for multihop transmission. it
is very simple and follwing are the list of codes. It reads the data once
the tin=mer fired and then send the data through multihop transmission
method.

my problem is: I get the debuging mesaages until ReadDone, but not after. It
never print the debugging statement in the if block which sends the data.  I
have included my sourse code and sample out put. if somebody can point me
out my mistake, i'll really appriciate it. Am i missing something? i feel
so, but cannot find it.



MultihopOscilloscopeC.nc
===================
#include "Timer.h"
#include "MultihopOscilloscopeC.h"

module MultihopOscilloscopeC {
    uses{
        interface Boot;
        interface SplitControl as RadioControl;
        interface StdControl as RoutingControl;

        interface Send;
        interface Receive as Snoop;
        interface CollectionPacket;

        interface Timer<TMilli>;
        interface Read<uint16_t>;
    }
}
    implementation{
        message_t sendbuf;
        oscilloscope_t local;

        bool sendbusy =FALSE;

        event void Boot.booted(){
            dbg("vsn","Booted\n");
            call Timer.startOneShot(50);
        }
        event void Timer.fired(){
            dbg("vsn","Timer fired\n");
            call Read.read();
        }
        event void Read.readDone(error_t result, uint16_t data){
            oscilloscope_t *o = (oscilloscope_t*)call
Send.getPayload(&sendbuf);
            dbg("vsn","readDone\n");

             local.senderId=TOS_NODE_ID;
          local.receiverId= 5;

            memcpy(o,&local,sizeof(local));
            if(call Send.send(&sendbuf,sizeof(local))==SUCCESS){
                sendbusy =TRUE;
                dbg("vsn","start multihop\n");
            }
        }
         event void Send.sendDone(message_t *msg, error_t error) {
            sendbusy = FALSE;
                dbg("vsn","sendDone\n");
       }
        event message_t* Snoop.receive(message_t* msg,void* payload ,
uint8_t len){
            dbg("vsn","Snoop.receive\n");
            return msg;
        }

      event void RadioControl.stopDone(error_t error) { }
       event void RadioControl.startDone(error_t error) { }

    }

MultihopOscilloscopeAppC.nc
=============================
configuration MultihopOscilloscopeAppC{}

implementation {
    components MainC;
    components MultihopOscilloscopeC;
    components new TimerMilliC();

    components SensorC;

    components CollectionC as Collector;
    components ActiveMessageC;
    components new CollectionSenderC(AM_OSCILLOSCOPE);

    MultihopOscilloscopeC.Boot->MainC;
    MultihopOscilloscopeC.RadioControl->ActiveMessageC;
    MultihopOscilloscopeC.RoutingControl->Collector;
    MultihopOscilloscopeC.Send ->CollectionSenderC;
    MultihopOscilloscopeC.Snoop->Collector.Snoop[AM_OSCILLOSCOPE];
    MultihopOscilloscopeC.Timer->TimerMilliC;
    MultihopOscilloscopeC.Read->SensorC;
}


OUTPUT
========
node  0 is booting up
node  1 is booting up
node  2 is booting up
node  3 is booting up
node  4 is booting up
node  5 is booting up
DEBUG (0): Booted
DEBUG (1): Booted
DEBUG (2): Booted
DEBUG (3): Booted
DEBUG (4): Booted
DEBUG (5): Booted
DEBUG (0): Tiemr fired
DEBUG (1): Tiemr fired
DEBUG (2): Tiemr fired
DEBUG (3): Tiemr fired
DEBUG (4): Tiemr fired
DEBUG (5): Tiemr fired
DEBUG (0): readDone
DEBUG (1): readDone
DEBUG (2): readDone
DEBUG (3): readDone
DEBUG (4): readDone
DEBUG (5): readDone




thanks
lasanthi
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to