Hello,

In fact it is not so difficult (if I've correctly understood what you 
want to do).

As I said when you compile your program, MIG will parse the definition 
of the message's structure (your nx_struct) and translate it to a Java 
class containing all the necessary getters with which you can retrieve 
attributes' values in the structure.

By using SerialActiveMessageC component, you can send received 
temperature values back to your PC. And with Tinyos's Java API, you can 
read those values via serial connection in your Java program.

Try to read and understand the source code of 
net.tinyos.tools.MsgReader, it's not very difficult. Once you know how 
to read datas via serial communication, then you can save those datas 
into your database using JDBC etc.


Best regards

- Yanbo

> Hello Yanbo.
>
> In this first stage only  I want to read in console the values. (Currently)
>
> But my final target is store this value into MySQL DB, in this stage is
> not important read the value from the console.
>
> I suppose if I can read from the terminal then I can manage it? But if is
> an SerailActveMessageC i.e.  this will be a bit difficult than if  coming
> from serial data?
>
> Thanks for  answering me.
>
> Alejandro
>
>
>> Hello Alejandro,
>>
>> Could you explain to me again what do you wan to do exactly ?
>> If you only want the mote to read and send back the temperature values.
>>
>> All you have to do is define a nx_struct (e.g. nx_struct Temp_Msg)
>> structure which contains temperature value e.g. uint16_t temp. In your
>> readDone() event, assign the temperature value to temp attribute and
>> send it to base station. And your base station sends received
>> temperatures back to PC using SerialActiveMessageC component.
>>
>> When you compile your program, MIG will translate your nex_struct into a
>> Java class and you may read RAW temperature values in your console using
>> net.tinyos.tools.MsgReader:
>>
>> java net.tinyos.tools.MsgReader TempMsg -comm serial@/dev/ttyUSB0:telosb
>>
>> Best regards
>>
>> - Yanbo
>>
>>
>>> Dear Yanbo.
>>>
>>> I've seen something in the TutorialMote-PC about serial communication
>>> and
>>> SerialForwarder.
>>>
>>> But what do you recommend to me, in order to store the sensor values in
>>> MySQL DB? or is indistinct?
>>>
>>> Thanks in advance,
>>>
>>> Alejandro.
>>>
>>>> Hello,
>>>>
>>>> I've nevered tryed Listen.
>>>> I prefer net.tinyos.tools.MsgReader which shows me all attributes'
>>>> values in hexadecimal of received messages.
>>>> Have you tried this tool ?
>>>>
>>>> Best regards.
>>>>
>>>> - Yanbo
>>>>
>>
>

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to