Thank you for the answer.

During the past days i've been working on the code. I included the next
structure on the Ctp.h header file:

typedef nx_struct {
>     nx_bool adChildren;
> } ctp_children_header_t;

In the routing engine i added some lines, including a new task which is
posted inside another task (updateRouteTask). As you can see, to send the
info I used the same method that beacons use but changing the arguments. The
variable 'childrenMsg' used in the task is declared in this way:

ctp_children_header_t* chidlrenMsg;



   task void modifyChildrenTask(am_addr_t actualParent, am_addr_t newParent)
> {
> error_t eval;
> if (sending) {
>     return;
> }
> // If had parent...
> if (actualParent != INVALID_ADDR) {
> // ...set the boolean and send it
> childrenMsg->adChildren = FALSE;
>         eval = call BeaconSend.send(actualParent, &childrenMsg,
> sizeof(ctp_children_header_t));
>         if (eval == SUCCESS) {
>             sending = TRUE;
>         } else if (eval == EOFF) {
>             radioOn = FALSE;
>             dbg("Checkpoint 1");
>         }
> }


> // Set the boolean and send to the new parent
> childrenMsg->adChildren = TRUE;
>
>         eval = call BeaconSend.send(newParent, &childrenMsg,
> sizeof(ctp_children_header_t));
>         if (eval == SUCCESS) {
>             sending = TRUE;
>         } else if (eval == EOFF) {
>             radioOn = FALSE;
>             dbg("Checkpoint 2");
>         }
>     }


My actual problem is about receiving the packet. The routing engine
overrides the Receive interface but, is possible (depending on what packet
the nodes receive) to trigger different functions? If not, i think i will
check the length to do that :p


Any advice, suggestion or whatever is welcome! :)





2011/8/21 Omprakash Gnawali <gnaw...@cs.stanford.edu>

> On Thu, Aug 18, 2011 at 9:44 PM, FraN J <kit...@gmail.com> wrote:
> > Hello!
> > Im doing some research about CTP, want to modify it ant test if i can
> > improve the energy consumption but im new to nesC and im having some
> > troubles with the code.
> > By now, i added a new field to the "route_info_t" structure defined in
> > TreeRouting.h. I also added the same field to the "ctp_routing_header_t"
> > structure defined in Ctp.h so the field get sent each time the node send
> a
> > beacon avertising his routeInfo.
> > When a node changes his parent (in the task "updateRouteTask"), if the
> best
> > neighbor found in the routing table is even better than our actual
> parent,
> > the node is going to change his actual parent.
> > In that moment i need to send 2 messages, 1 to my old parent and 1 to the
> > new to let them know the changes, so my question is:
> > ¿How can i do that? I've been reading some related TEP's and some nesC
> > tutorials, but i got stuck at this point so i appreciate any help or
> advice
> > :)
>
> You need to send a regular single hop message. You can use AMSenderC to do
> that.
>
> - om_p
>
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to