Merge pull request #125 from arthurwolf/fix/NullStream
[clinton/Smoothieware.git] / src / modules / utils / player / Player.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 PLAYER_H
10 #define PLAYER_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
18 #define play_command_checksum CHECKSUM("play")
19 #define progress_command_checksum CHECKSUM("progress")
20 #define abort_command_checksum CHECKSUM("abort")
21 #define cd_command_checksum CHECKSUM("cd")
22 #define on_boot_gcode_checksum CHECKSUM("on_boot_gcode")
23 #define on_boot_gcode_enable_checksum CHECKSUM("on_boot_gcode_enable")
24
25 class Player : public Module {
26 public:
27 Player(){}
28
29 void on_module_loaded();
30 void on_console_line_received( void* argument );
31 void on_main_loop( void* argument );
32 string absolute_from_relative( string path );
33 void cd_command( string parameters, StreamOutput* stream );
34 void play_command( string parameters, StreamOutput* stream );
35 void progress_command( string parameters, StreamOutput* stream );
36 void abort_command( string parameters, StreamOutput* stream );
37
38 string current_path;
39
40 bool on_boot_enable;
41 bool booted;
42 string on_boot_file_name;
43 bool playing_file;
44 StreamOutput* current_stream;
45 FILE* current_file_handler;
46 long file_size, played_cnt;
47 };
48
49 #endif // PLAYER_H