pub struct Service {
pub offset_hz: i32,
pub chain: Chain,
pub spreading_factor: u8,
pub bandwidth_hz: u32,
pub implicit: Option<Implicit>,
}Expand description
The receiver fixed to one spreading factor, which is what a network calls its service channel.
The eight receivers beside it take any spreading factor and share a bandwidth fixed in hardware at 125 kHz. This one takes exactly one spreading factor and a bandwidth of its own, which is what lets a network carry a faster rate on a channel of its own.
Fields§
§offset_hz: i32How far from the carrier it listens, in hertz, which is signed.
chain: ChainWhich radio it takes its samples from.
spreading_factor: u8The one spreading factor it looks for.
bandwidth_hz: u32The bandwidth it runs at, in hertz. It is the only receiver that takes its own.
implicit: Option<Implicit>What it assumes when a packet carries no header, or None when packets carry one.
Implementations§
Source§impl Service
impl Service
Sourcepub const fn at(offset_hz: i32, spreading_factor: u8) -> Service
pub const fn at(offset_hz: i32, spreading_factor: u8) -> Service
A service channel on the first radio, at 125 kHz, hearing packets that carry a header.
§Arguments
offset_hz- how far from the carrier it listens, which is signed.spreading_factor- the one spreading factor it looks for.
§Returns
The service channel.
§Examples
use pamoja_radios::sx1302::channel::Service;
use pamoja_radios::sx1302::tx::Chain;
// The channel a European network runs at its fast rate: SF7 on 250 kHz.
let service = Service::at(300_000, 7).bandwidth(250_000);
assert_eq!(service.chain, Chain::A);
assert!(service.implicit.is_none(), "packets carry their own header");Sourcepub const fn without_header(self, implicit: Implicit) -> Service
pub const fn without_header(self, implicit: Implicit) -> Service
Sourcepub const fn supported(&self) -> bool
pub const fn supported(&self) -> bool
Whether the concentrator can be set to this channel at all.
§Returns
Whether the spreading factor and the bandwidth are ones the chip takes, and the offset is one the radio hears.
§Examples
use pamoja_radios::sx1302::channel::Service;
assert!(Service::at(300_000, 7).bandwidth(250_000).supported());
assert!(!Service::at(300_000, 7).bandwidth(200_000).supported(), "not a bandwidth");
assert!(!Service::at(300_000, 13).supported(), "not a spreading factor");
assert!(!Service::at(900_000, 7).supported(), "past what the radio hears");