pub struct ControlPanel { /* private fields */ }
Expand description
OSDP CP device context.
Implementations§
Source§impl ControlPanel
impl ControlPanel
Sourcepub fn new(pd_info: Vec<PdInfo>) -> Result<Self, OsdpError>
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.
Sourcepub fn refresh(&mut self)
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.
Sourcepub fn send_command(
&mut self,
pd: i32,
cmd: OsdpCommand,
) -> Result<(), OsdpError>
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
).
Sourcepub fn set_event_callback<F>(&mut self, closure: F)
pub fn set_event_callback<F>(&mut self, closure: F)
Set a closure that gets called when a PD sends an event to this CP.
Sourcepub fn get_pd_id(&self, pd: i32) -> Result<PdId, OsdpError>
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
).
Sourcepub fn get_capability(
&self,
pd: i32,
cap: PdCapability,
) -> Result<PdCapability, OsdpError>
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
).
Sourcepub fn set_flag(&mut self, pd: i32, flags: OsdpFlag, value: bool)
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
).
Sourcepub fn is_online(&self, pd: i32) -> bool
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
).
Sourcepub fn is_sc_active(&self, pd: i32) -> bool
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
).
Sourcepub fn file_transfer_status(&self, pd: i32) -> Result<(i32, i32), OsdpError>
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.
Sourcepub fn register_file_ops(
&mut self,
pd: i32,
fops: Box<dyn OsdpFileOps>,
) -> Result<(), OsdpError>
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.