Skip to content

Commit

Permalink
Minor README fixes according to review
Browse files Browse the repository at this point in the history
  • Loading branch information
Ax9DTW committed May 31, 2024
1 parent 30b392a commit 6d66729
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ smip aims to make SOME/IP development in Rust feel as natural as building regula

Why is it better than something like vsomeip-rs?

vsomeip-rs is a Rust binding for the vsomeip C++ library. It exposes the C++ API directly to Rust developers, potentially leading to less Rust-idiomatic code.
Also vsomeip is a very low level someip implementation and is heavily callback oriented.
For example a service definition in vsomeip may look like this:
vsomeip-rs is a Rust binding for the vSomeIP C++ library. It exposes the C++ API directly to Rust developers, potentially leading to less Rust-idiomatic code.
Also vSomeIP is a very low level SOME/IP implementation and is heavily callback oriented.
For example a service definition in vSomeIP may look like this:

```rust
use vsomeip_rs::*;
Expand Down Expand Up @@ -76,34 +76,37 @@ impl MyService {
}

fn main() {
let config: RuntimeConfig = smip::RuntimeConfig::new(
"Simple",
0xABCD,
instance_id: 0x1,
service: Some(MyService { x: 0 })
);

let application: Runtime = smip::Runtime::new(config);
application.run();
let config = smip::RuntimeConfig::new("Simple", 0xABCD, 0x1);

let application = Runtime::new(config).service(
MyService {
x: 0
}, 30509);

let _ = application.run();
}
```
A service is represented by a struct with a `service` attribute for providing its `id` and other metadata. This struct will also hold all of the service's state.

SOME/IP methods are just rust methods with a special `smip_method` attribute attribute to indicate its id. Whatever you pass as an argument to your method is parsed automatically from the payload, and whatever you return from it serialized into a response and sent back.
A service is represented by a struct with a `service` attribute for providing its `id` and other metadata like the `major_version` (optional) and `minor_version` (optional). This struct will also hold all of the service's state.

SOME/IP methods are just rust methods with a special `smip_method` attribute to indicate its id. Whatever you pass as an argument to your method is parsed automatically from the payload, and whatever you return from it serialized into a response and sent back.
All of these need to be in a special impl block marked with a `methods_impl` attribute for the framework to recognize them.

A `Runtime` needs to be created using a `RuntimeConfig` which which take care of creating and running all of your services.

After adding all your services to the `Runtime`, call `runtime.run()` to start all the services.
# Aim

Smip aims to be a SOME/IP framework and not an implementation of SOME/IP, so its not competing with vsomeip or sommar. Currently vsomeip is used as the underlying implementation but this can be swapped with any compliant implementation in the future.
Smip aims to be a SOME/IP framework and not an implementation of SOME/IP, so its not competing with [vSomeIP](https://github.com/COVESA/vsomeip) or [SommR](https://projects.eclipse.org/projects/automotive.sommr). Currently vSomeIP is used as the underlying implementation but this can be swapped with any compliant implementation in the future.

Key Benefits:
* Macro-Based Definition: The smip macro simplifies the definition of services and methods, reducing the amount of code needed.
* Automatic Serialization/Deserialization: smip handles the serialization and deserialization of your service's data types, so you don't have to write it yourself.
* Rust-Idiomatic API: The framework's API is designed to be Rust-friendly, with a focus on clarity and simplicity.
* Improved Developer Experience: smip streamlines the development process, making it easier to create and manage SOME/IP services in Rust.
* **Macro-Based Definition**: The smip macro simplifies the definition of services and methods, reducing the amount of code needed.
* **Automatic Serialization/Deserialization**: smip handles the serialization and deserialization of your service's data types, so you don't have to write it yourself.
* **Rust-Idiomatic API**: The framework's API is designed to be Rust-friendly, with a focus on clarity and simplicity.
* **Improved Developer Experience**: smip streamlines the development process, making it easier to create and manage SOME/IP services in Rust.


⚠️ **This is a highly experimental framework and doesn't support all features in SOME/IP.**
⚠️ **This is a highly experimental framework and doesn't support all of the features in SOME/IP**

# Run
For a working demo see `examples/simple.rs` and `examples/simple_client.rs`:
Expand All @@ -117,4 +120,4 @@ In another terminal,
cargo run --example simple_client
```

- You may need to set the `LD_LIBRARY_PATH` environment to a path that contains the vsomeip library as this is dynamically loaded `LD_LIBRARY_PATH=/usr/local/lib`
- You may need to set the `LD_LIBRARY_PATH` environment to a path that contains the vSomeIP library as this is dynamically loaded `LD_LIBRARY_PATH=/usr/local/lib`

0 comments on commit 6d66729

Please sign in to comment.