Skip to content

Commit

Permalink
Update readme example
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed Jun 27, 2024
1 parent ec5c5a7 commit cbeb9cb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ The [`esp-idf-matter`](https://github.com/ivmarkov/esp-idf-matter) crate provide
//!
//! The example implements a fictitious Light device (an On-Off Matter cluster).

use core::borrow::Borrow;
use core::pin::pin;

use embassy_futures::select::select;
Expand All @@ -66,7 +65,7 @@ use log::info;
use rs_matter::data_model::cluster_basic_information::BasicInfoConfig;
use rs_matter::data_model::cluster_on_off;
use rs_matter::data_model::device_types::DEV_TYPE_ON_OFF_LIGHT;
use rs_matter::data_model::objects::{Endpoint, HandlerCompat, Node};
use rs_matter::data_model::objects::{Dataver, Endpoint, HandlerCompat, Node};
use rs_matter::data_model::system_model::descriptor;
use rs_matter::error::Error;
use rs_matter::secure_channel::spake2p::VerifierData;
Expand Down Expand Up @@ -95,7 +94,7 @@ fn main() -> Result<(), Error> {

// Our "light" on-off cluster.
// Can be anything implementing `rs_matter::data_model::AsyncHandler`
let on_off = cluster_on_off::OnOffCluster::new(*stack.matter().borrow());
let on_off = cluster_on_off::OnOffCluster::new(Dataver::new_rand(stack.matter().rand()));

// Chain our endpoint clusters with the
// (root) Endpoint 0 system clusters in the final handler
Expand All @@ -112,7 +111,9 @@ fn main() -> Result<(), Error> {
.chain(
LIGHT_ENDPOINT_ID,
descriptor::ID,
HandlerCompat(descriptor::DescriptorCluster::new(*stack.matter().borrow())),
HandlerCompat(descriptor::DescriptorCluster::new(Dataver::new_rand(
stack.matter().rand(),
))),
);

// Run the Matter stack with our handler
Expand All @@ -125,7 +126,7 @@ fn main() -> Result<(), Error> {
UnixNetif::default(),
// Hard-coded for demo purposes
CommissioningData {
verifier: VerifierData::new_with_pw(123456, *stack.matter().borrow()),
verifier: VerifierData::new_with_pw(123456, stack.matter().rand()),
discriminator: 250,
},
// Our `AsyncHandler` + `AsyncMetadata` impl
Expand Down

0 comments on commit cbeb9cb

Please sign in to comment.