Merge pull request #294 from wolfmanjm/upstreamedge
[clinton/Smoothieware.git] / src / modules / utils / simpleshell / SimpleShell.h
1 /*
2 This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
3 Smoothie is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
4 Smoothie is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
6 */
7
8
9 #ifndef simpleshell_h
10 #define simpleshell_h
11
12 #include "libs/Kernel.h"
13 #include "libs/nuts_bolts.h"
14 #include "libs/utils.h"
15 #include "libs/StreamOutput.h"
16
17 class SimpleShell : public Module
18 {
19 public:
20 SimpleShell() {}
21
22 void on_module_loaded();
23 void on_console_line_received( void *argument );
24 void on_gcode_received(void *argument);
25 void on_second_tick(void *);
26
27 private:
28 string absolute_from_relative( string path );
29 void ls_command(string parameters, StreamOutput *stream );
30 void cd_command(string parameters, StreamOutput *stream );
31 void delete_file_command(string parameters, StreamOutput *stream );
32 void pwd_command(string parameters, StreamOutput *stream );
33 void cat_command(string parameters, StreamOutput *stream );
34 void rm_command(string parameters, StreamOutput *stream );
35 void break_command(string parameters, StreamOutput *stream );
36 void reset_command(string parameters, StreamOutput *stream );
37 void dfu_command(string parameters, StreamOutput *stream );
38 void help_command(string parameters, StreamOutput *stream );
39 void version_command(string parameters, StreamOutput *stream );
40 void get_command(string parameters, StreamOutput *stream );
41 void set_temp_command(string parameters, StreamOutput *stream );
42 void mem_command(string parameters, StreamOutput *stream );
43 void test_command(string parameters, StreamOutput *stream );
44
45 bool parse_command(unsigned short cs, string args, StreamOutput *stream);
46
47 typedef void (SimpleShell::*PFUNC)(string parameters, StreamOutput *stream);
48 typedef struct {
49 unsigned short command_cs;
50 PFUNC pfunc;
51 } ptentry_t;
52
53 static ptentry_t commands_table[];
54 string current_path;
55 int reset_delay_secs;
56 };
57
58
59 #endif