EEN for Chris
Fork of MTS-Cellular by
Utils/Terminal.h@1:f155d94d6f3a, 2014-05-19 (annotated)
- Committer:
- Mike Fiore
- Date:
- Mon May 19 12:34:32 2014 -0500
- Revision:
- 1:f155d94d6f3a
- Parent:
- 0:830c436480e3
- Child:
- 4:1f63354b8d1b
add all cellular code, remove MBEDCellularRadioInterface
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mfiore | 0:830c436480e3 | 1 | #ifndef TERMINAL_H |
mfiore | 0:830c436480e3 | 2 | #define TERMINAL_H |
mfiore | 0:830c436480e3 | 3 | |
Mike Fiore |
1:f155d94d6f3a | 4 | #include "mbed.h" |
Mike Fiore |
1:f155d94d6f3a | 5 | #include "MTSBufferedIO.h" |
Mike Fiore |
1:f155d94d6f3a | 6 | #include "MTSSerial.h" |
Mike Fiore |
1:f155d94d6f3a | 7 | |
Mike Fiore |
1:f155d94d6f3a | 8 | namespace mts |
Mike Fiore |
1:f155d94d6f3a | 9 | { |
Mike Fiore |
1:f155d94d6f3a | 10 | |
Mike Fiore |
1:f155d94d6f3a | 11 | // A constant holding the exit message for the terminal program. |
Mike Fiore |
1:f155d94d6f3a | 12 | const std::string exitMsg = "emtech"; |
Mike Fiore |
1:f155d94d6f3a | 13 | |
Mike Fiore |
1:f155d94d6f3a | 14 | /** This class provides terminal style access to a serial interface on the |
Mike Fiore |
1:f155d94d6f3a | 15 | * processor. This is done by seamlessly "connecting" the data traffic between the |
Mike Fiore |
1:f155d94d6f3a | 16 | * mbed debug interface, usually accessed through the USB port, and the serial |
Mike Fiore |
1:f155d94d6f3a | 17 | * interface in question. Once started you can also exit this mode by sending the |
Mike Fiore |
1:f155d94d6f3a | 18 | * appropraite exit sequence through your terminal program. This sequence is: emtech |
Mike Fiore |
1:f155d94d6f3a | 19 | */ |
Mike Fiore |
1:f155d94d6f3a | 20 | class Terminal |
Mike Fiore |
1:f155d94d6f3a | 21 | { |
Mike Fiore |
1:f155d94d6f3a | 22 | public: |
Mike Fiore |
1:f155d94d6f3a | 23 | /** This constructs a Terminal object that connects the standard |
Mike Fiore |
1:f155d94d6f3a | 24 | * mbed USB serial inteface to the passed in serial interface. In |
Mike Fiore |
1:f155d94d6f3a | 25 | * odrder for this class to function you must call the start method. |
Mike Fiore |
1:f155d94d6f3a | 26 | * |
Mike Fiore |
1:f155d94d6f3a | 27 | * @param io the serial interface to connect to the console as an |
Mike Fiore |
1:f155d94d6f3a | 28 | * MTSBufferedIO object. |
Mike Fiore |
1:f155d94d6f3a | 29 | */ |
Mike Fiore |
1:f155d94d6f3a | 30 | Terminal(MTSBufferedIO* io); |
Mike Fiore |
1:f155d94d6f3a | 31 | |
Mike Fiore |
1:f155d94d6f3a | 32 | /** Destructs an Terminal object and frees all created resources. |
Mike Fiore |
1:f155d94d6f3a | 33 | */ |
Mike Fiore |
1:f155d94d6f3a | 34 | ~Terminal(); |
Mike Fiore |
1:f155d94d6f3a | 35 | |
Mike Fiore |
1:f155d94d6f3a | 36 | /** This starts the terminal functionality and is a blocking call |
Mike Fiore |
1:f155d94d6f3a | 37 | * until you send the exit sequence "emtech" through you terminal |
Mike Fiore |
1:f155d94d6f3a | 38 | * program, at which point this method returns. |
Mike Fiore |
1:f155d94d6f3a | 39 | */ |
Mike Fiore |
1:f155d94d6f3a | 40 | void start(); |
Mike Fiore |
1:f155d94d6f3a | 41 | |
Mike Fiore |
1:f155d94d6f3a | 42 | private: |
Mike Fiore |
1:f155d94d6f3a | 43 | MTSBufferedIO* io; //The interface you want terminal access to |
Mike Fiore |
1:f155d94d6f3a | 44 | MTSSerial* terminal; //The interface to the console or terminal |
Mike Fiore |
1:f155d94d6f3a | 45 | int index; //The index you are at with the exit sequence |
Mike Fiore |
1:f155d94d6f3a | 46 | }; |
Mike Fiore |
1:f155d94d6f3a | 47 | |
Mike Fiore |
1:f155d94d6f3a | 48 | } |
Mike Fiore |
1:f155d94d6f3a | 49 | |
Mike Fiore |
1:f155d94d6f3a | 50 | #endif /* TERMINAL_H */ |