Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rsdk 9697 support multiple nvs #376

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion micro-rdk-ffi/src/ffi/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ pub unsafe extern "C" fn viam_server_start(ctx: *mut viam_server_context) -> via
None
}.expect("has_robot_config set in cfg, but build-time configuration failed to set robot credentials");
ram_storage
.store_robot_credentials(cloud_conf)
.store_robot_credentials(&cloud_conf)
.expect("Failed to store cloud config");
if ROBOT_APP_ADDRESS.is_some() {
ram_storage
Expand Down
4 changes: 2 additions & 2 deletions micro-rdk-server/esp32/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ mod esp32 {
if SSID.is_some() && PASS.is_some() {
log::info!("Storing static values from build time wifi configuration to NVS");
storage
.store_wifi_credentials(WifiCredentials::new(
.store_wifi_credentials(&WifiCredentials::new(
SSID.unwrap().to_string(),
PASS.unwrap().to_string(),
))
Expand All @@ -96,7 +96,7 @@ mod esp32 {
log::info!("Storing static values from build time robot configuration to NVS");
storage
.store_robot_credentials(
RobotCredentials::new(
&RobotCredentials::new(
ROBOT_ID.unwrap().to_string(),
ROBOT_SECRET.unwrap().to_string(),
)
Expand Down
2 changes: 1 addition & 1 deletion micro-rdk-server/native/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ mod native {
log::info!("Storing static values from build time robot configuration");
storage
.store_robot_credentials(
RobotCredentials::new(
&RobotCredentials::new(
ROBOT_ID.unwrap().to_string(),
ROBOT_SECRET.unwrap().to_string(),
)
Expand Down
10 changes: 5 additions & 5 deletions micro-rdk/src/common/conn/viam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ where
.await
.map(|cert_resp| {
let cert: TlsCertificate = cert_resp.into();
match self.storage.store_tls_certificate(cert.clone()) {
match self.storage.store_tls_certificate(&cert) {
Ok(_) => {
log::debug!("stored TLS certificate received by app");
}
Expand Down Expand Up @@ -1290,7 +1290,7 @@ mod tests {
secret: "".to_string(),
app_address: LOCALHOST_URI.to_owned(),
};
assert!(ram_storage.store_robot_credentials(creds).is_ok());
assert!(ram_storage.store_robot_credentials(&creds).is_ok());

let mdns = NativeMdns::new("".to_owned(), network.get_ip());
assert!(mdns.is_ok());
Expand Down Expand Up @@ -1350,7 +1350,7 @@ mod tests {
secret: "".to_string(),
app_address: LOCALHOST_URI.to_owned(),
};
assert!(ram_storage.store_robot_credentials(creds).is_ok());
assert!(ram_storage.store_robot_credentials(&creds).is_ok());

let mdns = NativeMdns::new("".to_owned(), network.get_ip());
assert!(mdns.is_ok());
Expand Down Expand Up @@ -1460,7 +1460,7 @@ mod tests {
app_address: LOCALHOST_URI.to_owned(),
};

assert!(ram_storage.store_robot_credentials(creds).is_ok());
assert!(ram_storage.store_robot_credentials(&creds).is_ok());

let mdns = NativeMdns::new("".to_owned(), network.get_ip());
assert!(mdns.is_ok());
Expand Down Expand Up @@ -1787,7 +1787,7 @@ mod tests {
_ => panic!("oops expected ipv4"),
};

ram_storage.store_robot_credentials(creds).unwrap();
ram_storage.store_robot_credentials(&creds).unwrap();

let mut a = ViamServerBuilder::new(ram_storage);
let mdns = NativeMdns::new("".to_owned(), Ipv4Addr::new(0, 0, 0, 0)).unwrap();
Expand Down
Loading
Loading