Remove deprecated query format
[clinton/Smoothieware.git] / src / libs / Kernel.h
CommitLineData
df27a6a3 1/*
4cff3ded
AW
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.
df27a6a3 5 You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
4cff3ded
AW
6*/
7
8#ifndef KERNEL_H
9#define KERNEL_H
4cff3ded 10
879341be 11#define THEKERNEL Kernel::instance
f6542ad9 12#define THECONVEYOR THEKERNEL->conveyor
c8bac202 13#define THEROBOT THEKERNEL->robot
879341be 14
61134a65
JM
15#include "Module.h"
16#include <array>
17#include <vector>
e0d0ea84 18#include <string>
61134a65 19
4cff3ded 20//Module manager
a0e79e9b 21class Config;
4cff3ded 22class Module;
3fceb8eb 23class Conveyor;
d9ebc974 24class SlowTicker;
61134a65
JM
25class SerialConsole;
26class StreamOutputPool;
27class GcodeDispatch;
28class Robot;
61134a65 29class Planner;
61134a65
JM
30class StepTicker;
31class Adc;
32class PublicData;
3e54c9fc
JM
33class SimpleShell;
34class Configurator;
43b1a6e8 35
4cff3ded
AW
36class Kernel {
37 public:
38 Kernel();
879341be 39 static Kernel* instance; // the Singleton instance of Kernel usable anywhere
33e4cc02 40 const char* config_override_filename(){ return "/sd/config-override"; }
35089dc7 41
4cff3ded 42 void add_module(Module* module);
96f67b65 43 void register_for_event(_EVENT_ENUM id_event, Module *module);
93ea6adb
JM
44 void call_event(_EVENT_ENUM id_event, void * argument= nullptr);
45
a3be54e3 46 bool kernel_has_event(_EVENT_ENUM id_event, Module *module);
93ea6adb 47 void unregister_for_event(_EVENT_ENUM id_event, Module *module);
4cff3ded 48
73706276
JM
49 bool is_using_leds() const { return use_leds; }
50 bool is_halted() const { return halted; }
6c0193b3 51 bool is_grbl_mode() const { return grbl_mode; }
7d04f42d 52 bool is_ok_per_line() const { return ok_per_line; }
6c0193b3 53
0de4d6b0
JM
54 void set_feed_hold(bool f) { feed_hold= f; }
55 bool get_feed_hold() const { return feed_hold; }
4b7cd602 56 bool is_feed_hold_enabled() const { return enable_feed_hold; }
17aca3f2 57
dcc91612 58 std::string get_query_string();
73706276 59
76217df5 60 // These modules are available to all other modules
4cff3ded 61 SerialConsole* serial;
df27a6a3 62 StreamOutputPool* streams;
40843ebc 63 GcodeDispatch* gcode_dispatch;
4cff3ded 64 Robot* robot;
4cff3ded
AW
65 Planner* planner;
66 Config* config;
663d7943 67 Conveyor* conveyor;
3e54c9fc
JM
68 Configurator* configurator;
69 SimpleShell* simpleshell;
4cff3ded 70
3c132bd0
AW
71 SlowTicker* slow_ticker;
72 StepTicker* step_ticker;
73 Adc* adc;
e0d0ea84 74 std::string current_path;
a157d099 75 uint32_t base_stepping_frequency;
f29b0272 76
4cff3ded 77 private:
e0d0ea84 78 // When a module asks to be called for a specific event ( a hook ), this is where that request is remembered
96f67b65 79 std::array<std::vector<Module*>, NUMBER_OF_DEFINED_EVENTS> hooks;
73706276
JM
80 struct {
81 bool use_leds:1;
82 bool halted:1;
6c0193b3 83 bool grbl_mode:1;
17aca3f2 84 bool feed_hold:1;
7d04f42d 85 bool ok_per_line:1;
4b7cd602 86 bool enable_feed_hold:1;
73706276 87 };
4cff3ded
AW
88
89};
90
91#endif