// A complete GEM tool in ~30 lines of C++ — the twin of // clients/python/examples/mini_tool.py. Run secs_gemd, then this. #include #include #include #include #include "secsgem_client/equipment.hpp" int main() { secsgem_client::Equipment eq("localhost:50051"); eq.on("START", [&](const secsgem_client::Command& cmd) { std::cout << "host says START (id " << cmd.id << ")\n"; eq.fire("ProcessStarted"); }); eq.listen_async(); std::mt19937 rng{std::random_device{}()}; std::uniform_real_distribution pressure(1.0, 3.0); while (true) { const double p = pressure(rng); eq.set("ChamberPressure", p); if (p > 2.9) eq.alarm("chiller_temp_high"); else eq.clear("chiller_temp_high"); std::this_thread::sleep_for(std::chrono::seconds(1)); } }