EEN for Chris

Fork of MTS-Cellular by MultiTech

Revision:
1:f155d94d6f3a
Parent:
0:830c436480e3
Child:
4:1f63354b8d1b
--- a/Utils/Terminal.h	Thu May 15 22:16:46 2014 +0000
+++ b/Utils/Terminal.h	Mon May 19 12:34:32 2014 -0500
@@ -1,4 +1,50 @@
 #ifndef TERMINAL_H
 #define TERMINAL_H
 
-#endif
\ No newline at end of file
+#include "mbed.h"
+#include "MTSBufferedIO.h"
+#include "MTSSerial.h"
+
+namespace mts
+{
+
+// A constant holding the exit message for the terminal program.
+const std::string exitMsg = "emtech";
+
+/** This class provides terminal style access to a serial interface on the
+* processor. This is done by seamlessly "connecting" the data traffic between the
+* mbed debug interface, usually accessed through the USB port, and the serial
+* interface in question. Once started you can also exit this mode by sending the
+* appropraite exit sequence through your terminal program. This sequence is: emtech
+*/
+class Terminal
+{
+public:
+    /** This constructs a Terminal object that connects the standard
+    * mbed USB serial inteface to the passed in serial interface. In
+    * odrder for this class to function you must call the start method.
+    *
+    * @param io the serial interface to connect to the console as an
+    * MTSBufferedIO object.
+    */
+    Terminal(MTSBufferedIO* io);
+    
+    /** Destructs an Terminal object and frees all created resources.
+    */
+    ~Terminal();
+    
+    /** This starts the terminal functionality and is a blocking call
+    * until you send the exit sequence "emtech" through you terminal
+    * program, at which point this method returns.
+    */
+    void start();
+    
+private:
+    MTSBufferedIO* io; //The interface you want terminal access to
+    MTSSerial* terminal; //The interface to the console or terminal
+    int index; //The index you are at with the exit sequence
+};
+
+}
+
+#endif /* TERMINAL_H */