diff --git a/Cargo.lock b/Cargo.lock index c2da5e4..3ea6fb2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -173,9 +173,9 @@ checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" [[package]] name = "bitvec" -version = "0.19.4" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7ba35e9565969edb811639dbebfe34edc0368e472c5018474c8eb2543397f81" +checksum = "f5011ffc90248764d7005b0e10c7294f5aa1bd87d9dd7248f4ad475b347c294d" dependencies = [ "funty", "radium", @@ -199,7 +199,7 @@ dependencies = [ [[package]] name = "bluez" -version = "0.3.0" +version = "0.3.1" dependencies = [ "async-std", "bitvec", @@ -222,9 +222,9 @@ checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" [[package]] name = "bytes" -version = "0.6.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0dcbc35f504eb6fc275a6d20e4ebcda18cf50d40ba6fabff8c711fa16cb3b16" +checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" [[package]] name = "cache-padded" @@ -272,18 +272,18 @@ dependencies = [ [[package]] name = "enumflags2" -version = "0.6.4" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c8d82922337cd23a15f88b70d8e4ef5f11da38dd7cdb55e84dd5de99695da0" +checksum = "a8672257d642ffdd235f6e9c723c2326ac1253c8f3c022e7cfd2e57da55b1131" dependencies = [ "enumflags2_derive", ] [[package]] name = "enumflags2_derive" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "946ee94e3dbf58fdd324f9ce245c7b238d46a66f00e86a020b71996349e46cce" +checksum = "33526f770a27828ce7c2792fdb7cb240220237e0ff12933ed6c23957fc5dd7cf" dependencies = [ "proc-macro2", "quote", @@ -626,9 +626,9 @@ dependencies = [ [[package]] name = "radium" -version = "0.5.3" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" +checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" [[package]] name = "signal-hook" diff --git a/Cargo.toml b/Cargo.toml index d53a1a7..0609ff5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bluez" -version = "0.3.0" +version = "0.3.1" authors = ["Ibiyemi Abiodun "] edition = "2018" repository = "https://github.com/laptou/bluez-rs" @@ -15,10 +15,10 @@ libc = "0.2" thiserror = "1.0" num-traits = "0.2" num-derive = "0.3" -enumflags2 = "0.6.4" -enumflags2_derive = "0.6.4" -bytes = "0.6" -bitvec = "0.19" +enumflags2 = "0.7" +enumflags2_derive = "0.7" +bytes = "1.0" +bitvec = "0.20" futures = "0.3" smol = "1.2" diff --git a/src/client/advertising.rs b/src/client/advertising.rs index 5d5ae66..f4ff374 100644 --- a/src/client/advertising.rs +++ b/src/client/advertising.rs @@ -1,6 +1,6 @@ use super::*; use crate::util::BufExt2; -use enumflags2::BitFlags; +use enumflags2::{BitFlags, bitflags}; impl<'a> BlueZClient<'a> { /// This command is used to read the advertising features supported @@ -249,7 +249,8 @@ pub struct AdvertisingParams { } #[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, BitFlags)] +#[bitflags] +#[derive(Debug, Copy, Clone, Eq, PartialEq)] pub enum AdvertisingFlags { /// Indicates support for connectable advertising /// and for switching to connectable advertising independent of the diff --git a/src/client/params.rs b/src/client/params.rs index cb47536..a1ddeeb 100644 --- a/src/client/params.rs +++ b/src/client/params.rs @@ -1,6 +1,6 @@ use std::hash::Hash; -use enumflags2::BitFlags; +use enumflags2::{BitFlags, bitflags}; use crate::Address; @@ -54,7 +54,8 @@ pub enum LeAdvertisingMode { } #[repr(u8)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, BitFlags)] +#[bitflags] +#[derive(Debug, Copy, Clone, Eq, PartialEq)] pub enum AddressTypeFlag { BREDR = 1 << 0, LEPublic = 1 << 1, @@ -106,7 +107,8 @@ pub struct ClockInfo { } #[repr(u32)] -#[derive(Debug, Copy, Clone, BitFlags, Eq, PartialEq)] +#[bitflags] +#[derive(Debug, Copy, Clone, Eq, PartialEq)] pub enum DeviceFlag { ConfirmName = 1 << 0, LegacyPairing = 1 << 1, @@ -140,7 +142,8 @@ pub struct ConnectionParams { } #[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, BitFlags)] +#[bitflags] +#[derive(Debug, Copy, Clone, Eq, PartialEq)] pub enum ControllerConfigOptions { External = 1 << 0, BluetoothPublicAddr = 1 << 1, @@ -183,7 +186,8 @@ pub struct PhyConfig { } #[repr(u32)] -#[derive(Debug, Copy, Clone, Eq, PartialEq, BitFlags)] +#[bitflags] +#[derive(Debug, Copy, Clone, Eq, PartialEq)] pub enum PhyFlag { BR1M1Slot = 1 << 0, BR1M3Slot = 1 << 1, diff --git a/src/interface/class.rs b/src/interface/class.rs index f50e5e7..6205e33 100644 --- a/src/interface/class.rs +++ b/src/interface/class.rs @@ -1,10 +1,11 @@ use bitvec::{view::BitView, prelude as bv}; use bitvec::prelude::{BitField}; use bytes::{Buf, Bytes}; -use enumflags2::BitFlags; +use enumflags2::{BitFlags, bitflags}; -#[derive(BitFlags, Copy, Clone, Debug, PartialEq)] +#[bitflags] #[repr(u32)] +#[derive(Copy, Clone, Debug, PartialEq)] pub enum ServiceClass { Positioning = 1 << 16, Networking = 1 << 17, diff --git a/src/interface/controller.rs b/src/interface/controller.rs index 6f29964..4549da8 100644 --- a/src/interface/controller.rs +++ b/src/interface/controller.rs @@ -2,7 +2,7 @@ use std::ffi::CString; use std::fmt::{Display, Formatter}; use bytes::Bytes; -use enumflags2::BitFlags; +use enumflags2::{BitFlags, bitflags}; use crate::interface::class::{DeviceClass, ServiceClasses}; use crate::Address; @@ -58,7 +58,8 @@ pub struct ControllerInfoExt { pub eir_data: Bytes, } -#[derive(BitFlags, Copy, Clone, Debug, PartialEq)] +#[bitflags] +#[derive(Copy, Clone, Debug, PartialEq)] #[repr(u32)] pub enum ControllerSetting { Powered = 1 << 0, diff --git a/src/util.rs b/src/util.rs index fbf616c..93e3642 100644 --- a/src/util.rs +++ b/src/util.rs @@ -3,8 +3,7 @@ use std::ffi::CString; use std::hash::Hash; use bytes::Buf; -use enumflags2::BitFlags; -use enumflags2::RawBitFlags; +use enumflags2::{BitFlag, BitFlags}; use num_traits::FromPrimitive; use crate::Address; @@ -40,15 +39,15 @@ pub(crate) trait BufExt2: Buf { FromPrimitive::from_u16(self.get_u16_le()).unwrap() } - fn get_flags_u8>(&mut self) -> BitFlags { - BitFlags::from_bits_truncate(self.get_u8()) + fn get_flags_u8>(&mut self) -> BitFlags { + BitFlags::::from_bits_truncate(self.get_u8()) } - fn get_flags_u16_le>(&mut self) -> BitFlags { + fn get_flags_u16_le>(&mut self) -> BitFlags { BitFlags::from_bits_truncate(self.get_u16_le()) } - fn get_flags_u32_le>(&mut self) -> BitFlags { + fn get_flags_u32_le>(&mut self) -> BitFlags { BitFlags::from_bits_truncate(self.get_u32_le()) }