blob: 9b3ee5b44108dc0bca7d9a613e182e121b3873e8 [file] [log] [blame]
Niko Sohmers3860f8a2024-01-12 21:05:19 -08001#include "aos/events/simulated_event_loop.h"
2#include "aos/testing/path.h"
3#include "frc971/constants/constants_sender_lib.h"
4#include "y2024/constants/constants_generated.h"
5#include "y2024/constants/constants_list_generated.h"
6
7namespace y2024 {
8bool SendSimulationConstants(aos::SimulatedEventLoopFactory *factory, int team,
James Kuszmaulec0c96b2024-03-17 17:24:35 -07009 std::string constants_path,
10 const std::set<std::string_view> &node_names) {
Niko Sohmers3860f8a2024-01-12 21:05:19 -080011 for (const aos::Node *node : factory->nodes()) {
James Kuszmaulec0c96b2024-03-17 17:24:35 -070012 if (!node_names.empty() &&
13 !node_names.contains(node->name()->string_view())) {
14 continue;
15 }
Niko Sohmers3860f8a2024-01-12 21:05:19 -080016 std::unique_ptr<aos::EventLoop> event_loop =
17 factory->MakeEventLoop("constants_sender", node);
18 frc971::constants::ConstantSender<Constants, ConstantsList> sender(
19 event_loop.get(), constants_path, team, "/constants");
20 }
21 return true;
22}
23} // namespace y2024