From 83650232dc0af6917e71d73dd50254660ef6d30e Mon Sep 17 00:00:00 2001 From: Maxim Khitrov Date: Fri, 7 Jan 2022 10:57:44 -0500 Subject: [PATCH] Make descriptor offset property optional --- bluer/src/gatt/local.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bluer/src/gatt/local.rs b/bluer/src/gatt/local.rs index 1dce333..0fcdaae 100644 --- a/bluer/src/gatt/local.rs +++ b/bluer/src/gatt/local.rs @@ -1053,7 +1053,7 @@ pub struct DescriptorReadRequest { impl DescriptorReadRequest { fn from_dict(dict: &PropMap) -> DbusResult { Ok(Self { - offset: read_prop!(dict, "offset", u16), + offset: read_opt_prop!(dict, "offset", u16).unwrap_or_default(), link: read_opt_prop!(dict, "link", String).and_then(|v| v.parse().ok()), }) } @@ -1074,7 +1074,7 @@ pub struct DescriptorWriteRequest { impl DescriptorWriteRequest { fn from_dict(dict: &PropMap) -> DbusResult { Ok(Self { - offset: read_prop!(dict, "offset", u16), + offset: read_opt_prop!(dict, "offset", u16).unwrap_or_default(), link: read_opt_prop!(dict, "link", String).and_then(|v| v.parse().ok()), prepare_authorize: read_prop!(dict, "prepare_authorize", bool), })