Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 14 additions & 15 deletions rustecal-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
[package]
name = "rustecal-core"
version = "0.1.2"
authors = ["Rex Schilasky"]
edition = "2021"
description = "Core API for Eclipse eCAL"
license = "Apache-2.0"
repository = "https://github.com/eclipse-ecal/rustecal"
name = "rustecal-core"
version = "0.1.2"
authors = ["Rex Schilasky"]
edition = "2021"
description = "Core API for Eclipse eCAL"
license = "Apache-2.0"
repository = "https://github.com/eclipse-ecal/rustecal"
documentation = "https://docs.rs/rustecal-core"
readme = "README.md"
keywords = ["ecal", "ipc", "pubsub", "server-client", "middleware"]
categories = ["network-programming", "api-bindings"]
readme = "README.md"
keywords = ["ecal", "ipc", "pubsub", "server-client", "middleware"]
categories = ["network-programming", "api-bindings"]

[dependencies]
rustecal-sys = { version = "0.1.0", path = "../rustecal-sys", optional = true }
once_cell = "1.17"
thiserror = "1.0"
bitflags = "1.3"
rustecal-sys = { version = "0.1", path = "../rustecal-sys", optional = true }
thiserror = "2.0"
bitflags = "2.9"

[features]
# Include sys bindings by default in local builds
Expand All @@ -25,4 +24,4 @@ sys = ["rustecal-sys"]

[package.metadata.docs.rs]
default-features = false
features = []
features = []
27 changes: 13 additions & 14 deletions rustecal-pubsub/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
[package]
name = "rustecal-pubsub"
version = "0.1.3"
authors = ["Rex Schilasky"]
edition = "2021"
description = "Publish/Subscribe API for Eclipse eCAL"
license = "Apache-2.0"
repository = "https://github.com/eclipse-ecal/rustecal"
name = "rustecal-pubsub"
version = "0.1.3"
authors = ["Rex Schilasky"]
edition = "2021"
description = "Publish/Subscribe API for Eclipse eCAL"
license = "Apache-2.0"
repository = "https://github.com/eclipse-ecal/rustecal"
documentation = "https://docs.rs/rustecal-pubsub"
readme = "README.md"
keywords = ["ecal", "ipc", "pubsub", "middleware"]
categories = ["network-programming", "api-bindings"]
readme = "README.md"
keywords = ["ecal", "ipc", "publish-subscribe", "middleware"]
categories = ["network-programming", "api-bindings"]

[dependencies]
rustecal-sys = { version = "0.1.0", path = "../rustecal-sys", optional = true }
rustecal-core = { version = "0.1.0", path = "../rustecal-core" }
thiserror = "1.0"
rustecal-sys = { version = "0.1", path = "../rustecal-sys", optional = true }
rustecal-core = { version = "0.1", path = "../rustecal-core" }

[features]
# Include sys bindings by default in local builds
Expand All @@ -24,4 +23,4 @@ sys = ["rustecal-sys"]

[package.metadata.docs.rs]
default-features = false
features = []
features = []
4 changes: 2 additions & 2 deletions rustecal-pubsub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ rustecal-pubsub = "0.1"

## Quickstart

### Typed Publisher
### Typed Publisher Example

```rust
use std::sync::Arc;
Expand All @@ -49,7 +49,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
```

### Typed Subscriber
### Typed Subscriber Example

```rust
use rustecal::{Ecal, EcalComponents, TypedSubscriber};
Expand Down
30 changes: 20 additions & 10 deletions rustecal-service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
[package]
name = "rustecal-service"
version = "0.1.0"
edition = "2021"
name = "rustecal-service"
version = "0.1.0"
authors = ["Rex Schilasky"]
edition = "2021"
description = "Server/Client API for Eclipse eCAL"
license = "Apache-2.0"
repository = "https://github.com/eclipse-ecal/rustecal"
documentation = "https://docs.rs/rustecal-service"
readme = "README.md"
keywords = ["ecal", "ipc", "service", "server-client", "middleware"]
categories = ["network-programming", "api-bindings"]

[dependencies]
rustecal-sys = { path = "../rustecal-sys" }
rustecal-core = { path = "../rustecal-core" }
thiserror = "1.0"
tokio = { version = "1", optional = true }
rustecal-sys = { version = "0.1", path = "../rustecal-sys", optional = true }

[features]
default = ["async"]
async = ["tokio"]
sync = []
# Include sys bindings by default in local builds
default = ["sys"]
# Optional feature to enable the rustecal-sys dependency
sys = ["rustecal-sys"]

[package.metadata.docs.rs]
default-features = false
features = []
106 changes: 106 additions & 0 deletions rustecal-service/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# rustecal-service

`rustecal-service` provides a high-level RPC-style service server and client API, enabling request-response interactions with minimal boilerplate.

## Features

- **ServiceServer**: host one or more methods, register handlers via closures
- **ServiceClient**: invoke remote methods with optional timeouts
- **Method metadata** (`MethodInfo`) and structured responses (`ServiceResponse`)
- Built-in error handling and call-state reporting

## Requirements

- Rust 1.60 or later
- eCAL C/C++ library v6.0 or later installed on your system

## Installation

Add to your workspace `Cargo.toml`:

```toml
[dependencies]
rustecal-service = "0.1"
```

## Quickstart

### Server Example

```rust
use rustecal::{Ecal, EcalComponents, ServiceServer};
use rustecal::service::types::MethodInfo;

fn main() -> Result<(), Box<dyn std::error::Error>> {
Ecal::initialize(Some("mirror_server"), EcalComponents::DEFAULT)?;

let mut server = ServiceServer::new("mirror_service")?;

server.add_method("mirror", Box::new(|method: MethodInfo, req: &[u8]| {
let request_str = String::from_utf8_lossy(req);
println!("Received [{}] request: {}", method.method_name, request_str);

// Echo (mirror) the same bytes back
req.to_vec()
}))?;

println!("mirror_service is running…");

while Ecal::ok() {
std::thread::sleep(std::time::Duration::from_millis(500));
}

Ecal::finalize();
Ok(())
}
```


### Client Example

```rust
use rustecal::{Ecal, EcalComponents, ServiceClient, ServiceRequest};

fn main() -> Result<(), Box<dyn std::error::Error>> {
Ecal::initialize(Some("mirror_client"), EcalComponents::DEFAULT)?;

let client = ServiceClient::new("mirror_service")?;

let request_data = b"Hello, Service!";
let timeout = Some(500);

while Ecal::ok() {
let request = ServiceRequest {
payload: request_data.to_vec(),
};

// Call the "mirror" method
if let Some(response) = client.call("mirror", request, timeout) {
// Extract the echoed payload
let echoed = String::from_utf8_lossy(&response.payload);
println!("Received response: {}", echoed);
} else {
println!("Service call timed out.");
}

std::thread::sleep(std::time::Duration::from_millis(500));
}

Ecal::finalize();
Ok(())
}
```

## Traits Reference

- **`ServiceServer`**
- `new(topic: &str) -> Result<Self, String>`
- `add_method(method: &str, callback: ServiceCallback) -> Result<(), String>`

- **`ServiceClient`**
- `new(service_name: &str) -> Result<Self, String>`
- `call(method: &str, req: ServiceRequest, timeout_ms: Option<i32>) -> Option<ServiceResponse>`

## See Also

- Examples in the `rustecal-samples/service` directory
29 changes: 13 additions & 16 deletions rustecal-sys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
[package]
name = "rustecal-sys"
version = "0.1.2"
authors = ["Rex Schilasky"]
edition = "2021"
build = "build.rs"
description = "Raw FFI bindings to Eclipse eCAL C API"
license = "Apache-2.0"
repository = "https://github.com/eclipse-ecal/rustecal"
name = "rustecal-sys"
version = "0.1.2"
authors = ["Rex Schilasky"]
edition = "2021"
build = "build.rs"
description = "Raw FFI bindings to Eclipse eCAL C API"
license = "Apache-2.0"
repository = "https://github.com/eclipse-ecal/rustecal"
documentation = "https://docs.rs/rustecal-sys"
readme = "README.md"
keywords = ["ecal", "ipc", "pubsub", "server-client", "middleware"]
categories = ["network-programming", "api-bindings"]
readme = "README.md"
keywords = ["ecal", "ipc", "pubsub", "server-client", "middleware"]
categories = ["network-programming", "api-bindings"]

[build-dependencies]
bindgen = "0.71.0"

[dependencies]
libc = "0.2"
bindgen = "0.71"

[features]
default = ["dynamic"]
dynamic = [] # Link dynamically to libecal_c
static = [] # Optional: Static linking (if you add support)
static = [] # Optional: Static linking (if you add support)

[package.metadata.docs.rs]
features = ["dynamic"]
24 changes: 12 additions & 12 deletions rustecal-types-bytes/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[package]
name = "rustecal-types-bytes"
version = "0.1.2"
authors = ["Rex Schilasky"]
edition = "2021"
description = "Vec<u8> type support for rustecal TypedPublisher / TypedSubscriber"
license = "Apache-2.0"
repository = "https://github.com/eclipse-ecal/rustecal"
name = "rustecal-types-bytes"
version = "0.1.2"
authors = ["Rex Schilasky"]
edition = "2021"
description = "Vec<u8> type support for rustecal TypedPublisher/TypedSubscriber"
license = "Apache-2.0"
repository = "https://github.com/eclipse-ecal/rustecal"
documentation = "https://docs.rs/rustecal-types-bytes"
readme = "README.md"
keywords = ["ecal", "ipc", "pubsub", "message-support", "middleware"]
categories = ["network-programming", "api-bindings"]
readme = "README.md"
keywords = ["ecal", "ipc", "pubsub", "message-support", "middleware"]
categories = ["network-programming", "api-bindings"]

[dependencies]
rustecal-core = { version = "0.1.0", path = "../rustecal-core" }
rustecal-pubsub = { version = "0.1.0", path = "../rustecal-pubsub" }
rustecal-core = { version = "0.1", path = "../rustecal-core" }
rustecal-pubsub = { version = "0.1", path = "../rustecal-pubsub" }
26 changes: 13 additions & 13 deletions rustecal-types-protobuf/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
name = "rustecal-types-protobuf"
version = "0.1.0"
authors = ["Rex Schilasky"]
edition = "2021"
description = "Google Protobuf type support for rustecal TypedPublisher / TypedSubscriber"
license = "Apache-2.0"
repository = "https://github.com/eclipse-ecal/rustecal"
name = "rustecal-types-protobuf"
version = "0.1.0"
authors = ["Rex Schilasky"]
edition = "2021"
description = "Google Protobuf type support for rustecal TypedPublisher/TypedSubscriber"
license = "Apache-2.0"
repository = "https://github.com/eclipse-ecal/rustecal"
documentation = "https://docs.rs/rustecal-types-protobuf"
readme = "README.md"
keywords = ["ecal", "ipc", "pubsub", "message-support", "middleware"]
categories = ["network-programming", "api-bindings"]
readme = "README.md"
keywords = ["ecal", "ipc", "pubsub", "message-support", "middleware"]
categories = ["network-programming", "api-bindings"]

[dependencies]
prost = "0.13.5"
rustecal-core = { version = "0.1.0", path = "../rustecal-core" }
rustecal-pubsub = { version = "0.1.0", path = "../rustecal-pubsub" }
prost = "0.13"
rustecal-core = { version = "0.1", path = "../rustecal-core" }
rustecal-pubsub = { version = "0.1", path = "../rustecal-pubsub" }
30 changes: 15 additions & 15 deletions rustecal-types-serde/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[package]
name = "rustecal-types-serde"
version = "0.1.0"
edition = "2021"
description = "JSON/CBOR/MessagePack support for rustecal TypedPublisher / TypedSubscriber"
license = "Apache-2.0"
repository = "https://github.com/eclipse-ecal/rustecal"
name = "rustecal-types-serde"
version = "0.1.0"
edition = "2021"
description = "JSON/CBOR/MessagePack type support for rustecal TypedPublisher/TypedSubscriber"
license = "Apache-2.0"
repository = "https://github.com/eclipse-ecal/rustecal"
documentation = "https://docs.rs/rustecal-types-serde"
readme = "README.md"
keywords = ["ecal", "ipc", "pubsub", "message-support", "middleware"]
categories = ["network-programming", "api-bindings"]
readme = "README.md"
keywords = ["ecal", "ipc", "pubsub", "message-support", "middleware"]
categories = ["network-programming", "api-bindings"]

[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_cbor = "0.11"
rmp-serde = "1.1"
rustecal-core = { version = "0.1.0", path = "../rustecal-core" }
rustecal-pubsub = { version = "0.1.0", path = "../rustecal-pubsub" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_cbor = "0.11"
rmp-serde = "1.3"
rustecal-core = { version = "0.1", path = "../rustecal-core" }
rustecal-pubsub = { version = "0.1", path = "../rustecal-pubsub" }
Loading