Index: trunk/FACT++/src/LocalControl.h
===================================================================
--- trunk/FACT++/src/LocalControl.h	(revision 11044)
+++ trunk/FACT++/src/LocalControl.h	(revision 11045)
@@ -57,4 +57,8 @@
         lout << " " << kUnderline << "Specific commands:" << endl;
         lout << kBold << "   st,states    " << kReset << "Display a list of the available states with description." << endl;
+        lout << kBold << "   .s           " << kReset << "Wait for the state-machine to change to the given state." << endl;
+        lout <<          "                "              "     .s <state> [<timeout>]" << endl;
+        lout <<          "                "              "<state>   The state id (see 'states') for which to wait (e.g. 3)" << endl;
+        lout <<          "                "              "<imeout>  A timeout in millisenconds how long to wait (e.g. 500)" << endl;
         lout << endl;
         return true;
@@ -83,4 +87,22 @@
             if (fStateMachine)
                 fStateMachine->PrintListOfStates(lout);
+            return true;
+        }
+
+        if (str.substr(0, 3)==".s ")
+        {
+            istringstream in(str.substr(3));
+
+            int state=-100, ms=0;
+            in >> state >> ms;
+
+            if (state==-100)
+                return true;
+
+            const Time timeout = Time()+boost::posix_time::millisec(ms);
+
+            const int target = atoi(str.c_str()+3);
+            while (fStateMachine->GetCurrentState()!=target && timeout>Time())
+                usleep(1);
             return true;
         }
Index: trunk/FACT++/src/RemoteControl.h
===================================================================
--- trunk/FACT++/src/RemoteControl.h	(revision 11044)
+++ trunk/FACT++/src/RemoteControl.h	(revision 11045)
@@ -130,4 +130,9 @@
         lout << kBold << "   svc,services " << kReset << "List all services in the network." << endl;
         lout << kBold << "   st,states    " << kReset << "List all states in the network." << endl;
+        lout << kBold << "   .s           " << kReset << "Wait for the state-machine to change to the given state." << endl;
+        lout <<          "                "              "     .s <server> <state> [<timeout>]" << endl;
+        lout <<          "                "              "<server>  The server for which state to wait (e.g. FTM_CONTROL)" << endl;
+        lout <<          "                "              "<state>   The state id (see 'states') for which to wait (e.g. 3)" << endl;
+        lout <<          "                "              "<imeout>  A timeout in millisenconds how long to wait (e.g. 500)" << endl;
         lout << endl;
         return true;
@@ -168,4 +173,27 @@
         }
 
+        if (str.substr(0, 3)==".s ")
+        {
+            istringstream in(str.substr(3));
+
+            int state=-100, ms=0;
+            string server;
+
+            in >> server >> state >> ms;
+            if (state==-100)
+                return true;
+
+            const ClientList::const_iterator l = fClientList.find(server);
+            if (l==fClientList.end())
+                return true;
+
+            const Time timeout = Time()+boost::posix_time::millisec(ms);
+
+            while (l->second->GetState()!=state && timeout>Time())
+                usleep(1);
+
+            return true;
+        }
+
         if (ReadlineColor::Process(lout, str))
             return true;
