You will have to, at minimum, recompile and reload all programs
that use the message structure. I haven't used/looked at BcastInject
so I don't know if it even has facility for receiving messages, but
certainly it would need to be modified to interpret your new message.
As to changing structs, only one element of a union _should_ be used
at a time, unless you want to enter the obfuscated C contest. You
could add the destaddr to the LogMsg struct if you like. I just made
my suggestions based on what is in the existing files and an educated
guess that someone had already made a stab at thinking about it...

I'm afraid most of what you are asking about are either general
design or programming issues. I think you need to learn some more 'C'
and Java before you torture yourself with the vagaries of TOS. Sun
has a pretty good online Java tutorial, and a copy of the K&R C book
would hopefully be useful.

For searching the help list,
first, as someone already suggested, Google should be your friend;
then Moteiv has a good page: http://www.moteiv.com/community/TinyOS_Information
and finally there is the wiki, but it seems to be partially content free:
http://cents.cs.berkeley.edu/tinywiki/index.php

MS

Hieu Tran wrote:
Thank you so much.
However, in my case, if I add LogMsg into "args" union. I am not sure for 2 possibilities: - Can I still use BcastInject since this program is written to support old SImpleCmd struct? For me, it is really complecated to make change to some java programes. - Since "args" is union, I can only use one field at the moment. In my program, I want the packet have to the destination address (in the "read_log_args rl_args" field, in my program it is TOSBase mote address) and sample values (ex: photo values). So can I use union here?
I look forward to hearing from you!
Regards!
Tran Chi Hieu


*/Michael Schippling <[EMAIL PROTECTED]>/* wrote:

    it looks like someone thought this would be a good idea and included
    some intriguingly named objects in SimpleCmdMsg.h. Like
    "start_sense_args
    ss_args" and "LogMsg". But I don't find them used anywhere.

    You could probably add LogMsg to the "args" union and
    create a new action type for returned sense data. Just make sure
    the whole struct size is under 29 bytes as defined in types/AM.h.
    Hopefully the rest of the code will ignore messages it doesn't
    understand.

    MS


    Hieu Tran wrote:
     > Hi all!
     > I am doing a simulation in TinyOS tutorial, Lesson 7 (Injecting and
     > Broadcasting packets). I have 3 motes, in that one mote programmed
     > as TOSBase. Two motes programmed with Bcast, in which one mote as
    Relay
     > node (receive packet and forward, mote address 1), one mote as
     > destination (mote address 2).
     > I modify the BcastInject, from cygwin command I want to tell mote
    2 to
     > do something. (mote address is received from command as argument
    and put
     > in the SimpleCmdMsg struct):
     >
     > typedef struct SimpleCmdMsg {
     > int8_t seqno;
     > int8_t action;
     > uint16_t source;
     > uint8_t hop_count;
     > union {
     > start_sense_args ss_args;
     > read_log_args rl_args;// I put mote address here
     > uint8_t untyped_args[0];
     > } args;
     > } SimpleCmdMsg;
     >
     >
     > (For example If I want to tell Mote 2 Led_on, from cigwin I type
     > .................led_on 2)
     >
     > Packet will be transmitted from TOSBase -> Relay Node (Mote 1) (it
     > receive packet, check mote address, and know that packet does not
    belong
     > to it, it forward packet ) -> Destination (Mote 2).
     >
     > with simple applications such as led_on, sound_on, my simulation
    work well.
     >
     > Now, I want to tell mote 2 to do some other works, such as it
    take light
     > samples from sensing board and transmit these values back to TOSBase
     > (mote 2 -> mote 1 -> TosBase). Of course I will have to modify
     > BcastInject and Bcast. However, I do not know how to put these
    values in
     > the SimpleCmd struct to transmit.
     >
     > typedef struct SimpleCmdMsg {
     > int8_t seqno;
     > int8_t action;
     > uint16_t source;
     > uint8_t hop_count;
     > union {
     > start_sense_args ss_args;
     > read_log_args rl_args;
     > uint8_t untyped_args[0];
     > } args;
     > } SimpleCmdMsg;
     > How can I put the sample values in to the SimpleCmd struct?
     > Because I learnt that BcatsInject, Bcast all use SimpleCmd struct to
     > transmit and receive packet. Do I need to use other struct in my
     > simulation? (in both directions, from TOSBase to Destination and
    from
     > Destination to TOSBase).
     > In that case, can I still use BcastInject?
     >
     > can you give me some suggestion to overcome this trouble? Many
    thanks!
     >
     > Regards!
     >
     >
     >
     >
     >
     >
     >
     >
     >
     >
     >
     >
     >
    ------------------------------------------------------------------------
     > Yahoo! Messenger with Voice.
     >
     > PC-to-Phone calls for ridiculously low rates.
     >
     >
     >
    ------------------------------------------------------------------------
     >
     > _______________________________________________
     > Tinyos-help mailing list
     > [email protected]
     >
    https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


------------------------------------------------------------------------
Get amazing travel prices for air and hotel in one click on Yahoo! FareChase <http://farechase.yahoo.com/;_ylc=X3oDMTFpMnJnZ3IxBF9TAzk3NDA3NTg5BHNlYwNtYWlsLXRhZ2xpbmVzBHNsawNmYXJlY2hhc2UtMDQyNzA2 >


------------------------------------------------------------------------

_______________________________________________
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

Reply via email to