From 6d66729049b009fe1f80add8e7520f8c6ef23df2 Mon Sep 17 00:00:00 2001 From: Atri Sarkar Date: Fri, 31 May 2024 11:48:16 +0530 Subject: [PATCH] Minor README fixes according to review --- README.md | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index e07feef..07abe08 100644 --- a/README.md +++ b/README.md @@ -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::*; @@ -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`: @@ -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`