Try digging through the DBG() code and see how they get to stdout,
might be as simple as printf()....

I'd then suspect that there is some similar way you could use
the moral equivalent of getline() or scanf() to get input. I'm
not even sure what language the TOSSIM stuff is in so I can't
help with details.

MS


Chan kenniel wrote:
Dear Michael,

Is it possible to get the data from DBG(), if so, that would be definitely awesome. But I don't know how to get data from stdin and stdout, could you please give me some help on this?

Thanks a lot.

Best regards,
Kenneth

On 10/19/07, *Michael Schippling* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    Well, as I said I don't know anything about TOSSIM so I'm
    probably of no use without actually sitting at your computer...

    But I'm still not sure why you want to use the serial port?
    You can use DBG() to write messages from a TOSSIM process to
    stdout, and I'd bet with a little hacking you could figure
    out how to read from stdin if you want to get info from the
    'outside world'.

    MS

    Chan kenniel wrote:
     > Dear Michael,
     >
     > Actually what I need to is sending some bytes to the simulator,
    not on
     > the mote, coz we are trying to do some testing job
     > on some nesC programs. More specifically, we first try to instrument
     > some faults to some nesC programs, then we want to run it
     > in the simulator coz we want online data that can be sent to PC,
    like say
     > the original nesC code is
     >                              if a<3 then do B;...
     > but after instrument, the predicate in faulted version might become
     >                              if a>3 then do B;
     >                              //new added
     >                              send_to_PC(a)...;
     >
     > then after sending a from the simulator to the PC side, we will have
     > other programs that to justify the faults, and there are many such
     > send_to_PC(x) calls will be made, therefore, if we keep running
    programs
     > in the mote, it would be time costly. So we prefer to use simulator.
     >
     > And my problems is I have successfully changed the oscilloscope
    program
     > to another nesC program that can send data to PC, but the program for
     > instrument is written in C, and the program has to called my
    function
     > send_to_PC which is written in nesC, I know nesC can call external C
     > function,
     > but I have never heard C can call nesC functions.
     >
     > Therefore, I have to write a program in C to send byte data to the
     > simulator which I am not getting stuck on this part, one month
    has been
     > passed, and I
     > got no progress. I really hope any of you guys can help me out with
     > this, because I believe once we successfully make this, it would
    make a
     > more easier
     > way for testers to test nesC programs.
     >
     > I would be very appreciated if you guys help me out with this, I have
     > post questions for many times, but I always got no reply, that
    may be my
     > expression
     > in questions is not good, but hopefully this time you guys can
     > understand what I wanna do. If not, please feel free to ask me, I
    will
     > try to explain it in a more
     > detailed way.
     >
     > Thanks in advanced, PLEASE DO help me >.<
     >
     >
     >
     >
     > On 10/18/07, *Michael Schippling* <[EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
     > <mailto: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>> wrote:
     >
     >     I don't know from TOSSIM, but on real motes the low-level
    code starts
     >     around UARTM.nc. I don't know if there is an equivalent for the
     >     simulator
     >     as it looks like your packet_sim.c file plugs in at a higher
    level.
     >
     >     But I'm a bit unclear on the purpose. Do you want to write a mote
     >     program that implements a lower level 'protocol' like just
    sending
     >     some bytes, or are you trying to make a host-side program to talk
     >     to the motes?
     >
     >     MS
     >
     >     Chan kenniel wrote:
     >      > Dear all,
     >      >
     >      > Currently, I have successfully use the nesC program
    Oscilloscope
     >     to send
     >      > TOS_Msg to TOSSIM, and this is done
     >      > by calling the UARTSend.send function in interface
    BareSendMsg.
     >     However,
     >      > what I am trying to do is creating my
     >      > own send function that is written in C program, that means
    I have to
     >      > find the root of the BareSendMsg to see the C source code.
     >      >
     >      > And I found that the root is actually a PCradio.h file
    located in
     >      > tos/platform/pc, and they actually call the
     >      > TOSH_uart_send function to send the message, but in the
     >     TOSH_uart_send
     >      > function, it calls other functions
     >      > located in packet_sim.c, and they are a bit complicated.
     >      >
     >      > Actually what I trying to ask is if I want to write an own
    C program
     >      > that send TOS_Msg to serial port, how far should I go?
     >      > Can I just use the TOSH_uart_send function that provided
    in PCradio.h
     >      > file? or should I have to go deep to packet_sim.c
     >      > and analyze the whole logic and relations about functions?
    Can anyone
     >      > give me any help please?
     >      >
     >      > Thanks in advanced.
     >      >
     >      > --
     >      > Best wishes,
     >      > Kenneth Chan
     >      >
     >      > ------------------------
     >      > Wish you have a good day!
     >      >
     >      >
     >      >
> ------------------------------------------------------------------------

     >
     >      >
     >      > _______________________________________________
     >      > Tinyos-help mailing list
     >      > [email protected]
    <mailto:[email protected]>
     >     <mailto:[email protected]
    <mailto:[email protected]>>
     >      >
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
     >
     >
     >
     >
     > --
     > Best wishes,
     > Kenneth Chan
     >
     > ------------------------
     > Wish you have a good day!




--
Best wishes,
Kenneth Chan

------------------------
Wish you have a good day!
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to