@@ -36,14 +36,14 @@ use rs_matter_embassy::matter::dm::devices::test::{
3636} ;
3737use rs_matter_embassy:: matter:: dm:: devices:: DEV_TYPE_ON_OFF_LIGHT ;
3838use rs_matter_embassy:: matter:: dm:: { Async , Dataver , EmptyHandler , Endpoint , EpClMatcher , Node } ;
39+ use rs_matter_embassy:: matter:: persist:: DummyKvBlobStore ;
3940use rs_matter_embassy:: matter:: utils:: init:: InitMaybeUninit ;
4041use rs_matter_embassy:: matter:: utils:: select:: Coalesce ;
4142use rs_matter_embassy:: matter:: { clusters, devices, BasicCommData } ;
4243use rs_matter_embassy:: ot:: openthread:: esp:: EspRadio ;
4344use rs_matter_embassy:: ot:: openthread:: { OpenThread , RamSettings } ;
4445use rs_matter_embassy:: ot:: { OtMatterResources , OtMdns , OtNetStack , OtNetif } ;
4546use rs_matter_embassy:: stack:: eth:: EthMatterStack ;
46- use rs_matter_embassy:: stack:: persist:: DummyKvBlobStore ;
4747use rs_matter_embassy:: stack:: rand:: { reseeding_csprng, RngAdaptor } ;
4848
4949use tinyrlibc as _;
@@ -189,13 +189,14 @@ async fn main(_s: Spawner) {
189189 Async ( desc:: DescHandler :: new ( Dataver :: new_rand ( & mut weak_rand) ) . adapt ( ) ) ,
190190 ) ;
191191
192- // Create the persister & load any previously saved state
193- // `EmbassyPersist`+`EmbassyKvBlobStore` saves to a user-supplied NOR Flash region
194- // However, for this demo and for simplicity, we use a dummy persister that does nothing
195- let persist = stack
196- . create_persist_with_comm_window ( & crypto, DummyKvBlobStore )
197- . await
198- . unwrap ( ) ;
192+ // Create a KV BLOB store and load any previously saved state of `rs-matter`
193+ // `SeqMapKvBlobStore` saves to a user-supplied NOR Flash region
194+ // However, for this demo and for simplicity, we use a dummy KV BLOB store that does nothing
195+ let mut kv = DummyKvBlobStore ;
196+ stack. startup ( & crypto, & mut kv) . await . unwrap ( ) ;
197+
198+ // Wrap the KV BLOB store as a shared reference, so that it can be used both by `rs-matter` and the user
199+ let kv = stack. create_shared_kv ( kv) . unwrap ( ) ;
199200
200201 // Run the Matter stack with our handler
201202 // Using `pin!` is completely optional, but reduces the size of the final future
@@ -206,12 +207,12 @@ async fn main(_s: Spawner) {
206207 OtNetif :: new( ot. clone( ) ) ,
207208 // The Matter stack needs an mDNS instance to run
208209 OtMdns :: new( ot. clone( ) ) ,
209- // The Matter stack needs a persister to store its state
210- & persist,
211210 // The crypto provider
212211 & crypto,
213212 // Our `AsyncHandler` + `AsyncMetadata` impl
214213 ( NODE , handler) ,
214+ // The Matter stack needs a blob store to store its state
215+ & kv,
215216 // No user future to run
216217 ( ) ,
217218 ) ) ;
0 commit comments