Struct FeDevice

Source
pub struct FeDevice { /* private fields */ }
Expand description

A reference to the frontend device and device information

Implementations§

Source§

impl FeDevice

Source

pub fn clear(&self) -> Result<()>

Clears frontend settings and event queue

Source

pub fn open_ro(adapter: u32, device: u32) -> Result<FeDevice>

Attempts to open frontend device in read-only mode

Examples found in repository?
examples/feinfo.rs (line 19)
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
Hide additional examples
examples/femon.rs (line 20)
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}
Source

pub fn open_rw(adapter: u32, device: u32) -> Result<FeDevice>

Attempts to open frontend device in read-write mode

Source

pub fn set_properties(&self, cmdseq: &[DtvProperty]) -> Result<()>

Sets properties on frontend device

Source

pub fn get_properties(&self, cmdseq: &mut [DtvProperty]) -> Result<()>

Gets properties from frontend device

Source

pub fn get_event(&self, event: &mut FeEvent) -> Result<()>

Returns a frontend events if available

Source

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]
Source

pub fn read_signal_strength(&self) -> Result<u16>

Reads and returns a signal strength relative value (DVBv3 API)

Source

pub fn read_snr(&self) -> Result<u16>

Reads and returns a signal-to-noise ratio, relative value (DVBv3 API)

Source

pub fn read_ber(&self) -> Result<u64>

Reads and returns a bit error counter (DVBv3 API)

Source

pub fn read_unc(&self) -> Result<u64>

Reads and returns an uncorrected blocks counter (DVBv3 API)

Source

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
Source

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.
Source

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
Source

pub fn get_api_version(&self) -> u16

Returns the current API version major - first byte minor - second byte

Trait Implementations§

Source§

impl AsRawFd for FeDevice

Source§

fn as_raw_fd(&self) -> RawFd

Extracts the raw file descriptor. Read more
Source§

impl Debug for FeDevice

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for FeDevice

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.