[−][src]Struct libopenlipc_sys::rLIPC
Implementations
impl rLIPC
[src]
pub fn new() -> Result<Self, String>
[src]
Returns a new LIPC client if a connection was successful Connects to the LIPC bus with no name.
pub fn subscribe<F>(
&self,
service: &str,
name: Option<&str>,
callback: F
) -> Result<(), String> where
F: Fn(&str, &str, Option<i32>, Option<String>) + Send,
[src]
&self,
service: &str,
name: Option<&str>,
callback: F
) -> Result<(), String> where
F: Fn(&str, &str, Option<i32>, Option<String>) + Send,
Register a callback for events broadcasted by service
. Optionally,
you can filter to a single event by providing name
.
For callback, we pass (source, name, optional int param, optional str param). an example callback payload would be "com.lab126.appmgrd", "appActivating", Some(1), Some("com.lab126.booklet.reader")
Examples
use libopenlipc_sys::rLIPC; let r = rLIPC::new().unwrap(); r.subscribe("com.lab126.powerd", Some("battLevelChanged"), |_, _, _, _| ()); // You will only get updates about battLevel in the callback // battLevelChanged sends <int param> with the new battery value
use libopenlipc_sys::rLIPC; let r = rLIPC::new().unwrap(); r.subscribe("com.lab126.powerd", None, |_, _, _, _| ()); // You will get updates all power related events (screen on, off, etc)
pub fn get_str_prop(&self, service: &str, prop: &str) -> Result<String, String>
[src]
Get the current value of a string property
use libopenlipc_sys::rLIPC; let r = rLIPC::new().unwrap(); let reader_status = r.get_str_prop("com.lab126.acxreaderplugin", "allReaderData").unwrap(); // reader_status would be a string containing JSON
pub fn get_int_prop(&self, service: &str, prop: &str) -> Result<i32, String>
[src]
Get the current value of an int property
use libopenlipc_sys::rLIPC; let r = rLIPC::new().unwrap(); let reader_status = r.get_int_prop("com.lab126.powerd", "battLevel").unwrap(); // reader_status will contain the battery charge % (ie: 75).
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for rLIPC
[src]
impl !Send for rLIPC
[src]
impl Unpin for rLIPC
[src]
impl UnwindSafe for rLIPC
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,