refactor ON_HALT, add THEKERNEL->is_halted() for modules that just need to test it...
[clinton/Smoothieware.git] / src / modules / utils / player / Player.h
CommitLineData
663d7943
L
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
9ef9c12a 12#include "Module.h"
663d7943 13
9ef9c12a
JM
14#include <stdio.h>
15#include <string>
02e4b295
JM
16#include <map>
17#include <vector>
9ef9c12a
JM
18using std::string;
19
20class StreamOutput;
663d7943
L
21
22class Player : public Module {
23 public:
02e4b295 24 Player();
663d7943
L
25
26 void on_module_loaded();
27 void on_console_line_received( void* argument );
28 void on_main_loop( void* argument );
63888663 29 void on_second_tick(void* argument);
35089dc7
JM
30 void on_get_public_data(void* argument);
31 void on_set_public_data(void* argument);
c4e56997 32 void on_gcode_received(void *argument);
75f4581c
JM
33
34 private:
663d7943 35 void play_command( string parameters, StreamOutput* stream );
addfb453
L
36 void progress_command( string parameters, StreamOutput* stream );
37 void abort_command( string parameters, StreamOutput* stream );
02e4b295
JM
38 void suspend_command( string parameters, StreamOutput* stream );
39 void resume_command( string parameters, StreamOutput* stream );
428d1181 40 string extract_options(string& args);
0f11f650 41 void suspend_part2();
663d7943 42
e2cd3423 43 string filename;
d467fcad
JM
44 string after_suspend_gcode;
45 string before_resume_gcode;
7a42f8a2 46 string on_boot_gcode;
663d7943 47 StreamOutput* current_stream;
c4e56997 48 StreamOutput* reply_stream;
0f11f650
JM
49 StreamOutput* suspend_stream;
50
663d7943 51 FILE* current_file_handler;
be6a1e19
DM
52 long file_size;
53 unsigned long played_cnt;
54 unsigned long elapsed_secs;
02e4b295 55 float saved_position[3];
02e4b295
JM
56 float saved_feed_rate;
57 std::map<uint16_t, float> saved_temperatures;
4c09283b
JM
58 struct {
59 bool on_boot_gcode_enable:1;
60 bool booted:1;
61 bool playing_file:1;
02e4b295
JM
62 bool suspended:1;
63 bool saved_inch_mode:1;
64 bool saved_absolute_mode:1;
65 bool was_playing_file:1;
f6fc8c0d 66 bool leave_heaters_on:1;
0f11f650 67 uint8_t suspend_loops:4;
f6fc8c0d 68
4c09283b 69 };
663d7943
L
70};
71
72#endif // PLAYER_H