Skip to content

Commit

Permalink
Update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
laptou committed Feb 28, 2021
1 parent 01ee38b commit a77c663
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 33 deletions.
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bluez"
version = "0.3.0"
version = "0.3.1"
authors = ["Ibiyemi Abiodun <[email protected]>"]
edition = "2018"
repository = "https://github.com/laptou/bluez-rs"
Expand All @@ -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"

Expand Down
5 changes: 3 additions & 2 deletions src/client/advertising.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 9 additions & 5 deletions src/client/params.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::hash::Hash;

use enumflags2::BitFlags;
use enumflags2::{BitFlags, bitflags};

use crate::Address;

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions src/interface/class.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
5 changes: 3 additions & 2 deletions src/interface/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
11 changes: 5 additions & 6 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -40,15 +39,15 @@ pub(crate) trait BufExt2: Buf {
FromPrimitive::from_u16(self.get_u16_le()).unwrap()
}

fn get_flags_u8<T: RawBitFlags<Type = u8>>(&mut self) -> BitFlags<T> {
BitFlags::from_bits_truncate(self.get_u8())
fn get_flags_u8<T: BitFlag<Numeric = u8>>(&mut self) -> BitFlags<T> {
BitFlags::<T, u8>::from_bits_truncate(self.get_u8())
}

fn get_flags_u16_le<T: RawBitFlags<Type = u16>>(&mut self) -> BitFlags<T> {
fn get_flags_u16_le<T: BitFlag<Numeric = u16>>(&mut self) -> BitFlags<T> {
BitFlags::from_bits_truncate(self.get_u16_le())
}

fn get_flags_u32_le<T: RawBitFlags<Type = u32>>(&mut self) -> BitFlags<T> {
fn get_flags_u32_le<T: BitFlag<Numeric = u32>>(&mut self) -> BitFlags<T> {
BitFlags::from_bits_truncate(self.get_u32_le())
}

Expand Down

0 comments on commit a77c663

Please sign in to comment.