I ended up reading the message header first and then reading the number of data bytes represented by the Length field in the header.
Thanks again,
Ian
On 10/19/06, Michael Schippling <[EMAIL PROTECTED]> wrote:
oops...as bbuckner just pointed out, I forgot about the danged escape chars,
So the cast-the-buffer thing doesn't work reliably...have to parse the stream.
sorry
MS
Michael Schippling wrote:
> Looks like your prayers may be answered in the message thread:
> "[Tinyos-help] C program for Listern"
>
> Otherwise reading the correct number of bytes from the port into
> a buffer and casting it to the TOS_Msg struct should do the trick.
> Oh, yeah, if you do that on a big-endian machine you'll have to
> swap the bytes in the short ints.
> MS
>
> Fabrizio Stefani wrote:
>>
>> Michael Schippling wrote:
>>> The messages are not in ASCII format, which I think you are
>>> hoping for by inference from your question.
>>>
>>> They are in the same TOS_Msg format as received from
>>> the TOSBase Mote. They are fixed length binary, but if you
>>> use the Java Packetizer class or the C equiv in the tools
>>> directory (in T1) you shouldn't have to know.
>>
>> Are you talking about the serialforwarder written in C?
>> Because it doesn't understand the message format, it just replies the
>> byte received from the serial to a given port.
>>
>> Or do you really mean that there is a C program which understand the
>> message format and creates a C data structure to store them (like the
>> Java Packetizer does)?
>> This could be very useful to me (I'm not so skilled with java, I
>> prefer C), but I cannot find any such application in the tools dir.
>>
>> Can you help me?
>>
>>
>> Fabrizio Stefani
>>
>>>
>>> MS
>>>
>>>
>>> Ian Welch wrote:
>>>> When serial forwarder forwards the packets to a designated are the
>>>> each terminate by a "Carage Return Line Feed"?
>>>>
>>>> The reason I ask is because I'm writing a program to listen to the
>>>> SF port to save Mote data packets. Every now and again the data on
>>>> the port comes out a different size and throws my program. If there
>>>> is a termination character at the end of each packet I could resolve
>>>> this problem.
>>>>
>>>> Also, I don't know Java so looking through the tools source code
>>>> doesn't really help.
>>>>
>>>> Thanks,
>>>> Ian
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>>
>>>> _______________________________________________
>>>> Tinyos-help mailing list
>>>> [email protected]
>>>> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>>>>
>>> _______________________________________________
>>> Tinyos-help mailing list
>>> [email protected]
>>> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>>>
>>> _______________________________________________________________
>>> This email has been ClamScanned by ArsLogica antivirus server !
>>> www.clamav.net
>>> _______________________________________________________________
>>>
>>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________ Tinyos-help mailing list [email protected] https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
