Skip to content

Commit

Permalink
fix: Change AccessPointChanged event
Browse files Browse the repository at this point in the history
  • Loading branch information
DashieTM committed Nov 22, 2023
1 parent 9fd27a6 commit 95ff7ff
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ReSet-Lib"
version = "0.4.3"
version = "0.4.4"
edition = "2021"
description = "Data structure library for ReSet"
repository = "https://github.com/Xetibo/ReSet-Lib"
Expand Down
24 changes: 17 additions & 7 deletions src/signals.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use dbus::{arg, Path};
use dbus::{
arg::{self, PropMap, RefArg, Variant},
Path,
};

use crate::{bluetooth::bluetooth::BluetoothDevice, network::network::AccessPoint};

Expand Down Expand Up @@ -98,19 +101,22 @@ impl GetVal<(AccessPoint,)> for AccessPointAdded {

#[derive(Debug)]
pub struct AccessPointChanged {
pub access_point: AccessPoint,
pub path: Path<'static>,
pub map: PropMap,
}

impl arg::AppendAll for AccessPointChanged {
fn append(&self, i: &mut arg::IterAppend) {
arg::RefArg::append(&self.access_point, i);
arg::RefArg::append(&self.path, i);
arg::RefArg::append(&self.map, i);
}
}

impl arg::ReadAll for AccessPointChanged {
fn read(i: &mut arg::Iter) -> Result<Self, arg::TypeMismatchError> {
Ok(AccessPointChanged {
access_point: i.read()?,
path: i.read()?,
map: i.read()?,
})
}
}
Expand All @@ -120,9 +126,13 @@ impl dbus::message::SignalArgs for AccessPointChanged {
const INTERFACE: &'static str = "org.xetibo.ReSet";
}

impl GetVal<(AccessPoint,)> for AccessPointChanged {
fn get_value(&self) -> (AccessPoint,) {
(self.access_point.clone(),)
impl GetVal<(Path<'static>, PropMap)> for AccessPointChanged {
fn get_value(&self) -> (Path<'static>, PropMap) {
let mut map = PropMap::new();
for (key, value) in self.map.iter() {
map.insert(key.clone(), Variant(value.box_clone()));
}
(self.path.clone(), map)
}
}

Expand Down

0 comments on commit 95ff7ff

Please sign in to comment.