Hi!
The first what I see is that you're calling led2On() in sendAux1.send()
but in sendAux1.sendDone() you're calling immediately led2Off(). It
could be so fast that you just can't see, the led 2 was on.
Best wishes,
Andrey
Juan Salvador Galindo Pedreño wrote:
> hi, why in this code when I intercept a message I like forward it to other
> mote, although all is correct when I compile, the message never forward,
> because I call to Led2On( ) when I send it. Someone, can I help me??
> The error is call sendAux1.send(3,msg,sizeof(RssiMsg), why??
> Thanks in advance.
>
> module AplicacionColaborativaC {
> uses interface AMPacket;
> uses interface Boot;
> uses interface AMSend as sendRssi;
> uses interface AMSend as sendAux1;
> uses interface AMSend as sendAux2;
> uses interface Timer<TMilli> as TimerMain;
> uses interface CC2420Packet;
> uses interface SplitControl as RadioControl;
> uses interface Packet;
> uses interface Leds;
> uses interface Intercept as RssiMsgIntercept;
> }
>
> implementation {
> enum{
> NumMotes=10,
> };
>
> uint8_t RSSI[NumMotes];
> uint16_t Origen[NumMotes];
> uint16_t CopiaOrigen[NumMotes];
> uint16_t NOrigen;
> uint16_t Destino;
>
> uint8_t PotRssi;
> uint8_t temp;
> uint16_t Tabla[NumMotes];
> uint8_t i;
> uint8_t j;
> uint16_t pos;
>
>
> message_t msgAux;
> message_t Aux;
>
>
> event void Boot.booted(){
> RssiMsg *rssimsg;
> rssimsg=(RssiMsg*) call Packet.getPayload(&msgAux,NULL);
> rssimsg->Dest_final= 3;
> for(i=0;i<NumMotes;i++){
> RSSI[i]=0;
> }
>
> call RadioControl.start();
>
> }
>
> event void RadioControl.startDone(error_t result){
> call TimerMain.startPeriodic(2000);
> }
>
> event void RadioControl.stopDone(error_t result){}
> le
> event void TimerMain.fired(){
> if(call sendRssi.send(2, &msgAux,sizeof(RssiMsg))==SUCCESS){
> call Leds.led0On();
> }
> else{
> call Leds.led1On();
> }
> }
>
> event bool RssiMsgIntercept.forward(message_t *msg, void *payload,
> uint16_t len) {
> if((call sendAux1.send(3,msg,sizeof(RssiMsg)))==SUCCESS){
> call Leds.led2On();
> return TRUE;
> }
> else{
> call Leds.led1On();
> return FALSE;
> }
> }
>
> event void sendRssi.sendDone(message_t* msg, error_t error){
> call Leds.led0Off();
> }
>
> event void sendAux1.sendDone(message_t* msg, error_t error){
> call Leds.led2Off();
>
> }
> event void sendAux2.sendDone(message_t* msg,error_t error){
> call Leds.led2On();
> }
>
>
> }
>
>
> _________________________________________________________________
> ¿Eres un cotilla? Disfruta de todas las novedades en MSN Corazón
> http://entretenimiento.es.msn.com/corazon/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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