[−][src]Crate rustbus
Rustbus
Rustbus is a dbus library that allows for RPC on services on the bus or to implement your own service that listens on the bus. There are some examples in the src/bin directory but the gist is:
use rustbus::{get_session_bus_path, standard_messages, Conn, Container, params::DictMap, MessageBuilder, client_conn::Timeout}; fn main() -> Result<(), rustbus::client_conn::Error> { // Connect to the session bus let session_path = get_session_bus_path()?; let con = Conn::connect_to_bus(session_path, true)?; // Wrap the con in an RpcConnection which provides many convenient functions let mut rpc_con = rustbus::client_conn::RpcConn::new(con); // send the obligatory hello message rpc_con.send_message(&mut standard_messages::hello(), Timeout::Infinite)?; // Request a bus name if you want to rpc_con.send_message(&mut standard_messages::request_name( "io.killing.spark".into(), 0, ), Timeout::Infinite)?; // send a signal to all bus members let mut sig = MessageBuilder::new() .signal( "io.killing.spark".into(), "TestSignal".into(), "/io/killing/spark".into(), ) .build(); sig.body.push_param("Signal message!").unwrap(); rpc_con.send_message(&mut sig, Timeout::Infinite)?; Ok(()) }
Re-exports
pub use message::Message; |
pub use message::MessageType; |
pub use client_conn::get_session_bus_path; |
pub use client_conn::get_system_bus_path; |
pub use client_conn::Conn; |
pub use client_conn::RpcConn; |
pub use message_builder::CallBuilder; |
pub use message_builder::MessageBuilder; |
pub use message_builder::SignalBuilder; |
pub use wire::marshal_trait::Marshal; |
Modules
auth | |
client_conn | The connection stuff you probably want to use. Conn is the lowlevel abstraction RpcConn is the higher level wrapper with convenience functions over the Conn struct. |
message | lowlevel message stuff |
message_builder | Helps in building messages conveniently |
params | The params is mostly for receiving messages. To make your own messages to send out you probably want to use the Marshal trait. If the trait does not work for you for some reason, you can build your message with the params. There is a Marshal implementation for all Params. |
peer | This module implemets the org.freedesktop.DBus.Peer |
signature | |
standard_messages | Some standard messages that are often needed |
wire |
Enums
Base | The base types a message can have as parameters
There are From |
Container | The container types a message can have as parameters |
Param | The Types a message can have as parameters
There are From |