Skip to content

Commit

Permalink
Merge pull request #16 from PLeVasseur/feature/update-to-up-rust-0.3.0
Browse files Browse the repository at this point in the history
Update up-rust to 0.3.0 and bump own version to prepare for release.
  • Loading branch information
PLeVasseur authored Dec 16, 2024
2 parents e679aa2 + 3d4ef8a commit 053eef5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ name = "up-transport-mqtt5"
readme = "README.md"
repository = "https://github.com/eclipse-uprotocol/up-client-mqtt5-rust"
rust-version = "1.76"
version = "0.1.0"
version = "0.2.0"

[dependencies]
async-channel = {version = "1.6" }
Expand All @@ -48,7 +48,7 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
tokio = { version = "1.38", features = ["full"] }
tokio-macros = { version = "2.3" }
up-rust = "0.2.0"
up-rust = "0.3.0"
url = { version = "2.5" }
uuid = { version = "1.7", features = ["v8"] }

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview

This library implements a uTransport client for MQTT5 in Rust following the uProtocol [uTransport Specifications](https://github.com/eclipse-uprotocol/uprotocol-spec/blob/main/up-l1/README.adoc).
This library implements a uTransport client for [MQTT5](https://github.com/eclipse-uprotocol/up-spec/blob/v1.6.0-alpha.4/up-l1/mqtt_5.adoc) in Rust following the uProtocol [uTransport Specifications](https://github.com/eclipse-uprotocol/uprotocol-spec/blob/main/up-l1/README.adoc) for spec version 1.6.0-alpha.4.

## Getting Started

Expand Down
24 changes: 12 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ use up_rust::{

pub mod transport;

// URI Wildcard consts
// TODO: Remove once up-rust contains/exposes these values
const WILDCARD_AUTHORITY: &str = "*";
const WILDCARD_ENTITY_ID: u32 = 0x0000_FFFF;
const WILDCARD_ENTITY_VERSION: u32 = 0x0000_00FF;
const WILDCARD_RESOURCE_ID: u32 = 0x0000_FFFF;

// Attribute field names
const UURI_NAME: &str = "uuri";
const UUID_NAME: &str = "uuid";
Expand Down Expand Up @@ -915,27 +908,27 @@ impl UPClientMqtt {
/// # Arguments
/// * `uri` - UUri to convert to mqtt topic segment.
fn uri_to_mqtt_topic_segment(&self, uri: &UUri) -> String {
let authority = if uri.authority_name.is_empty() {
let authority = if uri.has_empty_authority() {
&self.authority_name
} else if uri.authority_name == WILDCARD_AUTHORITY {
} else if uri.has_wildcard_authority() {
"+"
} else {
&uri.authority_name
};

let ue_id = if uri.ue_id == WILDCARD_ENTITY_ID {
let ue_id = if uri.has_wildcard_entity_type() {
"+".into()
} else {
format!("{:X}", uri.ue_id)
};

let ue_ver = if uri.ue_version_major == WILDCARD_ENTITY_VERSION {
let ue_ver = if uri.has_wildcard_version() {
"+".into()
} else {
format!("{:X}", uri.ue_version_major)
};

let res_id = if uri.resource_id == WILDCARD_RESOURCE_ID {
let res_id = if uri.has_wildcard_resource_id() {
"+".into()
} else {
format!("{:X}", uri.resource_id)
Expand Down Expand Up @@ -970,6 +963,13 @@ mod tests {

use super::*;

// URI Wildcard consts
// TODO: Remove once up-rust contains/exposes these values
const WILDCARD_AUTHORITY: &str = "*";
const WILDCARD_ENTITY_ID: u32 = 0x0000_FFFF;
const WILDCARD_ENTITY_VERSION: u32 = 0x0000_00FF;
const WILDCARD_RESOURCE_ID: u32 = 0x0000_FFFF;

/// Constants defining the protobuf field numbers for UAttributes.
pub const ID_NUM: &str = "1";
pub const TYPE_NUM: &str = "2";
Expand Down

0 comments on commit 053eef5

Please sign in to comment.