some changes at events
This commit is contained in:
@@ -50,19 +50,25 @@ void InputDriverFactory::create_input_events(json matrix_config, std::vector<std
|
||||
std::map<std::string, std::shared_ptr<Event>>& name_event_map,
|
||||
std::shared_ptr<IEventNotifier> event_notifier)
|
||||
{
|
||||
int global_bounce_time = matrix_config.at("global_bounce_time").get<json::number_integer_t>();
|
||||
auto& event_array = matrix_config.at("input_matrix");
|
||||
for (auto &json_event : event_array)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
std::string name = json_event.at("name");
|
||||
char address = json_event.at("address").get<json::number_integer_t>();
|
||||
int priority = json_event.at("priority").get<json::number_integer_t>();
|
||||
int deactivation_time = json_event.at("deactivation_time").get<json::number_integer_t>();
|
||||
int bounce_time = global_bounce_time;
|
||||
|
||||
auto it_bounce_time = json_event.find("bounce_time");
|
||||
if (it_bounce_time != json_event.end())
|
||||
{
|
||||
bounce_time = it_bounce_time->get<json::number_integer_t>();
|
||||
}
|
||||
|
||||
std::shared_ptr<DistributingEvent> event_ptr(new DistributingEvent(address, priority, name,
|
||||
std::chrono::milliseconds(deactivation_time), event_notifier));
|
||||
std::chrono::milliseconds(bounce_time), event_notifier));
|
||||
|
||||
events.push_back(event_ptr);
|
||||
name_event_map.emplace(name, event_ptr);
|
||||
@@ -76,4 +82,4 @@ void InputDriverFactory::create_input_events(json matrix_config, std::vector<std
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user