diff --git a/Cargo.lock b/Cargo.lock index ff026ff..13c7828 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -203,7 +203,6 @@ dependencies = [ [[package]] name = "derive_miniconf" version = "0.1.0" -source = "git+https://github.com/quartiq/miniconf.git?branch=feature/mqtt-removal#6b6b9d7973ac5b4771c211c775c51f82d4a7727f" dependencies = [ "proc-macro2", "quote", @@ -416,10 +415,10 @@ dependencies = [ [[package]] name = "miniconf" version = "0.1.0" -source = "git+https://github.com/quartiq/miniconf.git?branch=feature/mqtt-removal#6b6b9d7973ac5b4771c211c775c51f82d4a7727f" dependencies = [ "derive_miniconf", "heapless 0.6.1", + "minimq", "serde", "serde-json-core", ] diff --git a/Cargo.toml b/Cargo.toml index db89ef5..00ba5c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,7 +44,7 @@ paste = "1" dsp = { path = "dsp" } ad9959 = { path = "ad9959" } generic-array = "0.14" -miniconf = "0.1.0" +miniconf = { version = "0.1.0", features = ["minimq-support"] } [dependencies.mcp23017] git = "https://github.com/mrd0ll4r/mcp23017.git" @@ -55,8 +55,13 @@ features = ["stm32h743v", "rt", "unproven", "ethernet", "quadspi"] version = "0.9.0" [patch.crates-io.miniconf] -git = "https://github.com/quartiq/miniconf.git" -branch = "feature/mqtt-removal" +path = "../miniconf" +# git = "https://github.com/quartiq/miniconf.git" +# branch = "feature/mqtt-removal" + +[patch.crates-io.minimq] +git = "https://github.com/quartiq/minimq.git" +rev = "933687c2e4b" [dependencies.smoltcp-nal] git = "https://github.com/quartiq/smoltcp-nal.git" diff --git a/src/net/mod.rs b/src/net/mod.rs index e2398b8..de55d1a 100644 --- a/src/net/mod.rs +++ b/src/net/mod.rs @@ -116,31 +116,10 @@ where // Handle any MQTT traffic. match self.mqtt.borrow_mut().poll( |client, topic, message, properties| { - // Find correlation-data and response topics. - let correlation_data = properties.iter().find_map(|prop| { - if let minimq::Property::CorrelationData(data) = prop { - Some(*data) - } else { - None - } - }); - let response_topic = properties.iter().find_map(|prop| { - if let minimq::Property::ResponseTopic(topic) = prop { - Some(*topic) - } else { - None - } - }); - - let incoming = miniconf::Message { - data: message, - correlation_data, - response_topic, - }; - - if let Some(response) = - self.miniconf.borrow_mut().process(topic, incoming) - { + if let Some(response) = self.miniconf.borrow_mut().process( + topic, + miniconf::Message::from(message, properties), + ) { let mut response_properties: Vec< minimq::Property, consts::U1,