Skip to content

Commit a179127

Browse files
committed
Update to upstream rs-matter
1 parent 903f019 commit a179127

17 files changed

Lines changed: 212 additions & 200 deletions

File tree

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ exclude = ["examples"]
88

99
[patch.crates-io]
1010
#rs-matter = { git = "https://github.com/project-chip/rs-matter" }
11-
rs-matter = { git = "https://github.com/sysgrok/rs-matter", branch = "next" }
11+
#rs-matter = { git = "https://github.com/sysgrok/rs-matter", branch = "next" }
12+
rs-matter = { git = "https://github.com/sysgrok/rs-matter", branch = "inband-persistence" }
1213
#rs-matter = { path = "../../rs-matter/rs-matter" }
13-
rs-matter-stack = { git = "https://github.com/ivmarkov/rs-matter-stack.git", branch = "next" }
14+
#rs-matter-stack = { git = "https://github.com/ivmarkov/rs-matter-stack.git", branch = "next" }
15+
rs-matter-stack = { git = "https://github.com/ivmarkov/rs-matter-stack.git", branch = "inband-persistence" }
1416
#rs-matter-stack = { path = "../../rs-matter-stack" }
1517
openthread = { git = "https://github.com/sysgrok/openthread.git", branch = "next" }
1618
#openthread = { path = "../../../openthread/openthread" }

examples/esp/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ required-features = ["thread"]
3030
harness = false
3131

3232
[patch.crates-io]
33-
rs-matter = { git = "https://github.com/sysgrok/rs-matter", branch = "next" }
33+
#rs-matter = { git = "https://github.com/sysgrok/rs-matter", branch = "next" }
34+
rs-matter = { git = "https://github.com/sysgrok/rs-matter", branch = "inband-persistence" }
3435
#rs-matter = { path = "../../../rs-matter/rs-matter" }
35-
rs-matter-stack = { git = "https://github.com/sysgrok/rs-matter-stack.git", branch = "next" }
36+
#rs-matter-stack = { git = "https://github.com/sysgrok/rs-matter-stack.git", branch = "next" }
37+
rs-matter-stack = { git = "https://github.com/ivmarkov/rs-matter-stack.git", branch = "inband-persistence" }
3638
#rs-matter-stack = { path = "../../../rs-matter-stack" }
3739
openthread = { git = "https://github.com/sysgrok/openthread.git", branch = "next" }
3840
#openthread = { path = "../../../openthread/openthread" }

examples/esp/src/bin/light_eth.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ use rs_matter_embassy::matter::dm::devices::test::{
3737
};
3838
use rs_matter_embassy::matter::dm::devices::DEV_TYPE_ON_OFF_LIGHT;
3939
use rs_matter_embassy::matter::dm::{Async, Dataver, EmptyHandler, Endpoint, EpClMatcher, Node};
40+
use rs_matter_embassy::matter::persist::DummyKvBlobStore;
4041
use rs_matter_embassy::matter::utils::init::InitMaybeUninit;
4142
use rs_matter_embassy::matter::utils::select::Coalesce;
4243
use rs_matter_embassy::matter::{clusters, devices};
43-
use rs_matter_embassy::stack::persist::DummyKvBlobStore;
4444
use rs_matter_embassy::stack::rand::reseeding_csprng;
4545
use rs_matter_embassy::stack::utils::futures::IntoFaillble;
4646

@@ -151,13 +151,14 @@ async fn main(_s: Spawner) {
151151
Async(desc::DescHandler::new(Dataver::new_rand(&mut weak_rand)).adapt()),
152152
);
153153

154-
// Create the persister & load any previously saved state
155-
// `EmbassyPersist`+`EmbassyKvBlobStore` saves to a user-supplied NOR Flash region
156-
// However, for this demo and for simplicity, we use a dummy persister that does nothing
157-
let persist = stack
158-
.create_persist_with_comm_window(&crypto, DummyKvBlobStore)
159-
.await
160-
.unwrap();
154+
// Create a KV BLOB store and load any previously saved state of `rs-matter`
155+
// `SeqMapKvBlobStore` saves to a user-supplied NOR Flash region
156+
// However, for this demo and for simplicity, we use a dummy KV BLOB store that does nothing
157+
let mut kv = DummyKvBlobStore;
158+
stack.startup(&crypto, &mut kv).await.unwrap();
159+
160+
// Wrap the KV BLOB store as a shared reference, so that it can be used both by `rs-matter` and the user
161+
let kv = stack.create_shared_kv(kv).unwrap();
161162

162163
// Run the Matter stack with our handler
163164
// Using `pin!` is completely optional, but reduces the size of the final future
@@ -168,12 +169,12 @@ async fn main(_s: Spawner) {
168169
weak_rand,
169170
stack,
170171
),
171-
// The Matter stack needs a persister to store its state
172-
&persist,
173172
// The crypto provider
174173
&crypto,
175174
// Our `AsyncHandler` + `AsyncMetadata` impl
176175
(NODE, handler),
176+
// The Matter stack needs a blob store to store its state
177+
&kv,
177178
// No user future to run
178179
(),
179180
));

examples/esp/src/bin/light_eth2.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ use rs_matter_embassy::matter::dm::devices::test::{
3636
};
3737
use rs_matter_embassy::matter::dm::devices::DEV_TYPE_ON_OFF_LIGHT;
3838
use rs_matter_embassy::matter::dm::{Async, Dataver, EmptyHandler, Endpoint, EpClMatcher, Node};
39+
use rs_matter_embassy::matter::persist::DummyKvBlobStore;
3940
use rs_matter_embassy::matter::utils::init::InitMaybeUninit;
4041
use rs_matter_embassy::matter::utils::select::Coalesce;
4142
use rs_matter_embassy::matter::{clusters, devices, BasicCommData};
4243
use rs_matter_embassy::ot::openthread::esp::EspRadio;
4344
use rs_matter_embassy::ot::openthread::{OpenThread, RamSettings};
4445
use rs_matter_embassy::ot::{OtMatterResources, OtMdns, OtNetStack, OtNetif};
4546
use rs_matter_embassy::stack::eth::EthMatterStack;
46-
use rs_matter_embassy::stack::persist::DummyKvBlobStore;
4747
use rs_matter_embassy::stack::rand::{reseeding_csprng, RngAdaptor};
4848

4949
use 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
));

examples/esp/src/bin/light_thread.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ use rs_matter_embassy::matter::dm::devices::test::{
3333
};
3434
use rs_matter_embassy::matter::dm::devices::DEV_TYPE_ON_OFF_LIGHT;
3535
use rs_matter_embassy::matter::dm::{Async, Dataver, EmptyHandler, Endpoint, EpClMatcher, Node};
36+
use rs_matter_embassy::matter::persist::DummyKvBlobStore;
3637
use rs_matter_embassy::matter::utils::init::InitMaybeUninit;
3738
use rs_matter_embassy::matter::{clusters, devices, BasicCommData};
38-
use rs_matter_embassy::stack::persist::DummyKvBlobStore;
3939
use rs_matter_embassy::stack::rand::reseeding_csprng;
4040
use rs_matter_embassy::wireless::esp::EspThreadDriver;
4141
use rs_matter_embassy::wireless::{EmbassyThread, EmbassyThreadMatterStack};
@@ -157,13 +157,14 @@ async fn main(_s: Spawner) {
157157
Async(desc::DescHandler::new(Dataver::new_rand(&mut weak_rand)).adapt()),
158158
);
159159

160-
// Create the persister & load any previously saved state
161-
// `EmbassyPersist`+`EmbassyKvBlobStore` saves to a user-supplied NOR Flash region
162-
// However, for this demo and for simplicity, we use a dummy persister that does nothing
163-
let persist = stack
164-
.create_persist_with_comm_window(&crypto, DummyKvBlobStore)
165-
.await
166-
.unwrap();
160+
// Create a KV BLOB store and load any previously saved state of `rs-matter`
161+
// `SeqMapKvBlobStore` saves to a user-supplied NOR Flash region
162+
// However, for this demo and for simplicity, we use a dummy KV BLOB store that does nothing
163+
let mut kv = DummyKvBlobStore;
164+
stack.startup(&crypto, &mut kv).await.unwrap();
165+
166+
// Wrap the KV BLOB store as a shared reference, so that it can be used both by `rs-matter` and the user
167+
let kv = stack.create_shared_kv(kv).unwrap();
167168

168169
// Run the Matter stack with our handler
169170
// Using `pin!` is completely optional, but reduces the size of the final future
@@ -175,16 +176,16 @@ async fn main(_s: Spawner) {
175176
EspThreadDriver::new(peripherals.IEEE802154, peripherals.BT),
176177
crypto.rand().unwrap(),
177178
ieee_eui64,
178-
persist.store(),
179+
&kv,
179180
stack,
180181
true, // Use a random BLE address
181182
),
182-
// The Matter stack needs a persister to store its state
183-
&persist,
184183
// The crypto provider
185184
&crypto,
186185
// Our `AsyncHandler` + `AsyncMetadata` impl
187186
(NODE, handler),
187+
// The Matter stack needs a blob store to store its state
188+
&kv,
188189
// No user future to run
189190
(),
190191
));

examples/esp/src/bin/light_thread_coex.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ use rs_matter_embassy::matter::dm::devices::test::{
3434
};
3535
use rs_matter_embassy::matter::dm::devices::DEV_TYPE_ON_OFF_LIGHT;
3636
use rs_matter_embassy::matter::dm::{Async, Dataver, EmptyHandler, Endpoint, EpClMatcher, Node};
37+
use rs_matter_embassy::matter::persist::DummyKvBlobStore;
3738
use rs_matter_embassy::matter::utils::init::InitMaybeUninit;
3839
use rs_matter_embassy::matter::{clusters, devices, BasicCommData};
39-
use rs_matter_embassy::stack::persist::DummyKvBlobStore;
4040
use rs_matter_embassy::stack::rand::reseeding_csprng;
4141
use rs_matter_embassy::wireless::esp::EspThreadDriver;
4242
use rs_matter_embassy::wireless::{EmbassyThread, EmbassyThreadMatterStack};
@@ -158,13 +158,14 @@ async fn main(_s: Spawner) {
158158
Async(desc::DescHandler::new(Dataver::new_rand(&mut weak_rand)).adapt()),
159159
);
160160

161-
// Create the persister & load any previously saved state
162-
// `EmbassyPersist`+`EmbassyKvBlobStore` saves to a user-supplied NOR Flash region
163-
// However, for this demo and for simplicity, we use a dummy persister that does nothing
164-
let persist = stack
165-
.create_persist_with_comm_window(&crypto, DummyKvBlobStore)
166-
.await
167-
.unwrap();
161+
// Create a KV BLOB store and load any previously saved state of `rs-matter`
162+
// `SeqMapKvBlobStore` saves to a user-supplied NOR Flash region
163+
// However, for this demo and for simplicity, we use a dummy KV BLOB store that does nothing
164+
let mut kv = DummyKvBlobStore;
165+
stack.startup(&crypto, &mut kv).await.unwrap();
166+
167+
// Wrap the KV BLOB store as a shared reference, so that it can be used both by `rs-matter` and the user
168+
let kv = stack.create_shared_kv(kv).unwrap();
168169

169170
// Run the Matter stack with our handler
170171
// Using `pin!` is completely optional, but reduces the size of the final future
@@ -176,16 +177,16 @@ async fn main(_s: Spawner) {
176177
EspThreadDriver::new(peripherals.IEEE802154, peripherals.BT),
177178
crypto.rand().unwrap(),
178179
ieee_eui64,
179-
persist.store(),
180+
&kv,
180181
stack,
181182
true, // Use a random BLE address
182183
),
183-
// The Matter stack needs a persister to store its state
184-
&persist,
185184
// The crypto provider
186185
&crypto,
187186
// Our `AsyncHandler` + `AsyncMetadata` impl
188187
(NODE, handler),
188+
// The Matter stack needs a blob store to store its state
189+
&kv,
189190
// No user future to run
190191
(),
191192
));

examples/esp/src/bin/light_wifi.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ use rs_matter_embassy::matter::dm::devices::test::{
3636
};
3737
use rs_matter_embassy::matter::dm::devices::DEV_TYPE_ON_OFF_LIGHT;
3838
use rs_matter_embassy::matter::dm::{Async, Dataver, EmptyHandler, Endpoint, EpClMatcher, Node};
39+
use rs_matter_embassy::matter::persist::DummyKvBlobStore;
3940
use rs_matter_embassy::matter::utils::init::InitMaybeUninit;
4041
use rs_matter_embassy::matter::{clusters, devices};
41-
use rs_matter_embassy::stack::persist::DummyKvBlobStore;
4242
use rs_matter_embassy::stack::rand::reseeding_csprng;
4343
use rs_matter_embassy::wireless::esp::EspWifiDriver;
4444
use rs_matter_embassy::wireless::{EmbassyWifi, EmbassyWifiMatterStack};
@@ -143,13 +143,14 @@ async fn main(_s: Spawner) {
143143
Async(desc::DescHandler::new(Dataver::new_rand(&mut weak_rand)).adapt()),
144144
);
145145

146-
// Create the persister & load any previously saved state
147-
// `EmbassyPersist`+`EmbassyKvBlobStore` saves to a user-supplied NOR Flash region
148-
// However, for this demo and for simplicity, we use a dummy persister that does nothing
149-
let persist = stack
150-
.create_persist_with_comm_window(&crypto, DummyKvBlobStore)
151-
.await
152-
.unwrap();
146+
// Create a KV BLOB store and load any previously saved state of `rs-matter`
147+
// `SeqMapKvBlobStore` saves to a user-supplied NOR Flash region
148+
// However, for this demo and for simplicity, we use a dummy KV BLOB store that does nothing
149+
let mut kv = DummyKvBlobStore;
150+
stack.startup(&crypto, &mut kv).await.unwrap();
151+
152+
// Wrap the KV BLOB store as a shared reference, so that it can be used both by `rs-matter` and the user
153+
let kv = stack.create_shared_kv(kv).unwrap();
153154

154155
// Run the Matter stack with our handler
155156
// Using `pin!` is completely optional, but reduces the size of the final future
@@ -163,12 +164,12 @@ async fn main(_s: Spawner) {
163164
true, // Use a random BLE address
164165
stack,
165166
),
166-
// The Matter stack needs a persister to store its state
167-
&persist,
168167
// The crypto provider
169168
&crypto,
170169
// Our `AsyncHandler` + `AsyncMetadata` impl
171170
(NODE, handler),
171+
// The Matter stack needs a blob store to store its state
172+
&kv,
172173
// No user future to run
173174
(),
174175
));

examples/nrf/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ incremental = false
2929
overflow-checks = false
3030

3131
[patch.crates-io]
32-
#rs-matter = { git = "https://github.com/project-chip/rs-matter" }
33-
rs-matter = { git = "https://github.com/sysgrok/rs-matter", branch = "next" }
32+
#rs-matter = { git = "https://github.com/sysgrok/rs-matter", branch = "next" }
33+
rs-matter = { git = "https://github.com/sysgrok/rs-matter", branch = "inband-persistence" }
3434
#rs-matter = { path = "../../../rs-matter/rs-matter" }
35-
rs-matter-stack = { git = "https://github.com/sysgrok/rs-matter-stack.git", branch = "next" }
35+
#rs-matter-stack = { git = "https://github.com/sysgrok/rs-matter-stack.git", branch = "next" }
36+
rs-matter-stack = { git = "https://github.com/ivmarkov/rs-matter-stack.git", branch = "inband-persistence" }
3637
#rs-matter-stack = { path = "../../../rs-matter-stack" }
3738
openthread = { git = "https://github.com/sysgrok/openthread.git", branch = "next" }
3839
#openthread = { version = "0.1", path = "../../../openthread/openthread" }

examples/nrf/src/bin/light_eth.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ use rs_matter_embassy::matter::dm::devices::test::{
3838
};
3939
use rs_matter_embassy::matter::dm::devices::DEV_TYPE_ON_OFF_LIGHT;
4040
use rs_matter_embassy::matter::dm::{Async, Dataver, EmptyHandler, Endpoint, EpClMatcher, Node};
41+
use rs_matter_embassy::matter::persist::DummyKvBlobStore;
4142
use rs_matter_embassy::matter::utils::init::InitMaybeUninit;
4243
use rs_matter_embassy::matter::utils::select::Coalesce;
4344
use rs_matter_embassy::matter::{clusters, devices, BasicCommData};
@@ -49,7 +50,6 @@ use rs_matter_embassy::ot::openthread::{
4950
};
5051
use rs_matter_embassy::ot::{OtMatterResources, OtMdns, OtNetStack, OtNetif};
5152
use rs_matter_embassy::stack::eth::EthMatterStack;
52-
use rs_matter_embassy::stack::persist::DummyKvBlobStore;
5353

5454
use panic_rtt_target as _;
5555

@@ -216,10 +216,14 @@ async fn main(_s: Spawner) {
216216
Async(desc::DescHandler::new(Dataver::new_rand(&mut weak_rand)).adapt()),
217217
);
218218

219-
let persist = stack
220-
.create_persist_with_comm_window(&crypto, DummyKvBlobStore)
221-
.await
222-
.unwrap();
219+
// Create a KV BLOB store and load any previously saved state of `rs-matter`
220+
// `SeqMapKvBlobStore` saves to a user-supplied NOR Flash region
221+
// However, for this demo and for simplicity, we use a dummy KV BLOB store that does nothing
222+
let mut kv = DummyKvBlobStore;
223+
stack.startup(&crypto, &mut kv).await.unwrap();
224+
225+
// Wrap the KV BLOB store as a shared reference, so that it can be used both by `rs-matter` and the user
226+
let kv = stack.create_shared_kv(kv).unwrap();
223227

224228
// Run the Matter stack with our handler
225229
// Using `pin!` is completely optional, but reduces the size of the final future
@@ -232,12 +236,12 @@ async fn main(_s: Spawner) {
232236
OtNetif::new(ot.clone()),
233237
// The Matter stack needs an mDNS to run
234238
OtMdns::new(ot.clone()),
235-
// The Matter stack needs a persister to store its state
236-
&persist,
237239
// The crypto provider
238240
&crypto,
239241
// Our `AsyncHandler` + `AsyncMetadata` impl
240242
(NODE, handler),
243+
// The Matter stack needs a blob store to store its state
244+
&kv,
241245
// No user future to run
242246
(),
243247
));

examples/nrf/src/bin/light_thread.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ use rs_matter_embassy::matter::dm::devices::test::{
3535
};
3636
use rs_matter_embassy::matter::dm::devices::DEV_TYPE_ON_OFF_LIGHT;
3737
use rs_matter_embassy::matter::dm::{Async, Dataver, EmptyHandler, Endpoint, EpClMatcher, Node};
38+
use rs_matter_embassy::matter::persist::DummyKvBlobStore;
3839
use rs_matter_embassy::matter::utils::init::InitMaybeUninit;
3940
use rs_matter_embassy::matter::{clusters, devices, BasicCommData};
40-
use rs_matter_embassy::stack::persist::DummyKvBlobStore;
4141
use rs_matter_embassy::stack::rand::reseeding_csprng;
4242
use rs_matter_embassy::wireless::nrf::{
4343
NrfThreadClockInterruptHandler, NrfThreadHighPrioInterruptHandler,
@@ -206,10 +206,14 @@ async fn main(_s: Spawner) {
206206
Async(desc::DescHandler::new(Dataver::new_rand(&mut weak_rand)).adapt()),
207207
);
208208

209-
let persist = stack
210-
.create_persist_with_comm_window(&crypto, DummyKvBlobStore)
211-
.await
212-
.unwrap();
209+
// Create a KV BLOB store and load any previously saved state of `rs-matter`
210+
// `SeqMapKvBlobStore` saves to a user-supplied NOR Flash region
211+
// However, for this demo and for simplicity, we use a dummy KV BLOB store that does nothing
212+
let mut kv = DummyKvBlobStore;
213+
stack.startup(&crypto, &mut kv).await.unwrap();
214+
215+
// Wrap the KV BLOB store as a shared reference, so that it can be used both by `rs-matter` and the user
216+
let kv = stack.create_shared_kv(kv).unwrap();
213217

214218
// Run the Matter stack with our handler
215219
// Using `pin!` is completely optional, but reduces the size of the final future
@@ -221,16 +225,16 @@ async fn main(_s: Spawner) {
221225
thread_driver,
222226
crypto.rand().unwrap(),
223227
ieee_eui64,
224-
persist.store(),
228+
&kv,
225229
stack,
226230
true, // Use a random BLE address
227231
),
228-
// The Matter stack needs a persister to store its state
229-
&persist,
230232
// The crypto provider
231233
&crypto,
232234
// Our `AsyncHandler` + `AsyncMetadata` impl
233235
(NODE, handler),
236+
// The Matter stack needs a blob store to store its state
237+
&kv,
234238
// No user future to run
235239
(),
236240
));

0 commit comments

Comments
 (0)