Hi!

The Data_Message_PC is encapsulated in the TOS_Msg.data.

The idea is the following: I receive from a mote via radio the following
payload:

01 00 02 00 03 00 04 00 05 00 06 00

This data I want to stuff in the field actualData from the Data_Message_PC.

typedef struct Data_Message_PC
{
      uint16_t actualData[MAX_DATA];
}Data_Message_PC;

Let's say that the variable MAX_DATA is 8. This means that I have to create
a Data_Message_PC message, which has 16 bytes of actualData, but I only
received 12 bytes via radio, so I need to stuff the rest of the bytes with
some values(zero for example). So the Data_Message_PC that I want to send
should look like this:

01 00 02 00 03 00 04 00 05 00 06 00 00 00 00 00

As I said before, I am trying to use a for loop like this:

for (i=0;i<lengthDataReceivedByRadio;i++) data_pc->data[i] =
 dataReceived->data[i];
for (i=lengthDataReceivedByRadio;i<MAX_DATA;i++) data_pc->data[i] = 0;

If I try to send this, the send command fails.

Any idea is welcome,

Adina


> I'm not entirely clear on what you are doing here. Is your Data_Message_PC
> encapsulated in TOS_Msg.data ? If not, and you are using java tools
> Packetizer.java (which I think MIG generated files depend on) you'll
> probably never see it...
>
> I just sent a reply to a message:
> "Receiving packets from the base station"
> with a couple pointers to info about the message structure.
>
> If you are trying to take a full TOS_Msg off the radio and stuff it
> into your Data_Message_PC the message size will be too large and you
> will not have the right crc. Perhaps you want to just copy the data
> portions from one message to another?
>
> Or are you trying to re-create the function of TOSBase, which sends
> messages between the pc-UART-radio?
>
> Also see how demo apps like Oscilloscope build their message packets.
>
> MS
>
>
> adina wrote:
> > Hello!
> >
> > I have a problem with sending some a message over the UART. The message
> > looks like this:
> >
> > typedef struct Data_Message_PC
> > {
> >     uint16_t actualData[MAX_DATA];
> >     uint16_t lengthData;
> > }Data_Message_PC;
> >
> > I receive a message from a node, that has the length of the actualData
> of a
> > length less than MAX_DATA and I need
> > to send it to the UART, so that a Java application can parse the message
> > received.
> > The Java application is using classes generated with MIG, so it always
> > expects that the actualData received
> > be of MAX_DATA length.
> >
> > I have tried to use a for(which is the solution that should have sense),
> but
> > it doesn't seem to work.
> >
> >     for (i=0;i<lengthDataReceived;i++) data_pc->data[i] =
> > dataReceived->data[i];
> >     for (i=lengthDataReceived;i<MAX_DATA;i++) data_pc->data[i] = 0;
> >
> > If I try to do it like the following, I can see using
> > net.tinyos.tools.Listen that it has received the message, but this
> doesn't
> > work for
> > me:((
> >
>
>
>
memcpy(data_pc->data,dataReceived->data,sizeof(uint16_t)*lengthDataReceived);
> > call SendDataToUART.send(TOS_UART_ADDR,
> > sizeof(uint8_t)*(lengthDataReceived*2+7), &m_msg))
> >
> > Any help is more than welcome:)
> >
> > Thanks,
> > Adina
> >
> 

-- 
Mobile Internet - E-Mail und Internet immer und überall!
GMX zum Mitnehmen: http://www.gmx.net/de/go/pocketweb
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to