Struct ControlPanel

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

OSDP CP device context.

Implementations§

Source§

impl ControlPanel

Source

pub fn new(pd_info: Vec<PdInfo>) -> Result<Self, OsdpError>

Create a new CP context for the list of PDs described by the PdInfo vector.

Source

pub fn refresh(&mut self)

The application must call this method periodically to refresh the underlying LibOSDP state. To meet the OSDP timing guarantees, this function must be called at least once every 50ms. This method does not block and returns early if there is nothing to be done.

Source

pub fn send_command( &mut self, pd: i32, cmd: OsdpCommand, ) -> Result<(), OsdpError>

Send OsdpCommand to a PD identified by the offset number (in PdInfo vector in ControlPanel::new).

Source

pub fn set_event_callback<F>(&mut self, closure: F)
where F: FnMut(i32, OsdpEvent) -> i32,

Set a closure that gets called when a PD sends an event to this CP.

Source

pub fn get_pd_id(&self, pd: i32) -> Result<PdId, OsdpError>

Get the PdId from a PD identified by the offset number (in PdInfo vector in ControlPanel::new).

Source

pub fn get_capability( &self, pd: i32, cap: PdCapability, ) -> Result<PdCapability, OsdpError>

Get the PdCapability from a PD identified by the offset number (in PdInfo vector in ControlPanel::new).

Source

pub fn set_flag(&mut self, pd: i32, flags: OsdpFlag, value: bool)

Set OsdpFlag for a PD identified by the offset number (in PdInfo vector in ControlPanel::new).

Source

pub fn is_online(&self, pd: i32) -> bool

Check online status of a PD identified by the offset number (in PdInfo vector in ControlPanel::new).

Source

pub fn is_sc_active(&self, pd: i32) -> bool

Check secure channel status of a PD identified by the offset number (in PdInfo vector in ControlPanel::new).

Source

pub fn file_transfer_status(&self, pd: i32) -> Result<(i32, i32), OsdpError>

Get status of the ongoing file transfer of a PD, identified by the offset number (in PdInfo vector in ControlPanel::new). Returns (size, offset) of the current file transfer operation.

Source

pub fn register_file_ops( &mut self, pd: i32, fops: Box<dyn OsdpFileOps>, ) -> Result<(), OsdpError>

Register a file operations handler for a PD. See crate::OsdpFileOps trait documentation for more details.

Trait Implementations§

Source§

impl Debug for ControlPanel

Source§

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

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

impl Drop for ControlPanel

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for ControlPanel

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