![](/media/cache/group/Espotel.jpg.50x50_q85.jpg)
Elmo Terminal provides functionality to test Lora radio and access SX1272 chip registers delivered with Elmo board. This firmware allows the user to control the LoRa radio parameters (eg. frequency, bandwidth, spreading factor etc.) by entering console commands via serial terminal. Application also contains "Ping-Pong" and data transmission functionalities.
Fork of Elmo-Terminal by
Commands/Cmd.h@2:8d8295a51f68, 2015-10-01 (annotated)
- Committer:
- WGorniak
- Date:
- Thu Oct 01 09:40:30 2015 +0200
- Revision:
- 2:8d8295a51f68
added terminal app
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
WGorniak | 2:8d8295a51f68 | 1 | #ifndef _CMD_H_ |
WGorniak | 2:8d8295a51f68 | 2 | #define _CMD_H_ |
WGorniak | 2:8d8295a51f68 | 3 | |
WGorniak | 2:8d8295a51f68 | 4 | #include <list> |
WGorniak | 2:8d8295a51f68 | 5 | #include <string> |
WGorniak | 2:8d8295a51f68 | 6 | using namespace std; |
WGorniak | 2:8d8295a51f68 | 7 | |
WGorniak | 2:8d8295a51f68 | 8 | /** Terminal Command |
WGorniak | 2:8d8295a51f68 | 9 | */ |
WGorniak | 2:8d8295a51f68 | 10 | class Cmd |
WGorniak | 2:8d8295a51f68 | 11 | { |
WGorniak | 2:8d8295a51f68 | 12 | public: |
WGorniak | 2:8d8295a51f68 | 13 | /** Process status |
WGorniak | 2:8d8295a51f68 | 14 | * |
WGorniak | 2:8d8295a51f68 | 15 | * Used to notify main loop if another pass is needed |
WGorniak | 2:8d8295a51f68 | 16 | */ |
WGorniak | 2:8d8295a51f68 | 17 | enum Status |
WGorniak | 2:8d8295a51f68 | 18 | { |
WGorniak | 2:8d8295a51f68 | 19 | CONTINUE, |
WGorniak | 2:8d8295a51f68 | 20 | EXIT |
WGorniak | 2:8d8295a51f68 | 21 | }; |
WGorniak | 2:8d8295a51f68 | 22 | |
WGorniak | 2:8d8295a51f68 | 23 | |
WGorniak | 2:8d8295a51f68 | 24 | /** Construtor |
WGorniak | 2:8d8295a51f68 | 25 | */ |
WGorniak | 2:8d8295a51f68 | 26 | Cmd(); |
WGorniak | 2:8d8295a51f68 | 27 | |
WGorniak | 2:8d8295a51f68 | 28 | /** Destructor |
WGorniak | 2:8d8295a51f68 | 29 | */ |
WGorniak | 2:8d8295a51f68 | 30 | virtual ~Cmd(); |
WGorniak | 2:8d8295a51f68 | 31 | |
WGorniak | 2:8d8295a51f68 | 32 | /** Execute command |
WGorniak | 2:8d8295a51f68 | 33 | * |
WGorniak | 2:8d8295a51f68 | 34 | * @param args args from terminal (without cmd() part) |
WGorniak | 2:8d8295a51f68 | 35 | * |
WGorniak | 2:8d8295a51f68 | 36 | * @returns all ok |
WGorniak | 2:8d8295a51f68 | 37 | * |
WGorniak | 2:8d8295a51f68 | 38 | * Can be used for commands without process part (or as a preamble to process) |
WGorniak | 2:8d8295a51f68 | 39 | */ |
WGorniak | 2:8d8295a51f68 | 40 | virtual bool execute(list<string> args) = 0; |
WGorniak | 2:8d8295a51f68 | 41 | |
WGorniak | 2:8d8295a51f68 | 42 | |
WGorniak | 2:8d8295a51f68 | 43 | /** Main loop for command |
WGorniak | 2:8d8295a51f68 | 44 | * |
WGorniak | 2:8d8295a51f68 | 45 | * @returns CONTINUE - process will be called again, EXIT - forced exit |
WGorniak | 2:8d8295a51f68 | 46 | * |
WGorniak | 2:8d8295a51f68 | 47 | * Long commands can be interrupted outside of process. |
WGorniak | 2:8d8295a51f68 | 48 | */ |
WGorniak | 2:8d8295a51f68 | 49 | virtual Status process(); |
WGorniak | 2:8d8295a51f68 | 50 | |
WGorniak | 2:8d8295a51f68 | 51 | |
WGorniak | 2:8d8295a51f68 | 52 | virtual string getResponse(void) = 0; |
WGorniak | 2:8d8295a51f68 | 53 | bool queryable(); |
WGorniak | 2:8d8295a51f68 | 54 | |
WGorniak | 2:8d8295a51f68 | 55 | |
WGorniak | 2:8d8295a51f68 | 56 | |
WGorniak | 2:8d8295a51f68 | 57 | /** Mnemonic |
WGorniak | 2:8d8295a51f68 | 58 | * |
WGorniak | 2:8d8295a51f68 | 59 | * @returns mnemonic |
WGorniak | 2:8d8295a51f68 | 60 | * |
WGorniak | 2:8d8295a51f68 | 61 | * @see CmdFactory |
WGorniak | 2:8d8295a51f68 | 62 | * @see CmdHelp |
WGorniak | 2:8d8295a51f68 | 63 | */ |
WGorniak | 2:8d8295a51f68 | 64 | static string cmd(); |
WGorniak | 2:8d8295a51f68 | 65 | |
WGorniak | 2:8d8295a51f68 | 66 | /** Description |
WGorniak | 2:8d8295a51f68 | 67 | * |
WGorniak | 2:8d8295a51f68 | 68 | * @returns short description |
WGorniak | 2:8d8295a51f68 | 69 | * |
WGorniak | 2:8d8295a51f68 | 70 | * @see CmdHelp |
WGorniak | 2:8d8295a51f68 | 71 | */ |
WGorniak | 2:8d8295a51f68 | 72 | static string desc(); |
WGorniak | 2:8d8295a51f68 | 73 | |
WGorniak | 2:8d8295a51f68 | 74 | protected: |
WGorniak | 2:8d8295a51f68 | 75 | |
WGorniak | 2:8d8295a51f68 | 76 | bool queryable_; |
WGorniak | 2:8d8295a51f68 | 77 | }; |
WGorniak | 2:8d8295a51f68 | 78 | |
WGorniak | 2:8d8295a51f68 | 79 | #endif |