-/*
+/*
This file is part of Smoothie (http://smoothieware.org/). The motion control part is heavily based on Grbl (https://github.com/simen/grbl).
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.
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.
- You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
+ You should have received a copy of the GNU General Public License along with Smoothie. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CONFIG_H
#define CONFIG_H
-#include "mbed.h"
-#include "libs/Kernel.h"
+
+#include "ConfigCache.h"
+
+using namespace std;
+#include <vector>
#include <string>
-using std::string;
-#define config_get_checksum 46310
-#define config_set_checksum 55538
-#define config_load_checksum 3143
+#define LOCAL_CONFIGSOURCE_CHECKSUM 13581
+#define SD_CONFIGSOURCE_CHECKSUM 19415
+
+class ConfigValue;
+class ConfigSource;
class Config : public Module {
public:
void on_module_loaded();
void on_console_line_received( void* argument );
- void config_get_command( string parameters );
- void config_set_command( string parameters );
- void set_string( uint16_t check_sum, string value);
- string get_string(uint16_t check_sum);
- double get(uint16_t check_sum);
- string get_config_file();
- void try_config_file(string candidate);
-
- string config_file; // Path to the config file
- bool config_file_found; // Wether or not the config file's location is known
+ void config_cache_load();
+ void config_cache_clear();
+ void set_string( string setting , string value);
+
+ ConfigValue* value(uint16_t check_sum);
+ ConfigValue* value(uint16_t check_sum_a, uint16_t check_sum_b);
+ ConfigValue* value(uint16_t check_sum_a, uint16_t check_sum_b, uint16_t check_sum_c );
+ ConfigValue* value(uint16_t check_sums[3] );
+
+ void get_module_list(vector<uint16_t>* list, uint16_t family);
+
+ bool has_characters(uint16_t check_sum, string str );
+
+ ConfigCache config_cache; // A cache in which ConfigValues are kept
+ vector<ConfigSource*> config_sources; // A list of all possible coniguration sources
+ bool config_cache_loaded; // Whether or not the cache is currently popluated
};
#endif