dunno
This commit is contained in:
@@ -24,6 +24,7 @@ class InputFactory
|
|||||||
public:
|
public:
|
||||||
static std::shared_ptr<Detector> get_detector(std::string& input_config_path, std::string& matrix_config_path)
|
static std::shared_ptr<Detector> get_detector(std::string& input_config_path, std::string& matrix_config_path)
|
||||||
{
|
{
|
||||||
|
// todo this in gpiointerface
|
||||||
std::ifstream input_config_stream(input_config_path);
|
std::ifstream input_config_stream(input_config_path);
|
||||||
json input_config;
|
json input_config;
|
||||||
input_config << input_config_stream;
|
input_config << input_config_stream;
|
||||||
@@ -32,19 +33,20 @@ public:
|
|||||||
json matrix_config;
|
json matrix_config;
|
||||||
matrix_config << matrix_config_stream;
|
matrix_config << matrix_config_stream;
|
||||||
|
|
||||||
std::vector<InputEvent> input_events = create_input_events(matrix_config);
|
std::map<char, InputEvent> input_events = create_input_events(matrix_config);
|
||||||
|
|
||||||
return std::shared_ptr<Detector>(Detector(input_config, input_events));
|
return std::shared_ptr<Detector>(Detector(input_config, input_events));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::vector<InputEvent> create_input_events(json matrix_config)
|
static std::map<char, InputEvent> create_input_events(json matrix_config)
|
||||||
{
|
{
|
||||||
std::vector<InputEvent> input_events;
|
std::map<char, InputEvent> input_events;
|
||||||
|
|
||||||
for(auto& key : matrix_config)
|
for(auto& key : matrix_config)
|
||||||
{
|
{
|
||||||
InputEvent event(matrix_config[key], key);
|
InputEvent event(matrix_config[key], key);
|
||||||
|
input_events.emplace(key, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
return input_events;
|
return input_events;
|
||||||
|
|||||||
@@ -30,7 +30,8 @@ public:
|
|||||||
void read_pin();
|
void read_pin();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// todo some mapping class interface shit that a user can ask for what is actually usable
|
// todo some mapping class interface shit that a user can ask for what is actually usable \
|
||||||
|
something like: A has gpio interface at gpio -> gpio.input.column. just dont work with strings
|
||||||
private:
|
private:
|
||||||
json config;
|
json config;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user