use crate::uuid::BluetoothUuid;
pub mod a2dp;
pub mod avrcp;
pub mod data;
pub mod hfp;
pub mod hid;
pub mod pan;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Profile {
A2dp,
Avrcp,
Hfp,
Hsp,
Hid,
Pan,
Dun,
Obex,
Ftp,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum ProfileRole {
Client,
Server,
Either,
}
impl Profile {
pub const fn service_uuid(self) -> Option<BluetoothUuid> {
match self {
Self::A2dp => Some(BluetoothUuid::from_u16(0x110d)),
Self::Avrcp => Some(BluetoothUuid::from_u16(0x110e)),
Self::Hfp => Some(BluetoothUuid::from_u16(0x111e)),
Self::Hsp => Some(BluetoothUuid::from_u16(0x1108)),
Self::Hid => Some(BluetoothUuid::from_u16(0x1124)),
Self::Pan => Some(BluetoothUuid::from_u16(0x1115)),
Self::Dun => Some(BluetoothUuid::from_u16(0x1103)),
Self::Obex => Some(BluetoothUuid::from_u16(0x1105)),
Self::Ftp => Some(BluetoothUuid::from_u16(0x1106)),
}
}
pub const fn default_role(self) -> ProfileRole {
match self {
Self::A2dp | Self::Hfp | Self::Hsp | Self::Hid | Self::Pan | Self::Dun | Self::Ftp => {
ProfileRole::Client
}
Self::Avrcp | Self::Obex => ProfileRole::Either,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ProfileRequest {
pub profile: Profile,
pub role: ProfileRole,
}
impl ProfileRequest {
pub const fn conventional(profile: Profile) -> Self {
Self {
profile,
role: profile.default_role(),
}
}
}