1use ndn_transport::FaceId;
2
3#[derive(Clone, Debug, Default)]
5pub struct RadioFaceMetadata {
6 pub radio_id: u8,
8 pub channel: u8,
10 pub band: u8,
12}
13
14#[derive(Clone, Debug, Default)]
16pub struct LinkMetrics {
17 pub rssi_dbm: i8,
19 pub retransmit_rate: f32,
21 pub last_updated: u64,
23}
24
25pub struct RadioTable {
29 metrics: dashmap::DashMap<FaceId, LinkMetrics>,
30}
31
32impl RadioTable {
33 pub fn new() -> Self {
34 Self {
35 metrics: dashmap::DashMap::new(),
36 }
37 }
38
39 pub fn update(&self, face_id: FaceId, metrics: LinkMetrics) {
40 self.metrics.insert(face_id, metrics);
41 }
42
43 pub fn get(&self, face_id: &FaceId) -> Option<LinkMetrics> {
44 self.metrics.get(face_id).map(|r| r.clone())
45 }
46}
47
48impl Default for RadioTable {
49 fn default() -> Self {
50 Self::new()
51 }
52}