Skip to content

Commit

Permalink
add no_std
Browse files Browse the repository at this point in the history
  • Loading branch information
thebino committed Oct 4, 2024
1 parent fef0267 commit 2b74fef
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 67 deletions.
57 changes: 0 additions & 57 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@ license = "MIT OR Apache-2.0"


[dependencies]
bitmaps = "3.2.1"
serde = "1"
serde_derive = "1"
bitmaps = { version = "3.2.1", default-features = false }

5 changes: 5 additions & 0 deletions src/aps/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pub(crate) enum ApsError {
// Value is not within the valid range
InvalidValue,
}

6 changes: 1 addition & 5 deletions src/aps/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#![allow(dead_code)]

use serde_derive::{Serialize, Deserialize};

mod error;
mod types;

trait ApsdeSap {
Expand All @@ -26,7 +25,6 @@ struct ApsdeSapRequest {
radius_counter: u8
}

#[derive(Serialize, Deserialize)]
enum ApsdeSapConfirmStatus {
Success,
NoShortAddress,
Expand All @@ -45,13 +43,11 @@ struct ApsdeSapConfirm {
tx_time: u8,
}

#[derive(Serialize, Deserialize)]
enum ApsdeSapIndicationStatus {
Success,
DefragUnsupported,
DefragDeferred
}
#[derive(Serialize, Deserialize)]
enum SecurityStatus {
Unsecured,
SecuredNwkKey,
Expand Down
6 changes: 4 additions & 2 deletions src/aps/types/mod.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
//! Bounded address
//! 2.2.4.1.1
use super::error::ApsError;
pub struct SrcEndpoint {
value: u8
}

impl SrcEndpoint {
pub fn new(value: u8) -> Result<Self, String> {
pub fn new(value: u8) -> Result<Self, ApsError> {
if value <= 254 {
Ok(SrcEndpoint { value })
} else {
Err(format!("Value {} is not within the valid range 0x00 – 0xfe", value))
Err(ApsError::InvalidValue)
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![no_std]

//! # zigbee
//!
//! ZigBee is a protocol stack based on the ZigBee specification 22 1.0
Expand Down

0 comments on commit 2b74fef

Please sign in to comment.