Skip to content

Commit

Permalink
Merge pull request #49 from quartiq/feature/nal-bump
Browse files Browse the repository at this point in the history
Updating embedded-nal to v0.8
  • Loading branch information
ryan-summers authored Apr 22, 2024
2 parents 3e3373e + 56bc647 commit 1f73380
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

This document describes the changes to smoltcp-nal between releases.

# [Unreleased]
# [0.5.0] - 2024-04-22

## Changed
* [breaking] Updated to `embedded-nal` v0.8
* Updated to smoltcp 0.11

# [0.4.1] - 2023-08-22
Expand Down Expand Up @@ -54,7 +55,8 @@ This document describes the changes to smoltcp-nal between releases.
# Version [0.1.0] - 2021-02-17
* Initial library release and publish to crates.io

[Unreleased]: https://github.com/quartiq/smoltcp-nal/compare/0.4.1...HEAD
[Unreleased]: https://github.com/quartiq/smoltcp-nal/compare/0.5.0...HEAD
[0.5.0]: https://github.com/quartiq/smoltcp-nal/tree/0.4.1
[0.4.1]: https://github.com/quartiq/smoltcp-nal/tree/0.4.1
[0.4.0]: https://github.com/quartiq/smoltcp-nal/tree/0.4.0
[0.3.0]: https://github.com/quartiq/smoltcp-nal/tree/0.3.0
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "smoltcp-nal"
version = "0.4.1"
version = "0.5.0"
authors = ["Ryan Summers <ryan.summers@vertigo-designs.com>"]
edition = "2018"
license = "MIT"
Expand All @@ -11,7 +11,7 @@ repository = "https://github.com/quartiq/smoltcp-nal.git"

[dependencies]
heapless = "0.7"
embedded-nal = "0.7"
embedded-nal = "0.8"
embedded-time = "0.12"

[dependencies.nanorand]
Expand Down
7 changes: 4 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ where
let handle = self.dns_handle.ok_or(NetworkError::Unsupported)?;
let dns_socket: &mut smoltcp::socket::dns::Socket = self.sockets.get_mut(handle);
let context = self.network_interface.context();
let key = heapless::String::try_from(hostname).map_err(|_| NetworkError::Unsupported)?;
let key = heapless::String::from(hostname);

if let Some(handle) = self.dns_lookups.get(&key) {
match dns_socket.get_query_result(*handle) {
Expand Down Expand Up @@ -733,9 +733,10 @@ where
}

fn get_host_by_address(
&mut self,
&self,
_addr: embedded_nal::IpAddr,
) -> embedded_nal::nb::Result<embedded_nal::heapless::String<256>, Self::Error> {
_: &mut [u8],
) -> Result<usize, Self::Error> {
unimplemented!()
}
}
10 changes: 9 additions & 1 deletion src/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,15 @@ where
type Error = S::Error;

forward! {get_host_by_name(hostname: &str, addr_type: embedded_nal::AddrType) -> embedded_nal::nb::Result<embedded_nal::IpAddr, Self::Error>}
forward! {get_host_by_address(addr: embedded_nal::IpAddr) -> embedded_nal::nb::Result<embedded_nal::heapless::String<256>, Self::Error>}

fn get_host_by_address(
&self,
addr: embedded_nal::IpAddr,
buf: &mut [u8],
) -> Result<usize, Self::Error> {
self.mutex
.lock(|stack| stack.get_host_by_address(addr, buf))
}
}

impl<'a, Device, Clock> NetworkManager<'a, Device, Clock>
Expand Down

0 comments on commit 1f73380

Please sign in to comment.