Skip to content

Commit

Permalink
Add EspNetif::set_ip_info
Browse files Browse the repository at this point in the history
  • Loading branch information
torkleyy committed Mar 25, 2024
1 parent 1d522b7 commit cf40c85
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/netif.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,20 @@ impl EspNetif {
})
}

pub fn set_ip_info(&mut self, ip_info: ipv4::IpInfo) -> Result<(), EspError> {
let mut raw_ip_info: Newtype<esp_netif_ip_info_t> = ip_info.clone().into();

unsafe { esp!(esp_netif_set_ip_info(self.0, &mut raw_ip_info.0)) }?;
if let Some(dns) = ip_info.dns {
self.set_dns(dns);
}
if let Some(dns) = ip_info.secondary_dns {
self.set_secondary_dns(dns);
}

Ok(())
}

pub fn get_key(&self) -> heapless::String<32> {
unsafe { from_cstr_ptr(esp_netif_get_ifkey(self.0)) }
.try_into()
Expand Down

0 comments on commit cf40c85

Please sign in to comment.