Homepage Demos Overview Downloads Tutorials Reference
Credits

StringInputControl.cc

Go to the documentation of this file.
00001 #include "StringInputControl.h"
00002 #include "Wireless/Wireless.h"
00003 #include "Motion/MMAccessor.h"
00004 #include "Motion/LedMC.h"
00005 #include "Motion/MotionManager.h"
00006 #include <sstream>
00007 
00008 /*ControlBase* StringInputControl::activate(MotionManager::MC_ID disp_id, Socket* gui) {
00009   display_id=disp_id;
00010   gui_comm=gui;
00011   return doReadStdIn(userPrompt);
00012   }*/
00013 
00014 void StringInputControl::refresh() {
00015   ControlBase::refresh();
00016   doReadStdIn(userPrompt);
00017 }
00018 
00019 ControlBase* StringInputControl::doReadStdIn(const std::string& prompt/*=std::string()*/) {
00020   if(gui_comm!=NULL && wireless->isConnected(gui_comm->sock)) {
00021     //    cout << "REFRESHING " << getName() << endl;
00022     //try to get it all in one packet for better performance
00023     std::stringstream ss;
00024     ss << "refresh\n"
00025        << getName() << '\n'
00026        << "1\n"
00027        << "0\n"
00028        << "0\n"
00029        << "Waiting for input...\n"
00030        << userPrompt << "\n";
00031     gui_comm->write((const byte*)ss.str().c_str(),ss.str().size());
00032   }
00033   
00034   if(prompt.size()==0)
00035     return ControlBase::doReadStdIn(userPrompt);
00036   else
00037     return ControlBase::doReadStdIn(prompt);
00038 }
00039 
00040 /*! @file
00041  * @brief Implements StringInputControl, which prompts for and stores a string from the user
00042  * @author ejt (Creator)
00043  *
00044  * $Author: ejt $
00045  * $Name: tekkotsu-2_2 $
00046  * $Revision: 1.5 $
00047  * $State: Rel $
00048  * $Date: 2003/07/28 05:54:32 $
00049  */
00050 

Tekkotsu v2.2
Generated Tue Oct 19 14:19:16 2004 by Doxygen 1.3.9.1