Skip to content

Commit 750e12d

Browse files
authored
Merge pull request #58 from ValtechMobility/add_mqtt_zenoh_reference_implementation
Add mqtt-zenoh reference implementation and mqtt example entities
2 parents 7f2c2b6 + e11ad0d commit 750e12d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1660
-519
lines changed

.github/workflows/bundled-lint-and-test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ jobs:
7171
run: cargo clippy --all-targets -- -W warnings -D warnings
7272
- name: Build the project with Zenoh & vsomeip transports (and thus streamer references)
7373
working-directory: ${{github.workspace}}
74-
run: cargo build --features vsomeip-transport,bundled-vsomeip,zenoh-transport
74+
run: cargo build --features vsomeip-transport,bundled-vsomeip,zenoh-transport,mqtt-transport
7575
- name: cargo clippy with Zenoh & vsomeip transports (and thus streamer references)
7676
working-directory: ${{github.workspace}}
77-
run: cargo clippy --features vsomeip-transport,bundled-vsomeip,zenoh-transport --all-targets -- -W warnings -D warnings
77+
run: cargo clippy --features vsomeip-transport,bundled-vsomeip,zenoh-transport,mqtt-transport --all-targets -- -W warnings -D warnings
7878
- name: cargo fmt
7979
working-directory: ${{github.workspace}}
8080
run: cargo fmt -- --check

.github/workflows/unbundled-lint-and-test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@ jobs:
168168
run: cargo clippy --all-targets -- -W warnings -D warnings
169169
- name: Build the project with Zenoh & vsomeip transports (and thus streamer references)
170170
working-directory: ${{github.workspace}}
171-
run: cargo build --features vsomeip-transport,zenoh-transport
171+
run: cargo build --features vsomeip-transport,zenoh-transport,mqtt-transport
172172
- name: cargo clippy with Zenoh & vsomeip transports (and thus streamer references)
173173
working-directory: ${{github.workspace}}
174-
run: cargo clippy --features vsomeip-transport,zenoh-transport --all-targets -- -W warnings -D warnings
174+
run: cargo clippy --features vsomeip-transport,zenoh-transport,mqtt-transport --all-targets -- -W warnings -D warnings
175175
- name: cargo fmt
176176
working-directory: ${{github.workspace}}
177177
run: cargo fmt -- --check

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ tarpaulin-report.html
1818
.vscode/launch.json
1919
.vscode/settings.json
2020
reports/
21+
22+
.cargo/

Cargo.lock

Lines changed: 103 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ members = [
1515
"example-streamer-uses",
1616
"utils/hello-world-protos",
1717
"utils/integration-test-utils",
18-
"up-linux-streamer", "up-linux-streamer-plugin",
18+
"example-streamer-implementations", "up-linux-streamer-plugin",
1919
"up-streamer", "subscription-cache", "utils/usubscription-static-file"]
2020

2121
[workspace.package]
@@ -44,6 +44,7 @@ protobuf = { version = "3.3", features = ["with-bytes"] }
4444
up-rust = { version = "0.2.0", default-features = false }
4545
up-transport-zenoh = { version = "0.3.0" }
4646
up-transport-vsomeip = { git = "https://github.com/eclipse-uprotocol/up-transport-vsomeip-rust.git", tag = "v0.3.0", default-features = false }
47+
up-transport-mqtt5 = { version = "0.1.0" }
4748
zenoh = { version = "1.0.0", features = ["default", "plugins"] }
4849
zenoh-core = { version = "1.0.0" }
4950
zenoh-plugin-trait = { version = "1.0.0" }

README.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# up-streamer-rust
1+
# up-streamer-rust: what is in this repository
22

33
## up-streamer
44

@@ -7,11 +7,17 @@ to write a uStreamer application to bridge from one transport to another.
77

88
Reference its README.md for further details.
99

10-
## up-linux-streamer
10+
## example-streamer-implementations
1111

12-
Concrete implementation of a uStreamer as a binary.
12+
Two concrete implementations of a uStreamer as a binary. These can be used out of the box either to try running different UStreamer setups or to directly use them in a project!
1313

14-
Reference its README.md for further details.
14+
Reference the README.md there for more details.
15+
16+
## example-streamer-uses
17+
18+
A number of UEntity examples for SOME/IP, Zenoh and MQTT5. These can be used together with the example streamer implementations to run basic setups of either a publisher and a subscriber, or a service and a client.
19+
20+
Reference the README.md there for more details.
1521

1622
## Building
1723

@@ -25,22 +31,21 @@ cargo build
2531

2632
### Also build the reference Zenoh, vsomeip streamer implementations
2733

28-
You'll need to use the feature flags `vsomeip-transport` and `zenoh-transport`. You then also have the option of including your own vsomeip or using one bundled in `up-transport-vsomeip`.
34+
You'll need to use the feature flags `vsomeip-transport`, `zenoh-transport` or `mqtt-transport` depending on which implementation you want to build. You then also have the option of including your own vsomeip or using one bundled in `up-transport-vsomeip`.
2935

30-
For the bundled option, the following:
36+
For the bundled option, set the following environment variables (for example in your .cargo/config.toml file):
3137

38+
```toml
39+
[env]
40+
GENERIC_CPP_STDLIB_PATH=<path to your c++ stdlib (for example /usr/include/c++/13)>
41+
ARCH_SPECIFIC_CPP_STDLIB_PATH=<path to your c++ stdlib (for example /usr/include/x86_64-linux-gnu/c++/13)>
3242
```
33-
GENERIC_CPP_STDLIB_PATH=<see-below> ARCH_SPECIFIC_CPP_STDLIB_PATH=<see-below> cargo build --features vsomeip-transport,bundled-vsomeip,zenoh-transport
34-
```
35-
36-
where for reference on my machine:
3743

38-
```
39-
GENERIC_CPP_STDLIB_PATH=/usr/include/c++/13
40-
ARCH_SPECIFIC_CPP_STDLIB_PATH=/usr/include/x86_64-linux-gnu/c++/13
44+
```bash
45+
cargo build --features vsomeip-transport,bundled-vsomeip,zenoh-transport
4146
```
4247

43-
These environment varialbes are necessary because of a workaround done in `up-transport-vsomeip` due to not being able to figure out another way to compile vsomeip without them. (If you can figure out how to avoid this, I'm all ears!)
48+
The environment variables are necessary because of a workaround done in `up-transport-vsomeip` due to not being able to figure out another way to compile vsomeip without them. (If you can figure out how to avoid this, I'm all ears!)
4449

4550
Please reference the documentation for [vsomeip-sys](https://github.com/eclipse-uprotocol/up-transport-vsomeip-rust/tree/main/vsomeip-sys) for more details on:
4651
* the build requirements for vsomeip in the linked documentation in the COVESA repo

up-linux-streamer/Cargo.toml renamed to example-streamer-implementations/Cargo.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,17 @@ keywords.workspace = true
2020
license.workspace = true
2121

2222
[[bin]]
23-
name = "up-linux-streamer"
24-
path = "src/main.rs"
23+
name = "zenoh_someip"
2524
required-features = ["zenoh-transport", "vsomeip-transport"]
2625

26+
[[bin]]
27+
name = "zenoh_mqtt"
28+
required-features = ["zenoh-transport", "mqtt-transport"]
29+
2730
[features]
2831
default = []
2932
zenoh-transport = ["up-transport-zenoh", "zenoh"]
33+
mqtt-transport = ["up-transport-mqtt5"]
3034
vsomeip-transport = ["up-transport-vsomeip"]
3135
bundled-vsomeip = ["up-transport-vsomeip/bundled"]
3236

@@ -44,6 +48,7 @@ up-rust = { workspace = true }
4448
up-streamer = { path = "../up-streamer" }
4549
up-transport-zenoh = { workspace = true, optional = true }
4650
up-transport-vsomeip = { workspace = true, optional = true }
51+
up-transport-mqtt5 = { workspace = true, optional = true }
4752
zenoh = { workspace = true, optional = true }
4853
usubscription-static-file = {path = "../utils/usubscription-static-file"}
4954

up-linux-streamer/DEFAULT_CONFIG.json5 renamed to example-streamer-implementations/DEFAULT_CONFIG.json5

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
streamer_uuri: {
1212
// Determines the authority_name of the host device
1313
// Used when initializing host transport
14-
authority: "linux",
14+
authority: "authority_B",
1515
// Determines the ue_id of the streamer
1616
// Used when initializing host transport
1717
ue_id: 78,
@@ -21,21 +21,35 @@
2121
},
2222
usubscription_config: {
2323
// Lists the path to the subscription file when using static file
24-
file_path: "./utils/usubscription-static-file/static-configs/testdata.json"
24+
file_path: "../example-streamer-implementations/subscription_data.json"
2525
},
2626
zenoh_transport_config: {
2727
// Configuration file which is where zenoh config information is stored
28-
config_file: "./up-linux-streamer/ZENOH_CONFIG.json5"
28+
config_file: "../example-streamer-implementations/ZENOH_CONFIG.json5"
2929
},
3030
// Configurations related to the host device we are running the streamer on
3131
host_config: {
3232
// Determines which transport to initialize for the host device
3333
transport: "Zenoh",
3434
},
35+
mqtt_config: {
36+
// The URL of the MQTT broker (the provided mosquitto broker runs on locahost but docker networks might complicate that)
37+
hostname: "localhost",
38+
// The port of the broker (unencrypted MQTT like the provided mosquitto broker typically uses 1883, encrypted uses 8883)
39+
port: 1883,
40+
// How many messages the broker should buffer for this connections
41+
max_buffered_messages: 100,
42+
// How many individual topic subscriptions are supported through this connection
43+
max_subscriptions: 100,
44+
// How long the connection should stay open for
45+
session_expiry_interval: 3600,
46+
// The username that the mqtt client gives the broker when connecting (usually not important)
47+
username: "user"
48+
},
3549
someip_config: {
3650
// Determines the authority_name of the mechatronics network
3751
// Used when initializing SOME/IP transport
38-
authority: "me_authority",
52+
authority: "authority_A",
3953
// The vsomeip configuration file to be used when initializing the vsomeip transport
4054
//
4155
// Some guidance:
@@ -46,11 +60,9 @@
4660
// called
4761
// * the `id` field should be chosen such that it matches the ue_id of the uE on the host
4862
// device
49-
config_file: "../../up-linux-streamer/vsomeip-configs/point_to_point.json",
63+
config_file: "../../example-streamer-implementations/vsomeip-configs/point_to_point.json",
5064
// An ID to use for a vsomeip application which will represent all subscriptions to
5165
// publish messages output over vsomeip
52-
default_someip_application_id_for_someip_subscriptions: 10,
53-
// Whether to enable bridging across to the mechatronics network
54-
enabled: true
66+
default_someip_application_id_for_someip_subscriptions: 10
5567
},
5668
}

0 commit comments

Comments
 (0)