update firmware.bin
[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 "Module.h"
13
14 #include <functional>
15 #include <string>
16 using std::string;
17
18 class StreamOutput;
19
20 class SimpleShell : public Module
21 {
22 public:
23 SimpleShell() {}
24
25 void on_module_loaded();
26 void on_console_line_received( void *argument );
27 void on_gcode_received(void *argument);
28 void on_second_tick(void *);
29
30 private:
31 static void ls_command(string parameters, StreamOutput *stream );
32 static void cd_command(string parameters, StreamOutput *stream );
33 static void delete_file_command(string parameters, StreamOutput *stream );
34 static void pwd_command(string parameters, StreamOutput *stream );
35 static void cat_command(string parameters, StreamOutput *stream );
36 static void rm_command(string parameters, StreamOutput *stream );
37 static void mv_command(string parameters, StreamOutput *stream );
38 static void upload_command(string parameters, StreamOutput *stream );
39 static void break_command(string parameters, StreamOutput *stream );
40 static void reset_command(string parameters, StreamOutput *stream );
41 static void dfu_command(string parameters, StreamOutput *stream );
42 static void help_command(string parameters, StreamOutput *stream );
43 static void version_command(string parameters, StreamOutput *stream );
44 static void get_command(string parameters, StreamOutput *stream );
45 static void set_temp_command(string parameters, StreamOutput *stream );
46 static void switch_command(string parameters, StreamOutput *stream );
47 static void mem_command(string parameters, StreamOutput *stream );
48
49 static void net_command( string parameters, StreamOutput *stream);
50
51 static void load_command( string parameters, StreamOutput *stream);
52 static void save_command( string parameters, StreamOutput *stream);
53
54 static void remount_command( string parameters, StreamOutput *stream);
55
56 bool parse_command(const char *cmd, string args, StreamOutput *stream);
57
58 typedef void (*PFUNC)(string parameters, StreamOutput *stream);
59 typedef struct {
60 const char *command;
61 const PFUNC func;
62 } const ptentry_t;
63
64 static const ptentry_t commands_table[];
65 static int reset_delay_secs;
66 };
67
68
69 #endif