1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Implementation of a [Dash7](https://dash7-alliance.org/) ALP protocol parser from its
//! public specification.
//!
//! The protocol
//! ==============================================================================
//! The protocol specifies ALP Commands that can be sent to another system to communicate.
//! Each command is an aggregation of ALP Actions.
//!
//! The protocol is based on the fact that each communicating party hold a Dash7 filesystem.
//! Each request toward an other device is then composed as an array of simple filesystem operation
//! (ALP actions).
//!
//! About this library
//! ==============================================================================
//! The goal of this library is to implement a specification with an emphasis on correctness, then
//! on usability. Performance and memory usage are currently considered a secondary objective.
//!
//! Quickstart
//! ==============================================================================
//!
//! ```
//! use dash7_alp::spec::v1_2::{Command, Action, action};
//! use hex_literal::hex;
//!
//! let cmd = Command {
//!     actions: vec![
//!         Action::RequestTag(action::RequestTag { id: 66, eop: true }),
//!         Action::ReadFileData(action::ReadFileData {
//!             resp: true,
//!             group: false,
//!             file_id: 0,
//!             offset: 0,
//!             size: 8,
//!         }),
//!         Action::ReadFileData(action::ReadFileData {
//!             resp: false,
//!             group: true,
//!             file_id: 4,
//!             offset: 2,
//!             size: 3,
//!         }),
//!         Action::Nop(action::Nop {
//!             resp: true,
//!             group: true,
//!         }),
//!     ],
//! };
//! let data = &hex!("B4 42   41 00 00 08   81 04 02 03  C0") as &[u8];
//!
//! assert_eq!(&cmd.encode()[..], data);
//! let parsed_cmd = Command::decode(data).expect("should be parsed without error");
//! assert_eq!(parsed_cmd, cmd);
//! ```

/// Implementation of the specification compliant Dash7 ALP protocol.
pub mod spec;

/// Implementation of the [Sub-IoT compatible](https://github.com/Sub-IoT/Sub-IoT-Stack)
/// compatible Dash7 ALP protocol.
pub mod sub_iot;

/// Implementation of the [Wizzilab](https://www.wizzilab.com) compatible
/// Dash7 ALP protocol.
pub mod wizzilab;

/// A Codec module specifying how to encode/decode each encodable items
pub mod codec;

#[cfg(test)]
pub(crate) mod test_tools;