pub struct Server {
pub handle: Arc<Mutex<DeviceHandle>>,
/* private fields */
}Expand description
SSP/eSSP server for communicating with supported device over serial.
Optionally, can be used interactively with a client connection.
Fields§
§handle: Arc<Mutex<DeviceHandle>>Implementations§
Source§impl Server
impl Server
Sourcepub fn new_auto(
serial_path: &str,
stop_polling: Arc<AtomicBool>,
protocol_version: ProtocolVersion,
) -> Result<Self>
pub fn new_auto( serial_path: &str, stop_polling: Arc<AtomicBool>, protocol_version: ProtocolVersion, ) -> Result<Self>
Creates a new Server that automatically handles device events.
Sourcepub fn new_uds(
serial_path: &str,
socket_path: &str,
stop_polling: Arc<AtomicBool>,
protocol_version: ProtocolVersion,
encrypt: bool,
) -> Result<Self>
Available on crate feature jsonrpc only.
pub fn new_uds( serial_path: &str, socket_path: &str, stop_polling: Arc<AtomicBool>, protocol_version: ProtocolVersion, encrypt: bool, ) -> Result<Self>
jsonrpc only.Creates a new Server that interactively handles device events via a client connects over Unix domain sockets.
Sourcepub fn handle(&self) -> Result<MutexGuard<'_, DeviceHandle>>
pub fn handle(&self) -> Result<MutexGuard<'_, DeviceHandle>>
Gets a reference to the DeviceHandle.
Sourcepub fn lock_handle(
handle: &Arc<Mutex<DeviceHandle>>,
) -> Result<MutexGuard<'_, DeviceHandle>>
pub fn lock_handle( handle: &Arc<Mutex<DeviceHandle>>, ) -> Result<MutexGuard<'_, DeviceHandle>>
Aquires a lock on the DeviceHandle.
Returns an Err(_) if the timeout expires before acquiring the lock.
Sourcepub fn push_queue(&self) -> Result<&PushEventReceiver>
Available on crate feature jsonrpc only.
pub fn push_queue(&self) -> Result<&PushEventReceiver>
jsonrpc only.Gets a reference to the push event queue.
Returns Err(_) if the PushEventReceiver is unset.
Sourcepub fn push_queue_mut(&mut self) -> Result<&mut PushEventReceiver>
Available on crate feature jsonrpc only.
pub fn push_queue_mut(&mut self) -> Result<&mut PushEventReceiver>
jsonrpc only.Gets a mutable reference to the push event queue.
Returns Err(_) if the PushEventReceiver is unset.
Sourcepub fn listener(&self) -> Result<&UnixListener>
Available on crate feature jsonrpc only.
pub fn listener(&self) -> Result<&UnixListener>
jsonrpc only.Sourcepub fn listener_mut(&mut self) -> Result<&mut UnixListener>
Available on crate feature jsonrpc only.
pub fn listener_mut(&mut self) -> Result<&mut UnixListener>
jsonrpc only.Gets a mutable reference to the push event queue.
Returns Err(_) if the PushEventReceiver is unset.
pub fn accept(&mut self, stop: Arc<AtomicBool>) -> Result<()>
Available on crate feature
jsonrpc only.Trait Implementations§
Auto Trait Implementations§
impl Freeze for Server
impl !RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl !UnwindSafe for Server
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more