Skip to content

Instantly share code, notes, and snippets.

@zakorgy
Created May 10, 2017 13:26
Show Gist options
  • Save zakorgy/a4c07f9e3b6e91585a9e1392c5f38827 to your computer and use it in GitHub Desktop.
Save zakorgy/a4c07f9e3b6e91585a9e1392c5f38827 to your computer and use it in GitHub Desktop.
diff --git a/src/bluetooth_gatt_characteristic.rs b/src/bluetooth_gatt_characteristic.rs
index f79e89a..f82ade4 100644
--- a/src/bluetooth_gatt_characteristic.rs
+++ b/src/bluetooth_gatt_characteristic.rs
@@ -92,10 +92,13 @@ impl BluetoothGATTCharacteristic {
m.append_items(&[
MessageItem::Array(
match offset {
- Some(o) => vec![MessageItem::DictEntry(Box::new("offset".into()), Box::new(o.into()))],
+ Some(o) => vec![MessageItem::DictEntry(Box::new("offset".into()),
+ Box::new(MessageItem::Variant(Box::new(o.into()))))],
None => vec![],
- }, Cow::Borrowed("{sv}"))
- ]);
+ },
+ Cow::Borrowed("{sv}")
+ )
+ ]);
let reply = try!(c.send_with_reply_and_block(m, 1000));
let items: MessageItem = reply.get1().unwrap();
let z: &[MessageItem] = items.inner().unwrap();
@@ -119,13 +122,13 @@ impl BluetoothGATTCharacteristic {
MessageItem::new_array(values_msgs).unwrap(),
MessageItem::Array(
match offset {
- Some(o) => vec![MessageItem::DictEntry(
- Box::new("offset".into()),
- Box::new(MessageItem::Variant(Box::new(o.into()))))
- ],
+ Some(o) => vec![MessageItem::DictEntry(Box::new("offset".into()),
+ Box::new(MessageItem::Variant(Box::new(o.into()))))],
None => vec![],
- }, Cow::Borrowed("{sv}"))
- ]))
+ },
+ Cow::Borrowed("{sv}")
+ )
+ ]))
}
// http://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc/gatt-api.txt#n96
diff --git a/src/bluetooth_gatt_descriptor.rs b/src/bluetooth_gatt_descriptor.rs
index d0702d7..6607a02 100644
--- a/src/bluetooth_gatt_descriptor.rs
+++ b/src/bluetooth_gatt_descriptor.rs
@@ -81,10 +81,13 @@ impl BluetoothGATTDescriptor {
m.append_items(&[
MessageItem::Array(
match offset {
- Some(o) => vec![MessageItem::DictEntry(Box::new("offset".into()), Box::new(o.into()))],
+ Some(o) => vec![MessageItem::DictEntry(Box::new("offset".into()),
+ Box::new(MessageItem::Variant(Box::new(o.into()))))],
None => vec![],
- }, Cow::Borrowed("{sv}"))
- ]);
+ },
+ Cow::Borrowed("{sv}")
+ )
+ ]);
let reply = try!(c.send_with_reply_and_block(m, 1000));
let items: MessageItem = reply.get1().unwrap();
let z: &[MessageItem] = items.inner().unwrap();
@@ -108,13 +111,12 @@ impl BluetoothGATTDescriptor {
MessageItem::new_array(args).unwrap(),
MessageItem::Array(
match offset {
- Some(o) => vec![MessageItem::DictEntry(
- Box::new("offset".into()),
- Box::new(MessageItem::Variant(Box::new(o.into()))))
- ],
+ Some(o) => vec![MessageItem::DictEntry(Box::new("offset".into()),
+ Box::new(MessageItem::Variant(Box::new(o.into()))))],
None => vec![],
- }, Cow::Borrowed("{sv}"))
- ]))
-
+ },
+ Cow::Borrowed("{sv}")
+ )
+ ]))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment