"TOS_MsgPtr Msg" is a pointer and you must initialize it to an allocated 
location. For example,

TOS_Msg buf
TOS_MsgPtr msg = &buf

and then copy "Hello" to msg->data using either memcpy or any 
other string copy routines. If you look at TOS_Msg structure defined in 
tos/system/AM.h has a "length" field.

However, if you are just starting to use Tinyos, I sugest you to start 
with Tinyos-2.x.

Regards,
Manjunath D

################################################################################################################
***************************************************************************************************************

On Mon, 28 Dec 2009, Suresh Mathew wrote:

> This is where I have been having problems.
>
> I am using the SendMsg.Send(TOS_UART_ADDR,length, Msg) to send the data.
> However, how can I actually setup the message? My message is simply "Hello".
> I have declared Msg as TOS_MsgPtr. Then I have set Msg->data = "Hello". How
> do I set up length?
>
> command result_t StdControl.start() {
>     msg->data = "Hello";
>    call SendMsg.send(TOS_UART_ADDR,5,msg);
>    return SUCCESS;
>  }
>
> Compilation is unsuccessful. Can you please help?
>
> Thanks,
> - Suresh
> P.S - This is unfortunately still in TInyOS1.x
>
>
> On Mon, Dec 28, 2009 at 7:07 PM, Manjunath Doddavenkatappa <
> dodda...@comp.nus.edu.sg> wrote:
>
>> If I remember correct (as Tinysos-2.x has completely replaced 1.x), please
>> use the SendMsg interface wired to the GenericComm with destination address
>> being TOS_UART_ADDR.
>>
>> Regards,
>> Manjunath D
>>
>>
>> ################################################################################################################
>>
>> ***************************************************************************************************************
>>
>>
>> On Mon, 28 Dec 2009, Suresh Mathew wrote:
>>
>>  Hi,
>>>
>>> I am using a MICA2 mote on TinyOS 1.x. I want to send a simple message to
>>> the PC and the message needs to be printed directly into a file. How do I
>>> do
>>> this?
>>>
>>> Please note I am using a MICA2 mote on TinyOS 1.x on a Windows XP
>>> Platform.
>>>
>>> - Suresh
>>>
>>>
>
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to