Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b558f13
tosca: Reorder metrics derive traits
Luni-4 Apr 21, 2026
aa78c92
tosca: Minor formatting in events
Luni-4 Apr 21, 2026
39ce3c3
tosca: Fix clippy lint in test events
Luni-4 Apr 21, 2026
0a6c129
tosca: Enable `deserialize` feature on hazard category
Luni-4 Apr 21, 2026
db36e13
tosca: Minor formatting in hazards tests
Luni-4 Apr 21, 2026
20d8daa
tosca: Inline some tests functions
Luni-4 Apr 21, 2026
049af5c
tosca: Refactor parameters
Luni-4 Apr 21, 2026
6c8d3ee
tosca: Introduce the device scheme
Luni-4 Apr 21, 2026
b5d355f
tosca: Remove mandatory routes
Luni-4 Apr 21, 2026
2fed7c3
tosca: Move featureless route module test upward
Luni-4 Apr 21, 2026
341a1f0
tosca: State more clearly borrowing in route data
Luni-4 Apr 21, 2026
21d81e9
tosca: Fix test
Luni-4 Apr 21, 2026
99ba606
tosca-os: Add trait to compare errors in tests
Luni-4 Apr 21, 2026
73eb2e9
tosca-os: Implement device scheme
Luni-4 Apr 21, 2026
a10dc89
tosca-esp32c3: Change error info ownership
Luni-4 Apr 21, 2026
9b889df
tosca-esp32c3: Simplify ownership model
Luni-4 Apr 21, 2026
c384c5e
tosca-esp32c3: Implement device scheme
Luni-4 Apr 21, 2026
17c43f5
tosca-controller: Use new `tosca`
Luni-4 Apr 21, 2026
11e1c0e
tosca-controller: Implement the device scheme
Luni-4 Apr 21, 2026
865fb11
tosca-esp32c3: Update examples to new APIs
Luni-4 Apr 21, 2026
e2d54ed
examples: Update to new APIs
Luni-4 Apr 21, 2026
317ee46
misc: Bump workspace version
Luni-4 Apr 21, 2026
06c823b
misc: Update Cargo.lock files
Luni-4 Apr 21, 2026
c634b0a
tosca-controller: Fix docs typos
Luni-4 Apr 22, 2026
b35cc51
tosca-os: Fix docs typo
Luni-4 Apr 22, 2026
98e3a42
tosca-esp32c3: Fix docs typos
Luni-4 Apr 22, 2026
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
76 changes: 38 additions & 38 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ members = ["crates/*", "examples/*"]
exclude = ["crates/tosca-esp32c3"]

[workspace.package]
version = "0.1.1"
version = "0.2.0"
authors = ["Michele Valsesia <michele.valsesia@toscalabs.org>"]
description = "A versatile, customizable, and secure IoT framework."
edition = "2024"
Expand All @@ -18,10 +18,10 @@ rust-version = "1.90"
readme = "README.md"

[workspace.dependencies]
tosca = { version = "0.1.1", path = "crates/tosca", default-features = false }
tosca-os = { version = "0.1.1", path = "crates/tosca-os", default-features = false }
tosca-drivers = { version = "0.1.1", path = "crates/tosca-drivers", default-features = false }
tosca-controller = { version = "0.1.1", path = "crates/tosca-controller" }
tosca = { version = "0.2.0", path = "crates/tosca", default-features = false }
tosca-os = { version = "0.2.0", path = "crates/tosca-os", default-features = false }
tosca-drivers = { version = "0.2.0", path = "crates/tosca-drivers", default-features = false }
tosca-controller = { version = "0.2.0", path = "crates/tosca-controller" }

hashbrown = { version = "0.17", default-features = false, features = ["default-hasher"] }
indexmap = { version = "2.12", default-features = false }
Expand Down
31 changes: 18 additions & 13 deletions crates/tosca-controller/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl RequestSender<'_> {
/// and affect the returned response as well.
pub async fn send_with_parameters(
&self,
parameters: &ParametersValues<'_>,
parameters: &ParametersValues,
) -> Result<Response, Error> {
if self.request.parameters_data.is_empty() {
warn!("The request does not have input parameters.");
Expand Down Expand Up @@ -349,9 +349,9 @@ mod tests {
use crate::policy::Policy;
use crate::response::Response;

use crate::device::tests::{create_light, create_unknown};
use crate::device::tests::{create_custom_device, create_light};
use crate::discovery::tests::configure_discovery;
use crate::tests::{Brightness, check_function_with_device};
use crate::tests::{Brightness, light_with_toggle, run_one_device};

use super::{Controller, DeviceSender, RequestSender, sender_error};

Expand All @@ -374,15 +374,15 @@ mod tests {

#[test]
fn controller_from_devices() {
let devices = Devices::from_devices(vec![create_light(), create_unknown()]);
let devices = Devices::from_devices(vec![create_light(), create_custom_device()]);

let controller = Controller::from_devices(configure_discovery(), devices);

assert_eq!(
controller,
Controller {
discovery: configure_discovery(),
devices: Devices::from_devices(vec![create_light(), create_unknown()]),
devices: Devices::from_devices(vec![create_light(), create_custom_device()]),
privacy_policy: Policy::init(),
}
);
Expand All @@ -398,7 +398,7 @@ mod tests {
async fn check_ok_response_with_parameters(
device_sender: &DeviceSender<'_>,
route: &str,
parameters: &ParametersValues<'_>,
parameters: &ParametersValues,
) {
check_ok_response(device_sender, route, async move |request_sender| {
request_sender.send_with_parameters(parameters).await
Expand Down Expand Up @@ -447,7 +447,7 @@ mod tests {
>(
device_sender: &DeviceSender<'_>,
route: &str,
parameters: &ParametersValues<'_>,
parameters: &ParametersValues,
value: T,
) {
check_serial_response(
Expand Down Expand Up @@ -573,7 +573,7 @@ mod tests {
}

#[inline]
async fn run_controller_function<F, Fut>(name: &str, function: F)
async fn controller_test<F, Fut>(name: &str, function: F)
where
F: FnOnce() -> Fut,
Fut: Future<Output = ()>,
Expand All @@ -584,17 +584,22 @@ mod tests {
name
);
} else {
check_function_with_device(|| async {
function().await;
})
run_one_device(
|close_rx| async {
light_with_toggle(close_rx).await;
},
|| async {
function().await;
},
)
.await;
}
}

#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
#[serial]
async fn test_without_policy_controller() {
run_controller_function("controller_without_policy", || async {
controller_test("controller_without_policy", || async {
controller_without_policy().await;
})
.await;
Expand All @@ -603,7 +608,7 @@ mod tests {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
#[serial]
async fn test_with_policy_controller() {
run_controller_function("controller_with_policy", || async {
controller_test("controller_with_policy", || async {
controller_with_policy().await;
})
.await;
Expand Down
Loading