Peter Ferland / MTS-Cellular_lat1

Fork of MTS-Cellular by MultiTech

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Terminal.h Source File

Terminal.h

00001 #ifndef TERMINAL_H
00002 #define TERMINAL_H
00003 
00004 #include "MTSBufferedIO.h"
00005 #include "MTSSerial.h"
00006 
00007 namespace mts
00008 {
00009 
00010 // A constant holding the exit message for the terminal program.
00011 const std::string exitMsg = "emtech";
00012 
00013 /** This class provides terminal style access to a serial interface on the
00014 * processor. This is done by seamlessly "connecting" the data traffic between the
00015 * mbed debug interface, usually accessed through the USB port, and the serial
00016 * interface in question. Once started you can also exit this mode by sending the
00017 * appropraite exit sequence through your terminal program. This sequence is: emtech
00018 */
00019 class Terminal
00020 {
00021 public:
00022     /** This constructs a Terminal object that connects the standard
00023     * mbed USB serial inteface to the passed in serial interface. In
00024     * odrder for this class to function you must call the start method.
00025     *
00026     * @param io the serial interface to connect to the console as an
00027     * MTSBufferedIO object.
00028     */
00029     Terminal(MTSBufferedIO* io);
00030     
00031     /** Destructs an Terminal object and frees all created resources.
00032     */
00033     ~Terminal();
00034     
00035     /** This starts the terminal functionality and is a blocking call
00036     * until you send the exit sequence "emtech" through you terminal
00037     * program, at which point this method returns.
00038     */
00039     void start();
00040     
00041 private:
00042     MTSBufferedIO* io; //The interface you want terminal access to
00043     MTSSerial* terminal; //The interface to the console or terminal
00044     int index; //The index you are at with the exit sequence
00045 };
00046 
00047 }
00048 
00049 #endif /* TERMINAL_H */