Hi Sriram,
I am not very familiar with TOSSIM, so I don't really know how to help
you here. If you post your messages to the mailing list, others who
might be more familiar with your problem get a chance to read your
questions as well.
Cheers,
Urs
On 10/06/2010 04:32 PM, Sriram Sankaran wrote:
> Hello Urs,
>
> Thanks for your reply. I want to unicast a packet from source node 1 to
> destination node 2. I am using tinyos 2.x and tossim. I specified the
> source and destination address in the tossim topology file. Now, my
> question is the following:
>
> when unicasting a packet, should I have to hard-code the destination
> address in the following piece of code before sending the packet. Can I
> not retrieve the source and destination address from tossim, store it in
> a variable and replace '2' by the variable in the following code before
> sending the packet?
>
> *************************************
>
> if (call Request_AMSend.send(2, &pkt1, sizeof(RequestMsg)) == SUCCESS) {
> busy = TRUE;
> }
>
> *************************************
>
> Thanks for your help.
> Sriram
>
>
>
> On Wed, Oct 6, 2010 at 5:35 AM, Urs Hunkeler <[email protected]
> <mailto:[email protected]>> wrote:
>
> Hi Sriram,
>
> Can you describe what exactly you want to do? Do you want to prepare
> sending a packet and store all the information inside a single
> packet structure, then just send it when the timer fires? According
> to the documentation in AMPacket.C you can do this. For your code to
> work you will have to uncomment the "msg = &pkt1;" line.
>
> For your code to work properly you have to ensure that you set the
> destination address when you write the packet structure. I have a
> suspicion that you try to do something more complex, like a multihop
> protocol. If that is the case, be especially careful about how you
> copy messages. Also note that the destination address here is the
> address of the next hop, not the final destination in a multihop route.
>
> Cheers,
> Urs
>
>
>
> On 10/06/2010 03:16 AM, Sriram Sankaran wrote:
>> Hello Urs,
>>
>> I had a small question about unicasting a packet to a specific
>> mote in tinyos-2.x and tossim. In the following piece of code, I
>> would like to know if dst field (written in bold) can be retrieved
>> using AMPacket.destination command instead of hard-coding it,
>> before sending a message.
>>
>> Any help would be appreciated.
>>
>> Thanks
>> Sriram
>>
>> ***********************************************
>>
>> event void Timer0.fired()
>> {
>> message_t* msg;
>>
>> //Allocate memory for msg
>> //msg = &pkt1;
>>
>> if (!busy) {
>> RequestMsg* reqpkt = (RequestMsg*)(call
>> Request_Packet.getPayload(&pkt1, NULL));
>>
>> src = call Request_AMPacket.source(msg);
>> dst = call Request_AMPacket.destination(msg);
>>
>> reqpkt->src = src;
>> reqpkt->dst = dst;
>> //dbg("SendRecvC", "Data received: %u.\n", reqpkt->data);
>> printf("Src node sent: %u\n", src);
>> printf("Dst node sent: %u\n", dst);
>>
>> if (call Request_AMSend.send(*dst*, &pkt1, sizeof(RequestMsg)) ==
>> SUCCESS) {
>> busy = TRUE;
>> }
>> }
>>
>
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help