32 const boost::property_tree::ptree &cfg,
35 , kernel_sock_(ctx,
zmqpp::socket_type::req)
36 , sub_(ctx,
zmqpp::socket_type::sub)
38 , test_buzzer_(nullptr)
42 sub_.connect(
"inproc://zmq-bus-pub");
53 boost::property_tree::ptree module_config =
config_.get_child(
"module_config");
54 std::string test_device_led = module_config.get<std::string>(
"test_led",
"");
55 std::string test_device_buzzer =
56 module_config.get<std::string>(
"test_buzzer",
"");
57 run_on_start_ = module_config.get<
bool>(
"run_on_start",
true);
58 promisc_ = module_config.get<
bool>(
"promisc",
false);
59 const auto &devices = module_config.get_child_optional(
"devices");
61 if (!test_device_led.empty())
63 if (!test_device_buzzer.empty())
68 for (
auto &node : module_config.get_child(
"devices"))
70 boost::property_tree::ptree device_cfg = node.second;
72 std::string device_name = device_cfg.get_child(
"name").data();
74 std::string reset_card = device_cfg.get<std::string>(
"reset_card",
"");
75 std::string test_card = device_cfg.get<std::string>(
"test_card",
"");
77 sub_.subscribe(
"S_" + device_name);
78 if (!reset_card.empty())
80 if (!test_card.empty())
87 std::string reset_card = module_config.get<std::string>(
"reset_card");
104 msg >> src >> type >> card;
108 ERROR(
"Invalid auth source type ! Doing nothing.");
120 src = src.substr(2, src.size());
129 INFO(
"Test card read.");
136 DEBUG(
"Running test sequence...");
147 INFO(
"Test sequence doing nothing...");
154 [&](std::pair<std::string, std::string> p) ->
bool {
155 return p.second == card_id;