From 5c2dad3577a1a8e77bef05864ef351d1243715c7 Mon Sep 17 00:00:00 2001 From: ValMobBIllich <120391217+ValMobBIllich@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:17:26 +0100 Subject: [PATCH 1/4] added support for threadx --- src/lib.rs | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 1e36caf..e8223b1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -361,25 +361,30 @@ impl UPClientMqtt { .get_int(mqtt::PropertyCode::SubscriptionIdentifier); // Get attributes from mqtt header. - let uattributes = { - match UPClientMqtt::get_uattributes_from_mqtt_properties(msg.properties()) { - Ok(uattributes) => uattributes, - Err(e) => { - warn!("Unable to get UAttributes from mqtt properties: {}", e); - continue; + let umessage = if msg.properties().is_empty() { + protobuf::Message::parse_from_bytes(msg.payload()).unwrap() + } else { + let uattributes = { + match UPClientMqtt::get_uattributes_from_mqtt_properties(msg.properties()) { + Ok(uattributes) => uattributes, + Err(e) => { + warn!("Unable to get UAttributes from mqtt properties: {}", e); + continue; + } } + }; + + let payload = msg.payload(); + let upayload = payload.to_vec(); + + // Create UMessage from UAttributes and UPayload. + UMessage { + attributes: Some(uattributes).into(), + payload: Some(upayload.into()), + ..Default::default() } }; - - let payload = msg.payload(); - let upayload = payload.to_vec(); - - // Create UMessage from UAttributes and UPayload. - let umessage = UMessage { - attributes: Some(uattributes).into(), - payload: Some(upayload.into()), - ..Default::default() - }; + let topic_map_read = topic_map.read().await; let subscription_map_read = subscription_map.read().await; From 373ccaba8b4465027552ca49c5e2a118c78edf49 Mon Sep 17 00:00:00 2001 From: ValMobBIllich <120391217+ValMobBIllich@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:27:41 +0100 Subject: [PATCH 2/4] fixed something --- src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index e8223b1..bb99e00 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -361,7 +361,8 @@ impl UPClientMqtt { .get_int(mqtt::PropertyCode::SubscriptionIdentifier); // Get attributes from mqtt header. - let umessage = if msg.properties().is_empty() { + let umessage = if UPClientMqtt::get_uattributes_from_mqtt_properties(msg.properties()).is_err() { + debug!("empty properties"); protobuf::Message::parse_from_bytes(msg.payload()).unwrap() } else { let uattributes = { From 55723e6bc55158982c63a414b1da11a29e17b479 Mon Sep 17 00:00:00 2001 From: ValMobBIllich <120391217+ValMobBIllich@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:30:29 +0100 Subject: [PATCH 3/4] added a lot --- src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index bb99e00..2dabe30 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -360,9 +360,11 @@ impl UPClientMqtt { .properties() .get_int(mqtt::PropertyCode::SubscriptionIdentifier); + info!("this is the correct version"); // Get attributes from mqtt header. let umessage = if UPClientMqtt::get_uattributes_from_mqtt_properties(msg.properties()).is_err() { debug!("empty properties"); + panic!(); protobuf::Message::parse_from_bytes(msg.payload()).unwrap() } else { let uattributes = { From fbe4242f75e7320ee6eb08d68cd76d52455254eb Mon Sep 17 00:00:00 2001 From: ValMobBIllich <120391217+ValMobBIllich@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:36:56 +0100 Subject: [PATCH 4/4] fixed an issue --- src/lib.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 2dabe30..bb99e00 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -360,11 +360,9 @@ impl UPClientMqtt { .properties() .get_int(mqtt::PropertyCode::SubscriptionIdentifier); - info!("this is the correct version"); // Get attributes from mqtt header. let umessage = if UPClientMqtt::get_uattributes_from_mqtt_properties(msg.properties()).is_err() { debug!("empty properties"); - panic!(); protobuf::Message::parse_from_bytes(msg.payload()).unwrap() } else { let uattributes = {