-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
167 additions
and
122 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#![allow(dead_code)] | ||
use crate::aps::types; | ||
|
||
|
||
/// Application support sub-layer data entity – service access point | ||
/// | ||
/// 2.2.4.1.1 | ||
/// | ||
/// Interface between the NWK (Network) layer and the APL (Application) layer | ||
/// through a general set of services for use by both the ZDO (device object) and the application. | ||
pub trait ApsdeSap { | ||
/// Requests the transfer of a NHLE PDU from a local NHLE to one or more peer NHLE entities | ||
fn data_request(&self, request: ApsdeSapRequest) -> ApsdeSapConfirm; | ||
} | ||
|
||
|
||
type DstAddrMode = u8; | ||
// 2.2.4.1.1 | ||
pub struct ApsdeSapRequest { | ||
dst_addr_mode: DstAddrMode, | ||
dst_address: u8, | ||
dst_endpoint: u8, | ||
profile_id: u16, | ||
cluster_id: u16, | ||
src_endpoint: types::SrcEndpoint, | ||
asdulength: u8, | ||
asdu: u8, | ||
tx_options: bitmaps::Bitmap<8>, | ||
use_alias: bool, | ||
alias_src_addr: u16, | ||
alias_seq_number: u8, | ||
radius_counter: u8 | ||
} | ||
|
||
|
||
/// The status of the corresponding request. | ||
pub enum ApsdeSapConfirmStatus { | ||
/// indicating that the request to transmit was successful | ||
Success, | ||
/// No corresponding 16-bit NKW address found | ||
NoShortAddress, | ||
/// No binding table entries found with the respectively SrcEndpoint and ClusterId parameter | ||
NoBoundDevice, | ||
/// the security processing failed | ||
SecurityFail, | ||
/// one or more APS acknowledgements were not correctly received | ||
NoAck, | ||
/// ASDU to be transmitted is larger than will fit in a single frame and fragmentation is not possible | ||
AsduTooLong | ||
} | ||
// 2.2.4.1.2 | ||
pub struct ApsdeSapConfirm { | ||
pub dst_addr_mode: DstAddrMode, | ||
pub dst_address: u8, | ||
pub dst_endpoint: u8, | ||
pub src_endpoint: types::SrcEndpoint, | ||
pub status: ApsdeSapConfirmStatus, | ||
pub tx_time: u8, | ||
} | ||
|
||
pub enum ApsdeSapIndicationStatus { | ||
Success, | ||
DefragUnsupported, | ||
DefragDeferred | ||
} | ||
|
||
pub enum SecurityStatus { | ||
Unsecured, | ||
SecuredNwkKey, | ||
SecuredLinkKey | ||
} | ||
|
||
// 2.2.4.1.3 | ||
pub struct ApsdeSapIndication { | ||
dst_addr_mode: DstAddrMode, | ||
dst_address: u8, | ||
dst_endpoint: u8, | ||
src_addr_mode: u8, | ||
src_address: u64, | ||
src_endpoint: types::SrcEndpoint, | ||
profile_id: u16, | ||
cluster_id: u16, | ||
asdulength: u8, | ||
status: ApsdeSapIndicationStatus, | ||
security_status: SecurityStatus, | ||
link_quality: u8, | ||
rx_time: u8, | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,10 @@ | ||
//! | ||
//! 2.2.4.5 Group Management | ||
//! This set of primitives allows the next higher layer to manage group membership for endpoints on the current device by adding and removing entries in the group table | ||
//! | ||
//! 2.2.4.5 Group Management | ||
type DstAddrMode = u8; | ||
// 2.2.4.3.1 APSME-BIND.request | ||
struct ApsmeAddrGroupRequest { | ||
/// 2.2.4.3.1 - APSME-BIND.request | ||
pub struct ApsmeAddrGroupRequest { | ||
group_address: u16, | ||
endpoint: u8, | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
pub(crate) mod types; | ||
pub(crate) mod error; | ||
|
||
pub(crate) mod apsde; | ||
pub(crate) mod apsme; | ||
/// The APS data entity provides the data transmission service between two or more application entities located on the same network. | ||
pub mod apsde; | ||
|
||
/// The APS management entity provides a variety of services to application objects including security services and binding of devices. | ||
/// It also maintains a database of managed objects, known as the APS information base (AIB). | ||
pub mod apsme; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters