chirpstack/lrwn/src/error.rs
Orne Brocaar 6cc813aed1 Implement DevAddrPrefix type.
This type defines the (NetID derived) prefix that must be used when
generating device addresses. This can be retrieved from the NetID, but
it is also possible to define a prefix that defines a smaller address
range within the NetID.

See also #49.
2022-10-19 12:03:55 +01:00

23 lines
490 B
Rust

use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("NetID expects exactly 3 bytes")]
NetIdLength,
#[error("EUI64 expects exactly 8 bytes")]
Eui64Length,
#[error("AES128Key expects exactly 16 bytes")]
Aes128Length,
#[error("DevAddr expects exactly 4 bytes")]
DevAddrLength,
#[error("DevAddrPrefix must be in the form 00000000/0")]
DevAddrPrefixFormat,
#[error(transparent)]
FromHexError(#[from] hex::FromHexError),
}