Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ashbeitz/add command support #17

Merged
merged 46 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
987da28
Add commoand support
ashbeitz Jan 13, 2023
f23e9ae
Add commoand support
ashbeitz Jan 17, 2023
16e0603
Add commoand support
ashbeitz Jan 18, 2023
480ea39
Add commoand support
ashbeitz Jan 18, 2023
3748dea
Add commoand support
ashbeitz Jan 19, 2023
e8a2802
Add commoand support
ashbeitz Jan 19, 2023
cdc2a08
Add commoand support
ashbeitz Jan 19, 2023
15ccfde
Add command support
ashbeitz Jan 20, 2023
dd625f6
Add command support
ashbeitz Jan 20, 2023
dd68f9f
Add command support
ashbeitz Jan 20, 2023
64b126c
Add command support
ashbeitz Jan 24, 2023
61e3860
Render PlantUML files
github-actions[bot] Jan 24, 2023
bde1245
Add command support
ashbeitz Jan 24, 2023
d423eed
Merge branch 'ashbeitz/addCommandSupport' of https://github.com/eclip…
ashbeitz Jan 24, 2023
a41edd7
Add command support
ashbeitz Jan 24, 2023
23f4ca8
Add command support
ashbeitz Jan 24, 2023
1463ab0
Add command support
ashbeitz Jan 24, 2023
7cb922a
Add command support
ashbeitz Jan 24, 2023
22aadba
Add command support
ashbeitz Jan 24, 2023
f194f9c
Add command support
ashbeitz Jan 24, 2023
eafec0f
Add command support
ashbeitz Jan 24, 2023
f194449
Add command support
ashbeitz Jan 24, 2023
28c6c49
Add command support
ashbeitz Jan 24, 2023
a99eed6
Add command support
ashbeitz Jan 24, 2023
705e373
Add command support
ashbeitz Jan 25, 2023
a008310
Add command support
ashbeitz Jan 25, 2023
85f01bf
Add command support
ashbeitz Jan 25, 2023
e3da491
Add command support
ashbeitz Jan 25, 2023
f52c517
Add command support
ashbeitz Jan 25, 2023
a19e96d
Add command support
ashbeitz Jan 25, 2023
27926a5
Add command support
ashbeitz Jan 25, 2023
39b8462
Add command support
ashbeitz Jan 25, 2023
f64c52c
Add command support
ashbeitz Jan 25, 2023
947a5ca
Add command support
ashbeitz Jan 25, 2023
87796d5
Add command support
ashbeitz Jan 25, 2023
369823a
Add command support
ashbeitz Jan 25, 2023
9b779fc
Add command support
ashbeitz Jan 25, 2023
73262f6
Add command support
ashbeitz Jan 27, 2023
9b0eb64
Add command support
ashbeitz Jan 27, 2023
a0973ba
Add command support
ashbeitz Jan 30, 2023
426dc04
Add command support
ashbeitz Jan 30, 2023
cac9de9
Add command support
ashbeitz Jan 31, 2023
9ced14e
Add command support
ashbeitz Jan 31, 2023
911663e
Add command support
ashbeitz Jan 31, 2023
a1026ee
Add command support
ashbeitz Jan 31, 2023
0114d88
Add command support
ashbeitz Jan 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .accepted_words.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
br
build
cargo
cd
com
digitaltwins
Expand All @@ -7,6 +9,8 @@ dt
dtdl
DTDL
en
gcc
gcc's
github
hardcheese
haudebourg
Expand All @@ -15,6 +19,7 @@ ibeji
Ibeji
Ibeji's
intellectualproperty
iot
js
json
JSON
Expand All @@ -23,6 +28,7 @@ LD
microsoft
minimalistic
opendigitaltwins
plugandplay
protobuf
Protobuf
repo
Expand All @@ -34,5 +40,3 @@ sudo
timothee
toolchain
www
cargo
build
4 changes: 2 additions & 2 deletions .github/workflows/alex-recommends-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
alex:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 12.x
- name: Comment on new PR
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/check-spelling.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ on:
- main

jobs:
notice_generation:
check_spelling:
runs-on: ubuntu-latest
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install spell
Expand All @@ -18,5 +18,5 @@ jobs:
run: |
./tools/check_spelling.sh ./README.md
./tools/check_spelling.sh ./dtdl-parser/README.md
./tools/check_spelling.sh ./docs/design/design_spec.md
./tools/check_spelling.sh ./docs/design/README.md
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/editorconfig-audit-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
editorconfig-audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-plantuml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: plantuml
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: plantuml
id: plantuml
uses: grassedge/generate-plantuml-action@v1.5
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/markdown-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
lint-markdown:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: |
npm install markdownlint-cli
- run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/rust-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install protobuf-compiler
Expand All @@ -29,7 +29,7 @@ jobs:
override: true
components: clippy, rustfmt
- name: Cache Dependencies
uses: Swatinem/rust-cache@v1
uses: Swatinem/rust-cache@v2
- run: cargo check --workspace
# Note: cargo check should use the --locked option
# Excluding it because of this known issue: https://github.com/mozilla/uniffi-rs/issues/1032
Expand All @@ -53,7 +53,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install protobuf-compiler
Expand All @@ -65,7 +65,7 @@ jobs:
default: true
override: true
- name: Cache Dependencies
uses: Swatinem/rust-cache@v1
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build
- name: Test
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "opendigitaltwins-dtdl"]
path = opendigitaltwins-dtdl
url = https://github.com/Azure/opendigitaltwins-dtdl
[submodule "iot-plugandplay-models"]
path = iot-plugandplay-models
url = https://github.com/Azure/iot-plugandplay-models
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ members = [
"proto",
"dtdl-parser",
"in-vehicle-digital-twin",
"provider",
"samples/simple/consumer",
"samples/simple/provider"
"samples/command/consumer",
"samples/command/provider",
"samples/property/consumer",
"samples/property/provider"
]
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- [Introduction](#introduction)
- [High-level Design](#high-level-design)
- [Prerequisites](#prerequisites)
- [Install gcc](#install-gcc)
- [Install Rust](#install-rust)
- [Install Protobuf Compiler](#install-protobuf-compiler)
- [Cloning the Repo](#cloning-the-repo)
Expand All @@ -21,14 +22,22 @@ through an extensible, open and dynamic architecture that provides access to the

## <a name="high-level-design">High-level Design</a>

Ibeji's architecture has a In-Vehicle Digital Twin Service at its core. The In-Vehicle Digital Twin Service captures all of the vehicle's primary capabilities
and make them available to Ibeji consumers. Another component in Ibeji's architecture is the Provider. A vehicle may have one or more providers.
Ibeji's architecture has an In-Vehicle Digital Twin Service at its core. The In-Vehicle Digital Twin Service captures all of the vehicle's primary capabilities
and makes them available to Ibeji consumers. Another component in Ibeji's architecture is the Provider. A vehicle may have one or more providers.
A provider exposes a subset of the vehicle's primary capabilities by registering them with the In-Vehicle Digital Twin Service. Once registered with the
In-Vehicle Digital Twin Service they can in turn be offered to Ibeji consumers. Each capability includes meta data that allow Ibeji consumers to comprehend
the nature of the capability, how to work with it and how it can be remotely accessed.

## <a name="prerequisites">Prerequisites</a>

### <a name="install-gcc">Install gcc</a>

Rust needs gcc's linker, so you will need to install it. To install gcc, do the following:

```shell
sudo apt install gcc
```

### <a name="install-rust">Install Rust</a>

At this point in time, you will need to use the nightly release of Rust. While it is not ideal to rely on a nightly release, we should be able to rely on the
Expand Down Expand Up @@ -57,8 +66,8 @@ You will need to install the Protobuf Compiler. This can be done by executing:

## <a name="cloning-the-repo">Cloning the Repo</a>

The repo has one submodule [opendigitaltwins-dtdl](https://github.com/Azure/opendigitaltwins-dtdl) that provide the DTDL context files and DTDL samples file.
To ensure that it is included, please use the following command when cloning Ibeji's github repo:
The repo has two submodule [opendigitaltwins-dtdl](https://github.com/Azure/opendigitaltwins-dtdl) and [iot-plugandplay-models](https://github.com/Azure/iot-plugandplay-models) that provide DTDL context files
and DTDL samples file. To ensure that these are included, please use the following command when cloning Ibeji's github repo:

`git clone --recurse-submodules https://github.com/eclipse-ibeji/ibeji`

Expand All @@ -73,7 +82,7 @@ and checkout its "resolve-issue-40" branch. It should be cloned to a directory t

### <a name="dtdl-parser">DTDL Parser</a>

There is no existing DTDL Parser for Rust, so we have provided a minimalistic one that is based on the [JavaScript DTDL Parser](https://github.com/Azure/azure-sdk-for-js/tree/%40azure/dtdl-parser_1.0.0-beta.2/sdk/digitaltwins/dtdl-parser).
There is no existing DTDL Parser for Rust, so we have provided a minimalistic one for DTDL v2 that is based on the [JavaScript DTDL Parser](https://github.com/Azure/azure-sdk-for-js/tree/%40azure/dtdl-parser_1.0.0-beta.2/sdk/digitaltwins/dtdl-parser).

## <a name="building">Building</a>

Expand All @@ -93,23 +102,25 @@ Currently, we have no integration tests or end-to-end tests.

## <a name="running-the-demo">Running the Demo</a>

There are currently two demos: one that demonstrates the use of a property and one that demonstrates the use of a command. The following instructions are for the demo for the use of a property. These instructions can easily be adjusted for the demonstration for the use of a command.

Steps:

1. The best way to run the demo is by using three windows: one running the In-Vehicle Digital Twin, one running the Provider and one running a Consumer.
Orientate the three windows so that they are lined up in a column. The top window can be used for the In-Vehicle Digital Twin.
The middle window can be used for the Provider. The bottom window can be used for a Consumer.<br>
1. In each window run the following command too set the DTDL_PATH environment variable.
Make sure that you replace "{repo-root-dir}" with the repository root directory on the machine where you are running the demo.<br><br>
`export DTDL_PATH="{repo-root-dir}/ibeji/opendigitaltwins-dtdl/DTDL;{repo-root-dir}/ibeji/dtdl;{repo-root-dir}/ibeji/samples/simple/dtdl"`<br>
`export DTDL_PATH="{repo-root-dir}/ibeji/opendigitaltwins-dtdl/DTDL;{repo-root-dir}/ibeji/dtdl;{repo-root-dir}/ibeji/samples/property/dtdl"`<br>
1. In each window change directory to the directory containing the build artifacts.
Make sure that you replace "{repo-root-dir}" with the repository root directory on the machine where you are running the demo.<br><br>
`cd {repo-root-dir}/ibeji/target/debug`<br>
1. In the top window, run:<br><br>
`./in-vehicle-digital-twin`<br>
1. In the middle window, run:<br><br>
`./simple-provider`<br>
`./property-provider`<br>
1. In the bottom window, run:<br><br>
`./simple-consumer`<br>
`./property-consumer`<br>
1. Use control-c in each of the windows when you wish to stop the demo.

## <a name="trademarks">Trademarks</a>
Expand Down
4 changes: 3 additions & 1 deletion common-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ fn get_repo_dir() -> Option<String> {
pub fn set_dtdl_path() {
let repo_dir_result = get_repo_dir();
if let Some(repo_dir) = repo_dir_result {
let value = format!("{}/opendigitaltwins-dtdl/DTDL;{}/dtdl", repo_dir, repo_dir);
let value = format!(
"{repo_dir}/opendigitaltwins-dtdl/DTDL;{repo_dir}/iot-plugandplay-models;{repo_dir}/dtdl"
);
env::set_var(DTDL_PATH, &value);
trace!("{}={}", DTDL_PATH, &value);
} else {
Expand Down
7 changes: 3 additions & 4 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ pub fn find_full_path(relative_path: &str) -> Result<String, String> {
}
}
Err(_) => {
return Err(format!(
"Unable to get the environment variable {}. Please set it.",
DTDL_PATH
return Err(String::from(
"Unable to get the environment variable DTDL_PATH. Please set it."
))
}
}
Expand All @@ -43,7 +42,7 @@ pub fn retrieve_dtdl(file_path: &str) -> Result<String, String> {
let read_result = fs::read_to_string(path);
match read_result {
Ok(contents) => Ok(contents),
Err(error) => Err(format!("Unable to retrieve the DTDL due to: {:?}", error)),
Err(error) => Err(format!("Unable to retrieve the DTDL due to: {error}")),
}
}

Expand Down
Loading