Dbus cleanup

Use DBUS_NAME instead of DBUS_IFACE when requesting the name
Add missing method_return()s
Give different names for the bytearray arguments so that pydbus is not confused
This commit is contained in:
Guillaume Meunier
2020-06-06 18:11:14 +02:00
committed by Luke
parent c9ba06d6b4
commit 5f37a319c5
2 changed files with 21 additions and 21 deletions

View File

@@ -11,7 +11,7 @@ use dbus::{channel::Sender, nonblock::Process};
use dbus_tokio::connection;
use log::{error, info, warn};
use rog_client::{DBUS_IFACE, DBUS_PATH};
use rog_aura::{DBUS_IFACE, DBUS_NAME, DBUS_PATH};
use std::error::Error;
use std::sync::{mpsc, Arc};
use std::time::{Duration, Instant};
@@ -84,7 +84,7 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
});
connection
.request_name(DBUS_IFACE, false, true, true)
.request_name(DBUS_NAME, false, true, true)
.await?;
let (aura_command_send, aura_command_recv) = mpsc::sync_channel::<AuraCommand>(1);

View File

@@ -50,10 +50,10 @@ pub(super) fn dbus_create_ledmultizone_method(effect: NestedVecType) -> Method<M
}
})
.outarg::<&str, _>("reply")
.inarg::<Vec<u8>, _>("bytearray")
.inarg::<Vec<u8>, _>("bytearray")
.inarg::<Vec<u8>, _>("bytearray")
.inarg::<Vec<u8>, _>("bytearray")
.inarg::<Vec<u8>, _>("bytearray1")
.inarg::<Vec<u8>, _>("bytearray2")
.inarg::<Vec<u8>, _>("bytearray3")
.inarg::<Vec<u8>, _>("bytearray4")
}
pub(super) fn dbus_create_ledeffect_method(effect: NestedVecType) -> Method<MTSync, ()> {
@@ -78,23 +78,23 @@ pub(super) fn dbus_create_ledeffect_method(effect: NestedVecType) -> Method<MTSy
iter.read()?,
];
*lock = Some(byte_array);
Ok(vec![])
Ok(vec!(m.msg.method_return()))
} else {
Err(MethodErr::failed("Could not lock daemon for access"))
}
}
})
.inarg::<Vec<u8>, _>("bytearray")
.inarg::<Vec<u8>, _>("bytearray")
.inarg::<Vec<u8>, _>("bytearray")
.inarg::<Vec<u8>, _>("bytearray")
.inarg::<Vec<u8>, _>("bytearray")
.inarg::<Vec<u8>, _>("bytearray")
.inarg::<Vec<u8>, _>("bytearray")
.inarg::<Vec<u8>, _>("bytearray")
.inarg::<Vec<u8>, _>("bytearray")
.inarg::<Vec<u8>, _>("bytearray")
.inarg::<Vec<u8>, _>("bytearray")
.inarg::<Vec<u8>, _>("bytearray1")
.inarg::<Vec<u8>, _>("bytearray2")
.inarg::<Vec<u8>, _>("bytearray3")
.inarg::<Vec<u8>, _>("bytearray4")
.inarg::<Vec<u8>, _>("bytearray5")
.inarg::<Vec<u8>, _>("bytearray6")
.inarg::<Vec<u8>, _>("bytearray7")
.inarg::<Vec<u8>, _>("bytearray8")
.inarg::<Vec<u8>, _>("bytearray9")
.inarg::<Vec<u8>, _>("bytearray10")
.inarg::<Vec<u8>, _>("bytearray11")
}
pub(super) fn dbus_create_animatrix_method(effect: NestedVecType) -> Method<MTSync, ()> {
@@ -107,14 +107,14 @@ pub(super) fn dbus_create_animatrix_method(effect: NestedVecType) -> Method<MTSy
let mut iter = m.msg.iter_init();
let byte_array: Vec<Vec<u8>> = vec![iter.read()?, iter.read()?];
*lock = Some(byte_array);
Ok(vec![])
Ok(vec!(m.msg.method_return()))
} else {
Err(MethodErr::failed("Could not lock daemon for access"))
}
}
})
.inarg::<Vec<u8>, _>("bytearray")
.inarg::<Vec<u8>, _>("bytearray")
.inarg::<Vec<u8>, _>("bytearray1")
.inarg::<Vec<u8>, _>("bytearray2")
}
pub(super) fn dbus_create_fan_mode_method(fan_mode: FanModeType) -> Method<MTSync, ()> {