If yer going for compactness you can eliminate the
  "if (TOS_LOCAL_ADDRESS)" part too...
MS


Zainul M Charbiwala wrote:
> Hi,
> 
> I recently implemented a quick and dirty static routing
> implementation. I used a different strategy, but yours would also
> work.
> 
> An equivalent but more compact implementation could use:
> 
> uint8_t route[7] = {0x00, 0x00, 0x01, 0x01, 0x00, 0x04, 0x04};
> if (TOS_LOCAL_ADDRESS) { destination = route[TOS_LOCAL_ADDRESS]; }
> 
> 
> Regards,
> 
> Zainul.
> 
> On Tue, Aug 26, 2008 at 9:46 AM, Mumraiz Khan <[EMAIL PROTECTED]> wrote:
>> Hi all,
>> I am trying to implement static route using switch statements like this;
>>
>> switch (TOS_LOCAL_ADDRESS) {
>>     case 0: ; //Do nothing , base node
>>
>>     case 1: // parent of mote 1 is mote 0
>>         destination = 0x00;
>>         break;
>>     case 2: // parent of mote 2 is mote 1
>>         destination = 0x01;
>>         break;
>>     case 3: // parent of mote 3 is mote 1
>>         destination = 0x01;
>>         break;
>>     case 4: // parent of mote 4 is mote 0
>>         destination = 0x00;
>>         break;
>>     case 5: // parent of mote 5 is mote 4
>>         destination = 0x04;
>>         break;
>>     case 6: // parent of mote 6 is mote 4
>>         destination = 0x04;
>>         break;
>>     }
>>
>>         if (call SendMsg.send(destination, sizeof(CounterMessage), &data))
>>               return SUCCESS;
>>  
>> ..........................................................................................................................
>>
>> It works but ... is this approach correct or do i need to use multihop or
>> anyother routing available in tinyos...??
>>
>> _______________________________________________
>> 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
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to