PDA

View Full Version : StdoutPortal vs StdinMode


BitManip
03-04-2008, 03:19 PM
I read your API docs on setting up Stdout in an end device to redirect print statments to the Portal device and it being printed in the log. This is as the book says "good for testing". I wonder if i do a print in the end device and have all UARTs disabled and only talking wireless to the unit, what direction does the print go to? I dont quite understand when I would use the Stdout vs the Stdin. Would you please clarify?

Thanks

kbanks
03-04-2008, 03:39 PM
Q) I wonder if i do a print in the end device and have all UARTs disabled and only talking wireless to the unit, what direction does the print go to?

A) The output literally "goes nowhere". There is a "null" device in the node (similiar to /dev/nul in linux). The buffer containing the text is recycled and used again

kbanks
03-04-2008, 03:44 PM
Q) I dont quite understand when I would use the Stdout vs the Stdin. Would you please clarify?
A) These terms are relative to the SNAPpy scripts point of view. When you print() something from your SNAPpy script, it goes to the currently configured STDOUT device (which could be the "null" device). The HOOK_STDOUT event is telling you that the output has been sent (or discarded), and you can (if needed) do another print() statement.

STDIN refers to text coming *IN* to your SNAPpy script. When you get a HOOK_STDIN event in your script, it means their is some text for you to process.