zmq url as cli arg

This commit is contained in:
Ruben van de Ven 2025-07-11 15:13:47 +02:00
parent 32590c201e
commit fbfea9d575

View file

@ -118,9 +118,9 @@ impl Default for LaserSettings {
}
fn setup_zmq() -> Socket{
fn setup_zmq(url: &String) -> Socket{
// let url = "tcp://100.109.175.82:99174";
let url = "tcp://127.0.0.1:99174";
// let url = "tcp://127.0.0.1:99174";
let context = zmq::Context::new();
let subscriber = context.socket(zmq::SUB).unwrap();
subscriber.set_conflate(true).unwrap(); // only keep latest entry
@ -283,6 +283,9 @@ fn get_dac_configs() -> DacConfigMap{
}
fn model(app: &App) -> GuiModel {
let args: Vec<String> = std::env::args().collect();
let zmq_url = &args[1];
// Create a window to receive keyboard events.
let w_id_lasersettings = app
.new_window()
@ -320,7 +323,7 @@ fn model(app: &App) -> GuiModel {
// Initialise the state that we want to live on the laser thread and spawn the stream.
let laser_settings = LaserSettings::default();
let laser_model = LaserModel::new();
let zmq = setup_zmq();
let zmq = setup_zmq(zmq_url);
// TODO Implement `Clone` for `Api` so that we don't have to `Arc` it.
let laser_api = Arc::new(laser::Api::new());