chore: Code cleanup

This commit is contained in:
Fabio Lenherr 2023-12-01 14:31:14 +01:00
parent f8c27fd498
commit 921d5e7fe6
27 changed files with 304 additions and 234 deletions

View file

@ -1,11 +1,14 @@
use std::collections::HashMap;
use std::time::Duration;
use dbus::arg::{RefArg};
use dbus::arg::RefArg;
use dbus::blocking::Connection;
use dbus::Error;
use dbus::Path;
use std::collections::HashMap;
use std::time::Duration;
use ReSet_Lib::network::connection::Connection as ResetConnection;
type ResultType =
Result<(HashMap<String, HashMap<String, dbus::arg::Variant<Box<dyn RefArg>>>>,), Error>;
pub fn getConnectionSettings(path: Path<'static>) -> ResetConnection {
let conn = Connection::new_session().unwrap();
let proxy = conn.with_proxy(
@ -13,10 +16,8 @@ pub fn getConnectionSettings(path: Path<'static>) -> ResetConnection {
"/org/Xetibo/ReSetDaemon",
Duration::from_millis(1000),
);
let res: Result<
(HashMap<String, HashMap<String, dbus::arg::Variant<Box<dyn RefArg>>>>,),
Error,
> = proxy.method_call("org.xetibo.ReSetWireless", "GetConnectionSettings", (path,));
let res: ResultType =
proxy.method_call("org.xetibo.ReSetWireless", "GetConnectionSettings", (path,));
if res.is_err() {
ResetConnection::default();
}