hi all,
 
I 'm studing tinyos2.0.1 and  meet a problem about "Dissemination" .
 
The problem is quite simple. I read the Tutorial 12, and compile the 
 
program which is similar to the program in the Tutorial 12, but it doese't work.
 
Here is the program:
 
#include <Timer.h>
module EasyDisseminationC 
{  
     uses interface Boot;  
     uses interface DisseminationValue<uint16_t> as Value; 
     uses interface DisseminationUpdate<uint16_t> as Update;
     uses interface SplitControl as AMControl;
 
     uses interface Timer<TMilli>;
}
implementation 
{  
     uint16_t counter; 
 
     task void ShowCounter() 
    {   
        dbg("Dissemination","Counter is %d.\n", counter);
    }   
 
    event void Boot.booted()
   {  
      dbg("Boot","Booted: The application started. \n");
      counter = 0;         
      call AMControl.start();
   }  
 
     event void AMControl.startDone(error_t err)
    {
         if (err == SUCCESS)
         { 
             if (TOS_NODE_ID == 1)
            {
                 call Timer.startPeriodic(100);
             }
        }
        else
       {
           dbg("Error","Error: The AMControl doesn't started. \n");
           call AMControl.start();
        }
    }
 
    event void AMControl.stopDone(error_t err)
    {
        dbg("Dissemination","STOP: Stop the application. \n\n");
    }

    event void Timer.fired() 
    {   
         counter = counter + 1;      
         post ShowCounter();    
        call Update.change(&counter); 
    }  
 
    event void Value.changed() 
   {  
        const uint16_t* newVal = call Value.get();       
        counter = *newVal;   
        post ShowCounter();  
    }

}
It seems Update.change() does't work at all. I don't know why.
 
And i remember the same program was fine under tinyos2.0.
 
Any help would be appreciated.
 
Eamin
 
 
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to