pub struct FeDevice { /* private fields */ }
Expand description
A reference to the frontend device and device information
Implementations§
Source§impl FeDevice
impl FeDevice
Sourcepub fn open_ro(adapter: u32, device: u32) -> Result<FeDevice>
pub fn open_ro(adapter: u32, device: u32) -> Result<FeDevice>
Attempts to open frontend device in read-only mode
Examples found in repository?
6fn main() -> Result<()> {
7 let mut args = std::env::args().skip(1);
8
9 let adapter = match args.next() {
10 Some(v) => v.parse::<u32>().context("adapter number")?,
11 None => bail!("adapter number not defined"),
12 };
13
14 let device = match args.next() {
15 Some(v) => v.parse::<u32>().context("device number")?,
16 None => 0,
17 };
18
19 let fe = FeDevice::open_ro(adapter, device)?;
20 println!("{}", &fe);
21
22 let mut status = FeStatus::default();
23 status.read(&fe)?;
24 println!("Status: {}", &status);
25
26 Ok(())
27}
More examples
7fn main() -> Result<()> {
8 let mut args = std::env::args().skip(1);
9
10 let adapter = match args.next() {
11 Some(v) => v.parse::<u32>().context("adapter number")?,
12 None => bail!("adapter number not defined"),
13 };
14
15 let device = match args.next() {
16 Some(v) => v.parse::<u32>().context("device number")?,
17 None => 0,
18 };
19
20 let fe = FeDevice::open_ro(adapter, device)?;
21 let mut status = FeStatus::default();
22
23 let delay = Duration::from_secs(1);
24 loop {
25 status.read(&fe)?;
26 println!("{}", &status);
27 thread::sleep(delay);
28 }
29}
Sourcepub fn open_rw(adapter: u32, device: u32) -> Result<FeDevice>
pub fn open_rw(adapter: u32, device: u32) -> Result<FeDevice>
Attempts to open frontend device in read-write mode
Sourcepub fn set_properties(&self, cmdseq: &[DtvProperty]) -> Result<()>
pub fn set_properties(&self, cmdseq: &[DtvProperty]) -> Result<()>
Sets properties on frontend device
Sourcepub fn get_properties(&self, cmdseq: &mut [DtvProperty]) -> Result<()>
pub fn get_properties(&self, cmdseq: &mut [DtvProperty]) -> Result<()>
Gets properties from frontend device
Sourcepub fn get_event(&self, event: &mut FeEvent) -> Result<()>
pub fn get_event(&self, event: &mut FeEvent) -> Result<()>
Returns a frontend events if available
Sourcepub fn read_status(&self) -> Result<fe_status>
pub fn read_status(&self) -> Result<fe_status>
Returns frontend status
- [
FE_NONE
] - [
FE_HAS_SIGNAL
] - [
FE_HAS_CARRIER
] - [
FE_HAS_VITERBI
] - [
FE_HAS_SYNC
] - [
FE_HAS_LOCK
] - [
FE_TIMEDOUT
] - [
FE_REINIT
]
Sourcepub fn read_signal_strength(&self) -> Result<u16>
pub fn read_signal_strength(&self) -> Result<u16>
Reads and returns a signal strength relative value (DVBv3 API)
Sourcepub fn read_snr(&self) -> Result<u16>
pub fn read_snr(&self) -> Result<u16>
Reads and returns a signal-to-noise ratio, relative value (DVBv3 API)
Sourcepub fn read_unc(&self) -> Result<u64>
pub fn read_unc(&self) -> Result<u64>
Reads and returns an uncorrected blocks counter (DVBv3 API)
Sourcepub fn set_tone(&self, value: u32) -> Result<()>
pub fn set_tone(&self, value: u32) -> Result<()>
Turns on/off generation of the continuous 22kHz tone
allowed value
’s:
- SEC_TONE_ON - turn 22kHz on
- SEC_TONE_OFF - turn 22kHz off
Sourcepub fn set_voltage(&self, value: u32) -> Result<()>
pub fn set_voltage(&self, value: u32) -> Result<()>
Sets the DC voltage level for LNB
allowed value
’s:
- SEC_VOLTAGE_13 for 13V
- SEC_VOLTAGE_18 for 18V
- SEC_VOLTAGE_OFF turns LNB power supply off
Different power levels used to select internal antennas for different polarizations:
- 13V:
- Vertical in linear LNB
- Right in circular LNB
- 18V:
- Horizontal in linear LNB
- Left in circular LNB
- OFF is needed with external power supply, for example to use same LNB with several receivers.
Sourcepub fn diseqc_master_cmd(&self, msg: &[u8]) -> Result<()>
pub fn diseqc_master_cmd(&self, msg: &[u8]) -> Result<()>
Sets DiSEqC master command
msg
is a message no more 6 bytes length
Example DiSEqC commited command:
[0xE0, 0x10, 0x38, 0xF0 | value]
- byte 1 is a framing (master command without response)
- byte 2 is an address (any LNB)
- byte 3 is a command (commited)
- last 4 bits of byte 4 is:
- xx00 - switch input
- 00x0 - bit is set on SEC_VOLTAGE_18
- 000x - bit is set on SEC_TONE_ON
Sourcepub fn get_api_version(&self) -> u16
pub fn get_api_version(&self) -> u16
Returns the current API version major - first byte minor - second byte