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
//! Ember multicast table.
use le_stream::{FromLeStream, ToLeStream};
/// Ember multicast ID.
pub type Id = u16;
/// A multicast table entry indicates that a particular endpoint is a member of a particular multicast group.
///
/// Only devices with an endpoint in a multicast group will receive messages sent to that multicast group.
#[derive(Clone, Debug, Eq, PartialEq, FromLeStream, ToLeStream)]
pub struct TableEntry {
multicast_id: Id,
endpoint: u8,
network_index: u8,
}
impl TableEntry {
/// Create a new Ember multicast table entry.
#[must_use]
pub const fn new(multicast_id: Id, endpoint: u8, network_index: u8) -> Self {
Self {
multicast_id,
endpoint,
network_index,
}
}
/// Return the multicast group ID.
#[must_use]
pub const fn multicast_id(&self) -> Id {
self.multicast_id
}
/// Return the endpoint that is a member, or 0 if this entry is not in use
/// (the ZDO is not a member of any multicast groups).
#[must_use]
pub const fn endpoint(&self) -> u8 {
self.endpoint
}
/// Return the network index of the network the entry is related to.
#[must_use]
pub const fn network_index(&self) -> u8 {
self.network_index
}
}