lorawan_device/nb_device/
radio.rs1use super::TimestampMs;
2pub use crate::radio::*;
3pub use ::lora_modulation::{Bandwidth, CodingRate, SpreadingFactor};
4
5#[derive(Debug)]
6pub enum Event<'a, R>
7where
8 R: PhyRxTx,
9{
10 TxRequest(TxConfig, &'a [u8]),
11 RxRequest(RfConfig),
12 CancelRx,
13 Phy(R::PhyEvent),
14}
15
16#[derive(Debug)]
17pub enum Response<R>
18where
19 R: PhyRxTx,
20{
21 Idle,
22 Txing,
23 Rxing,
24 TxDone(TimestampMs),
25 RxDone(RxQuality),
26 Phy(R::PhyResponse),
27}
28
29use core::fmt;
30
31pub trait PhyRxTx {
32 type PhyEvent: fmt::Debug;
33 type PhyError: fmt::Debug;
34 type PhyResponse: fmt::Debug;
35
36 const ANTENNA_GAIN: i8 = 0;
38
39 const MAX_RADIO_POWER: u8;
42
43 fn get_mut_radio(&mut self) -> &mut Self;
44
45 fn get_received_packet(&mut self) -> &mut [u8];
47 fn handle_event(&mut self, event: Event<Self>) -> Result<Response<Self>, Self::PhyError>
48 where
49 Self: Sized;
50}