-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Bluetooth Low Energy (BLE) peripherals -- -- This package provides a Haskell API for writing Bluetooth Low Energy -- peripherals. @package ble @version 0.1.0.0 module Bluetooth.Internal.Descriptors module Bluetooth.Internal.Utils class ToText a toText :: ToText a => Lens' a Text class FromText a fromText :: FromText a => Lens' Text a instance Bluetooth.Internal.Utils.ToText DBus.Types.ObjectPath instance Bluetooth.Internal.Utils.FromText DBus.Types.ObjectPath module Bluetooth.Internal.Interfaces type ObjectManager = "org.freedesktop.DBus.ObjectManager" objectManagerIFaceP :: Proxy ObjectManager objectManagerIFace :: String type Properties = "org.freedesktop.DBus.Properties" propertiesIFaceP :: Proxy Properties propertiesIFace :: String type GattService = "org.bluez.GattService1" gattServiceIFaceP :: Proxy GattService gattServiceIFace :: String type GattCharacteristic = "org.bluez.GattCharacteristic1" gattCharacteristicIFaceP :: Proxy GattCharacteristic gattCharacteristicIFace :: String type GattManager = "org.bluez.GattManager1" gattManagerIFaceP :: Proxy GattManager gattManagerIFace :: String type LEAdvertisement = "org.bluez.LEAdvertisement1" leAdvertisementIFaceP :: Proxy LEAdvertisement leAdvertisementIFace :: String type LEAdvertisingManager1 = "org.bluez.LEAdvertisingManager1" leAdvertisingManagerIFaceP :: Proxy LEAdvertisingManager1 leAdvertisingManagerIFace :: String invalidArgs :: MsgError notSupported :: MsgError module Bluetooth.Internal.Errors type ReadValueM a = Handler '[ThrowsFailed, ThrowsInProgress, ThrowsNotPermitted, ThrowsNotAuthorized, ThrowsNotSupported] a type WriteValueM a = Handler '[ThrowsFailed, ThrowsInProgress, ThrowsNotPermitted, ThrowsInvalidValueLength, ThrowsNotAuthorized, ThrowsNotSupported] a newtype Handler (errs :: [(* -> *) -> Constraint]) a Handler :: ExceptT Text IO a -> Handler a [getReadValue] :: Handler a -> ExceptT Text IO a class ThrowsFailed m errFailed :: ThrowsFailed m => m a class ThrowsInProgress m errInProgress :: ThrowsInProgress m => m a class ThrowsNotPermitted m errNotPermitted :: ThrowsNotPermitted m => m a class ThrowsNotAuthorized m errNotAuthorized :: ThrowsNotAuthorized m => m a class ThrowsNotSupported m errNotSupported :: ThrowsNotSupported m => m a class ThrowsInvalidValueLength m errInvalidValueLength :: ThrowsInvalidValueLength m => m a instance Control.Monad.IO.Class.MonadIO (Bluetooth.Internal.Errors.Handler errs) instance GHC.Base.Monad (Bluetooth.Internal.Errors.Handler errs) instance GHC.Base.Applicative (Bluetooth.Internal.Errors.Handler errs) instance GHC.Base.Functor (Bluetooth.Internal.Errors.Handler errs) instance Bluetooth.Internal.Errors.IsElem Bluetooth.Internal.Errors.ThrowsFailed errs => Bluetooth.Internal.Errors.ThrowsFailed (Bluetooth.Internal.Errors.Handler errs) instance Bluetooth.Internal.Errors.IsElem Bluetooth.Internal.Errors.ThrowsInProgress errs => Bluetooth.Internal.Errors.ThrowsInProgress (Bluetooth.Internal.Errors.Handler errs) instance Bluetooth.Internal.Errors.IsElem Bluetooth.Internal.Errors.ThrowsNotPermitted errs => Bluetooth.Internal.Errors.ThrowsNotPermitted (Bluetooth.Internal.Errors.Handler errs) instance Bluetooth.Internal.Errors.IsElem Bluetooth.Internal.Errors.ThrowsNotAuthorized errs => Bluetooth.Internal.Errors.ThrowsNotAuthorized (Bluetooth.Internal.Errors.Handler errs) instance Bluetooth.Internal.Errors.IsElem Bluetooth.Internal.Errors.ThrowsNotSupported errs => Bluetooth.Internal.Errors.ThrowsNotSupported (Bluetooth.Internal.Errors.Handler errs) instance Bluetooth.Internal.Errors.IsElem Bluetooth.Internal.Errors.ThrowsInvalidValueLength errs => Bluetooth.Internal.Errors.ThrowsInvalidValueLength (Bluetooth.Internal.Errors.Handler errs) module Bluetooth.Internal.Serialize encodeRead :: Serialize a => ReadValueM a -> ReadValueM ByteString encodeWrite :: (Serialize a) => (a -> WriteValueM Bool) -> (ByteString -> WriteValueM Bool) module Bluetooth.Internal.Types -- | Append two Texts, keeping exactly one slash between them. (>) :: Text -> Text -> Text parentPath :: Text -> Text -- | UUIDs, used for services and characteristics. -- -- Unofficial UUIDs will have 128-bits, and will look this: -- -- d45e83fb-c772-459e-91a8-43cbf1443af4 -- -- Official UUIDs will have either 32 or 16 bits. -- -- See ITU-T Rec. X.677 for more information on the format and -- generation of these UUIDs. You can use the Online UUID -- Generator to generate UUIDs. data UUID UUID :: UUID -> UUID baseUUID :: String -- | A Haskell existential type corresponding to DBus' Variant. data Any MkAny :: a -> Any data WithObjectPath a WOP :: ObjectPath -> a -> WithObjectPath a [withObjectPathPath] :: WithObjectPath a -> ObjectPath [withObjectPathValue] :: WithObjectPath a -> a class HasPath s a | s -> a path :: HasPath s a => Lens' s a class HasValue s a | s -> a value :: HasValue s a => Lens' s a type AnyDBusDict = TypeDict TypeString TypeVariant data Descriptor Descriptor :: UUID -> Descriptor [descriptorUuid] :: Descriptor -> UUID data AdvertisingPacketType ConnectableUndirected :: AdvertisingPacketType ConnectableDirected :: AdvertisingPacketType NonConnnectableUndirected :: AdvertisingPacketType ScannableUndirected :: AdvertisingPacketType data CharacteristicProperty CPBroadcast :: CharacteristicProperty CPRead :: CharacteristicProperty CPEncryptRead :: CharacteristicProperty CPEncryptAuthenticatedRead :: CharacteristicProperty CPWriteWithoutResponse :: CharacteristicProperty CPWrite :: CharacteristicProperty CPEncryptWrite :: CharacteristicProperty CPEncryptAuthenticatedWrite :: CharacteristicProperty CPAuthenticatedSignedWrites :: CharacteristicProperty CPNotify :: CharacteristicProperty CPIndicate :: CharacteristicProperty CPSignedWriteCommand :: CharacteristicProperty chrPropPairs :: [(CharacteristicProperty, Text)] data CharacteristicOptions CharacteristicOptions :: Maybe Word16 -> CharacteristicOptions [characteristicOptionsOffset] :: CharacteristicOptions -> Maybe Word16 class HasOffset s a | s -> a offset :: HasOffset s a => Lens' s a type CharacteristicBS = Characteristic ByteString data Characteristic typ Characteristic :: UUID -> [CharacteristicProperty] -> Maybe (ReadValueM typ) -> Maybe (typ -> WriteValueM Bool) -> Maybe (IORef Bool) -> Characteristic typ [characteristicUuid] :: Characteristic typ -> UUID [characteristicProperties] :: Characteristic typ -> [CharacteristicProperty] [characteristicReadValue] :: Characteristic typ -> Maybe (ReadValueM typ) -- | Write a value. Note that the value is only writeable externally if the -- characteristic contains the CPWrite property *and* this is a Just. [characteristicWriteValue] :: Characteristic typ -> Maybe (typ -> WriteValueM Bool) -- | If Nothing, this characteristic does not send notifications. -- If Just False, the characteristic does not currently send -- notifications, but can be made to (with a StartNotify method -- request). If Just True, the characteristic currently sends -- notifications (and can be made to stop with a StopNotify -- method request). **NOTE**: Notifications do not currently work. [characteristicNotifying] :: Characteristic typ -> Maybe (IORef Bool) class HasNotifying s a | s -> a notifying :: HasNotifying s a => Lens' s a class HasProperties s a | s -> a properties :: HasProperties s a => Lens' s a class HasReadValue s a | s -> a readValue :: HasReadValue s a => Lens' s a class HasUuid s a | s -> a uuid :: HasUuid s a => Lens' s a class HasWriteValue s a | s -> a writeValue :: HasWriteValue s a => Lens' s a characteristicObjectPath :: ObjectPath -> Int -> ObjectPath data Service Service :: UUID -> [CharacteristicBS] -> Service [serviceUuid] :: Service -> UUID [serviceCharacteristics] :: Service -> [CharacteristicBS] class HasCharacteristics s a | s -> a characteristics :: HasCharacteristics s a => Lens' s a -- | An application. Can be created from it's IsString instance. -- The string (application path) is used only for the DBus API, and will -- not have relevance within Bluetooth. data Application Application :: ObjectPath -> [Service] -> Application [applicationPath] :: Application -> ObjectPath [applicationServices] :: Application -> [Service] class HasServices s a | s -> a services :: HasServices s a => Lens' s a serviceObjectPath :: ObjectPath -> Int -> ObjectPath data AdvertisementType Broadcast :: AdvertisementType Peripheral :: AdvertisementType data Advertisement Advertisement :: AdvertisementType -> [UUID] -> [UUID] -> Map Word16 ByteString -> Map UUID ByteString -> Bool -> Advertisement [advertisementType_] :: Advertisement -> AdvertisementType [advertisementServiceUUIDs] :: Advertisement -> [UUID] [advertisementSolicitUUIDs] :: Advertisement -> [UUID] [advertisementManufacturerData] :: Advertisement -> Map Word16 ByteString [advertisementServiceData] :: Advertisement -> Map UUID ByteString [advertisementIncludeTxPower] :: Advertisement -> Bool class HasIncludeTxPower s a | s -> a includeTxPower :: HasIncludeTxPower s a => Lens' s a class HasManufacturerData s a | s -> a manufacturerData :: HasManufacturerData s a => Lens' s a class HasServiceData s a | s -> a serviceData :: HasServiceData s a => Lens' s a class HasServiceUUIDs s a | s -> a serviceUUIDs :: HasServiceUUIDs s a => Lens' s a class HasSolicitUUIDs s a | s -> a solicitUUIDs :: HasSolicitUUIDs s a => Lens' s a class HasType_ s a | s -> a type_ :: HasType_ s a => Lens' s a data Connection Connection :: DBusConnection -> (ObjectPath -> Object -> IO ()) -> Connection [dbusConn] :: Connection -> DBusConnection [addObject] :: Connection -> ObjectPath -> Object -> IO () -- | Creates a connection to DBus. This does *not* represent Bluetooth -- connection. connect :: IO Connection newtype BluetoothM a BluetoothM :: (ReaderT Connection (ExceptT MethodError IO) a) -> BluetoothM a runBluetoothM :: BluetoothM a -> Connection -> IO (Either MethodError a) toBluetoothM :: (Connection -> IO (Either MethodError a)) -> BluetoothM a instance Control.Monad.Reader.Class.MonadReader Bluetooth.Internal.Types.Connection Bluetooth.Internal.Types.BluetoothM instance Control.Monad.Error.Class.MonadError DBus.Types.MethodError Bluetooth.Internal.Types.BluetoothM instance Control.Monad.IO.Class.MonadIO Bluetooth.Internal.Types.BluetoothM instance GHC.Base.Monad Bluetooth.Internal.Types.BluetoothM instance GHC.Base.Applicative Bluetooth.Internal.Types.BluetoothM instance GHC.Base.Functor Bluetooth.Internal.Types.BluetoothM instance Bluetooth.Internal.Types.HasIncludeTxPower Bluetooth.Internal.Types.Advertisement GHC.Types.Bool instance Bluetooth.Internal.Types.HasManufacturerData Bluetooth.Internal.Types.Advertisement (Data.Map.Base.Map GHC.Word.Word16 Data.ByteString.Internal.ByteString) instance Bluetooth.Internal.Types.HasServiceData Bluetooth.Internal.Types.Advertisement (Data.Map.Base.Map Bluetooth.Internal.Types.UUID Data.ByteString.Internal.ByteString) instance Bluetooth.Internal.Types.HasServiceUUIDs Bluetooth.Internal.Types.Advertisement [Bluetooth.Internal.Types.UUID] instance Bluetooth.Internal.Types.HasSolicitUUIDs Bluetooth.Internal.Types.Advertisement [Bluetooth.Internal.Types.UUID] instance Bluetooth.Internal.Types.HasType_ Bluetooth.Internal.Types.Advertisement Bluetooth.Internal.Types.AdvertisementType instance DBus.Types.Representable Bluetooth.Internal.Types.Advertisement instance Data.Default.Class.Default Bluetooth.Internal.Types.Advertisement instance GHC.Generics.Selector Bluetooth.Internal.Types.S1_0_5Advertisement instance GHC.Generics.Selector Bluetooth.Internal.Types.S1_0_4Advertisement instance GHC.Generics.Selector Bluetooth.Internal.Types.S1_0_3Advertisement instance GHC.Generics.Selector Bluetooth.Internal.Types.S1_0_2Advertisement instance GHC.Generics.Selector Bluetooth.Internal.Types.S1_0_1Advertisement instance GHC.Generics.Selector Bluetooth.Internal.Types.S1_0_0Advertisement instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_0Advertisement instance GHC.Generics.Datatype Bluetooth.Internal.Types.D1Advertisement instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_1AdvertisementType instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_0AdvertisementType instance GHC.Generics.Datatype Bluetooth.Internal.Types.D1AdvertisementType instance GHC.Generics.Generic Bluetooth.Internal.Types.Advertisement instance GHC.Enum.Enum Bluetooth.Internal.Types.AdvertisementType instance GHC.Enum.Bounded Bluetooth.Internal.Types.AdvertisementType instance GHC.Generics.Generic Bluetooth.Internal.Types.AdvertisementType instance GHC.Read.Read Bluetooth.Internal.Types.AdvertisementType instance GHC.Show.Show Bluetooth.Internal.Types.AdvertisementType instance GHC.Classes.Eq Bluetooth.Internal.Types.AdvertisementType instance Bluetooth.Internal.Types.HasPath Bluetooth.Internal.Types.Application DBus.Types.ObjectPath instance Bluetooth.Internal.Types.HasServices Bluetooth.Internal.Types.Application [Bluetooth.Internal.Types.Service] instance Data.String.IsString Bluetooth.Internal.Types.Application instance DBus.Types.Representable Bluetooth.Internal.Types.Application instance DBus.Types.Representable Bluetooth.Internal.Types.AdvertisementType instance GHC.Generics.Selector Bluetooth.Internal.Types.S1_0_1Application instance GHC.Generics.Selector Bluetooth.Internal.Types.S1_0_0Application instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_0Application instance GHC.Generics.Datatype Bluetooth.Internal.Types.D1Application instance GHC.Generics.Generic Bluetooth.Internal.Types.Application instance Bluetooth.Internal.Types.HasCharacteristics Bluetooth.Internal.Types.Service [Bluetooth.Internal.Types.CharacteristicBS] instance Bluetooth.Internal.Types.HasUuid Bluetooth.Internal.Types.Service Bluetooth.Internal.Types.UUID instance Data.String.IsString Bluetooth.Internal.Types.Service instance DBus.Types.Representable (Bluetooth.Internal.Types.WithObjectPath Bluetooth.Internal.Types.Service) instance GHC.Generics.Selector Bluetooth.Internal.Types.S1_0_1Service instance GHC.Generics.Selector Bluetooth.Internal.Types.S1_0_0Service instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_0Service instance GHC.Generics.Datatype Bluetooth.Internal.Types.D1Service instance GHC.Generics.Generic Bluetooth.Internal.Types.Service instance Bluetooth.Internal.Types.HasNotifying (Bluetooth.Internal.Types.Characteristic typ0) (GHC.Base.Maybe (GHC.IORef.IORef GHC.Types.Bool)) instance Bluetooth.Internal.Types.HasProperties (Bluetooth.Internal.Types.Characteristic typ0) [Bluetooth.Internal.Types.CharacteristicProperty] instance Bluetooth.Internal.Types.HasReadValue (Bluetooth.Internal.Types.Characteristic typ0) (GHC.Base.Maybe (Bluetooth.Internal.Errors.ReadValueM typ0)) instance Bluetooth.Internal.Types.HasUuid (Bluetooth.Internal.Types.Characteristic typ0) Bluetooth.Internal.Types.UUID instance Bluetooth.Internal.Types.HasWriteValue (Bluetooth.Internal.Types.Characteristic typ0) (GHC.Base.Maybe (typ0 -> Bluetooth.Internal.Errors.WriteValueM GHC.Types.Bool)) instance Data.String.IsString (Bluetooth.Internal.Types.Characteristic a) instance DBus.Types.Representable (Bluetooth.Internal.Types.WithObjectPath (Bluetooth.Internal.Types.Characteristic a)) instance GHC.Generics.Selector Bluetooth.Internal.Types.S1_0_4Characteristic instance GHC.Generics.Selector Bluetooth.Internal.Types.S1_0_3Characteristic instance GHC.Generics.Selector Bluetooth.Internal.Types.S1_0_2Characteristic instance GHC.Generics.Selector Bluetooth.Internal.Types.S1_0_1Characteristic instance GHC.Generics.Selector Bluetooth.Internal.Types.S1_0_0Characteristic instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_0Characteristic instance GHC.Generics.Datatype Bluetooth.Internal.Types.D1Characteristic instance GHC.Generics.Generic (Bluetooth.Internal.Types.Characteristic typ) instance Bluetooth.Internal.Types.HasOffset Bluetooth.Internal.Types.CharacteristicOptions (GHC.Base.Maybe GHC.Word.Word16) instance DBus.Types.Representable Bluetooth.Internal.Types.CharacteristicOptions instance GHC.Generics.Selector Bluetooth.Internal.Types.S1_0_0CharacteristicOptions instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_0CharacteristicOptions instance GHC.Generics.Datatype Bluetooth.Internal.Types.D1CharacteristicOptions instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_11CharacteristicProperty instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_10CharacteristicProperty instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_9CharacteristicProperty instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_8CharacteristicProperty instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_7CharacteristicProperty instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_6CharacteristicProperty instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_5CharacteristicProperty instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_4CharacteristicProperty instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_3CharacteristicProperty instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_2CharacteristicProperty instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_1CharacteristicProperty instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_0CharacteristicProperty instance GHC.Generics.Datatype Bluetooth.Internal.Types.D1CharacteristicProperty instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_3AdvertisingPacketType instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_2AdvertisingPacketType instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_1AdvertisingPacketType instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_0AdvertisingPacketType instance GHC.Generics.Datatype Bluetooth.Internal.Types.D1AdvertisingPacketType instance GHC.Generics.Selector Bluetooth.Internal.Types.S1_0_0Descriptor instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_0Descriptor instance GHC.Generics.Datatype Bluetooth.Internal.Types.D1Descriptor instance GHC.Generics.Generic Bluetooth.Internal.Types.CharacteristicOptions instance GHC.Read.Read Bluetooth.Internal.Types.CharacteristicOptions instance GHC.Show.Show Bluetooth.Internal.Types.CharacteristicOptions instance GHC.Classes.Eq Bluetooth.Internal.Types.CharacteristicOptions instance GHC.Generics.Generic Bluetooth.Internal.Types.CharacteristicProperty instance GHC.Classes.Ord Bluetooth.Internal.Types.CharacteristicProperty instance GHC.Enum.Bounded Bluetooth.Internal.Types.CharacteristicProperty instance GHC.Enum.Enum Bluetooth.Internal.Types.CharacteristicProperty instance GHC.Read.Read Bluetooth.Internal.Types.CharacteristicProperty instance GHC.Show.Show Bluetooth.Internal.Types.CharacteristicProperty instance GHC.Classes.Eq Bluetooth.Internal.Types.CharacteristicProperty instance GHC.Classes.Ord Bluetooth.Internal.Types.AdvertisingPacketType instance GHC.Generics.Generic Bluetooth.Internal.Types.AdvertisingPacketType instance GHC.Read.Read Bluetooth.Internal.Types.AdvertisingPacketType instance GHC.Show.Show Bluetooth.Internal.Types.AdvertisingPacketType instance GHC.Classes.Eq Bluetooth.Internal.Types.AdvertisingPacketType instance GHC.Generics.Generic Bluetooth.Internal.Types.Descriptor instance GHC.Show.Show Bluetooth.Internal.Types.Descriptor instance GHC.Classes.Eq Bluetooth.Internal.Types.Descriptor instance Bluetooth.Internal.Types.HasPath (Bluetooth.Internal.Types.WithObjectPath a0) DBus.Types.ObjectPath instance Bluetooth.Internal.Types.HasValue (Bluetooth.Internal.Types.WithObjectPath a0) a0 instance DBus.Types.Representable Bluetooth.Internal.Types.CharacteristicProperty instance GHC.Generics.Selector Bluetooth.Internal.Types.S1_0_1WithObjectPath instance GHC.Generics.Selector Bluetooth.Internal.Types.S1_0_0WithObjectPath instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_0WithObjectPath instance GHC.Generics.Datatype Bluetooth.Internal.Types.D1WithObjectPath instance GHC.Generics.Constructor Bluetooth.Internal.Types.C1_0UUID instance GHC.Generics.Datatype Bluetooth.Internal.Types.D1UUID instance GHC.Base.Functor Bluetooth.Internal.Types.WithObjectPath instance GHC.Generics.Generic (Bluetooth.Internal.Types.WithObjectPath a) instance GHC.Show.Show a => GHC.Show.Show (Bluetooth.Internal.Types.WithObjectPath a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Bluetooth.Internal.Types.WithObjectPath a) instance GHC.Generics.Generic Bluetooth.Internal.Types.UUID instance GHC.Classes.Ord Bluetooth.Internal.Types.UUID instance GHC.Show.Show Bluetooth.Internal.Types.UUID instance GHC.Classes.Eq Bluetooth.Internal.Types.UUID instance Data.String.IsString Bluetooth.Internal.Types.UUID instance DBus.Types.Representable Bluetooth.Internal.Types.UUID instance System.Random.Random Bluetooth.Internal.Types.UUID instance DBus.Types.Representable Bluetooth.Internal.Types.Any module Bluetooth.Internal.HasInterface class KnownSymbol iface => HasInterface obj (iface :: Symbol) getInterface :: HasInterface obj iface => obj -> Proxy iface -> Interface withInterface :: HasInterface obj iface => obj -> Proxy iface -> Object -- | The org.freedesktop.DBus.Properties interface. -- -- See the -- <https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties -- relevant section of the DBus spec> for more information. type ChangedProperties = TypeStruct '[DBusSimpleType TypeString, AnyDBusDict, TypeArray (DBusSimpleType TypeString)] defPropIFace :: (Representable a, RepType a ~ AnyDBusDict) => Maybe ObjectPath -> Text -> a -> Interface acceptingOptions :: MethodHandlerT IO ByteString -> CharacteristicOptions -> MethodHandlerT IO ByteString handlerToMethodHandler :: Handler errs a -> MethodHandlerT IO a valProp :: WithObjectPath (CharacteristicBS) -> Property (RepType ByteString) instance Bluetooth.Internal.HasInterface.HasInterface Bluetooth.Internal.Types.Application Bluetooth.Internal.Interfaces.ObjectManager instance Bluetooth.Internal.HasInterface.HasInterface (Bluetooth.Internal.Types.WithObjectPath Bluetooth.Internal.Types.Service) Bluetooth.Internal.Interfaces.Properties instance Bluetooth.Internal.HasInterface.HasInterface (Bluetooth.Internal.Types.WithObjectPath Bluetooth.Internal.Types.CharacteristicBS) Bluetooth.Internal.Interfaces.Properties instance Bluetooth.Internal.HasInterface.HasInterface Bluetooth.Internal.Types.Advertisement Bluetooth.Internal.Interfaces.Properties instance Bluetooth.Internal.HasInterface.HasInterface (Bluetooth.Internal.Types.WithObjectPath Bluetooth.Internal.Types.Service) Bluetooth.Internal.Interfaces.GattService instance Bluetooth.Internal.HasInterface.HasInterface (Bluetooth.Internal.Types.WithObjectPath Bluetooth.Internal.Types.CharacteristicBS) Bluetooth.Internal.Interfaces.GattCharacteristic instance Bluetooth.Internal.HasInterface.HasInterface (Bluetooth.Internal.Types.WithObjectPath Bluetooth.Internal.Types.Advertisement) Bluetooth.Internal.Interfaces.LEAdvertisement module Bluetooth.Internal.DBus -- | Registers an application and advertises it. If you would like to have -- finer-grained control of the advertisement, use -- registerApplication and advertise. registerAndAdvertiseApplication :: Application -> BluetoothM () -- | Registers an application (set of services) with Bluez. registerApplication :: Application -> BluetoothM () -- | Adds handlers for all the objects managed by the Application (plus the -- Application itself). addAllObjs :: Connection -> Application -> BluetoothM () -- | Advertise a set of services. advertise :: WithObjectPath Advertisement -> BluetoothM () -- | Create an advertisement for all of an application's services. The -- advertisement will be for peripheral (not broadcast) by default. advertisementFor :: Application -> WithObjectPath Advertisement -- | Write a characteristic (if possible). Returns True if characterstic -- was successfully written. writeChrc :: Serialize x => WithObjectPath CharacteristicBS -> x -> BluetoothM Bool bluezName :: Text bluezPath :: ObjectPath -- | This module exports all you should need to build a Bluetooth Low -- Energy (BLE) peripheral. -- -- The core concepts involved are: -- --
-- {-# LANGUAGE OverloadedStrings #-}
-- import Bluetooth
-- import Control.Concurrent (threadDelay)
--
-- app :: Application
-- app = "/com/turingjump/example" & services .~ [aService]
--
-- aService :: Service
-- aService = "d0bc6707-e9a5-4c85-8d22-d73d33f0330c"
-- & characteristics .~ [aCharacteristic]
--
-- aCharacteristic :: CharacteristicBS
-- aCharacteristic = "b3170df6-1770-4d60-86db-a487534cbcc3"
-- & readValue ?~ encodeRead (return (32::Int))
-- & properties .~ [CPRead]
--
-- main :: IO ()
-- main = do
-- conn <- connect
-- runBluetoothM (registerAndAdverstiseApplication app) conn
-- threadDelay maxBound
--
module Bluetooth
-- | Registers an application (set of services) with Bluez.
registerApplication :: Application -> BluetoothM ()
-- | Registers an application and advertises it. If you would like to have
-- finer-grained control of the advertisement, use
-- registerApplication and advertise.
registerAndAdvertiseApplication :: Application -> BluetoothM ()
-- | Advertise a set of services.
advertise :: WithObjectPath Advertisement -> BluetoothM ()
-- | Create an advertisement for all of an application's services. The
-- advertisement will be for peripheral (not broadcast) by default.
advertisementFor :: Application -> WithObjectPath Advertisement
-- | Creates a connection to DBus. This does *not* represent Bluetooth
-- connection.
connect :: IO Connection
runBluetoothM :: BluetoothM a -> Connection -> IO (Either MethodError a)
uuid :: HasUuid s a => Lens' s a
properties :: HasProperties s a => Lens' s a
readValue :: HasReadValue s a => Lens' s a
writeValue :: HasWriteValue s a => Lens' s a
notifying :: HasNotifying s a => Lens' s a
characteristics :: HasCharacteristics s a => Lens' s a
services :: HasServices s a => Lens' s a
path :: HasPath s a => Lens' s a
type_ :: HasType_ s a => Lens' s a
value :: HasValue s a => Lens' s a
solicitUUIDs :: HasSolicitUUIDs s a => Lens' s a
serviceUUIDs :: HasServiceUUIDs s a => Lens' s a
manufacturerData :: HasManufacturerData s a => Lens' s a
serviceData :: HasServiceData s a => Lens' s a
includeTxPower :: HasIncludeTxPower s a => Lens' s a
-- | Write a characteristic (if possible). Returns True if characterstic
-- was successfully written.
writeChrc :: Serialize x => WithObjectPath CharacteristicBS -> x -> BluetoothM Bool
data Connection
-- | An application. Can be created from it's IsString instance.
-- The string (application path) is used only for the DBus API, and will
-- not have relevance within Bluetooth.
data Application
data Service
-- | UUIDs, used for services and characteristics.
--
-- Unofficial UUIDs will have 128-bits, and will look this:
--
-- d45e83fb-c772-459e-91a8-43cbf1443af4
--
-- Official UUIDs will have either 32 or 16 bits.
--
-- See ITU-T Rec. X.677 for more information on the format and
-- generation of these UUIDs. You can use the Online UUID
-- Generator to generate UUIDs.
data UUID
UUID :: UUID -> UUID
data CharacteristicProperty
CPBroadcast :: CharacteristicProperty
CPRead :: CharacteristicProperty
CPEncryptRead :: CharacteristicProperty
CPEncryptAuthenticatedRead :: CharacteristicProperty
CPWriteWithoutResponse :: CharacteristicProperty
CPWrite :: CharacteristicProperty
CPEncryptWrite :: CharacteristicProperty
CPEncryptAuthenticatedWrite :: CharacteristicProperty
CPAuthenticatedSignedWrites :: CharacteristicProperty
CPNotify :: CharacteristicProperty
CPIndicate :: CharacteristicProperty
CPSignedWriteCommand :: CharacteristicProperty
data Characteristic typ
type CharacteristicBS = Characteristic ByteString
data Advertisement
data WithObjectPath a
encodeRead :: Serialize a => ReadValueM a -> ReadValueM ByteString
encodeWrite :: (Serialize a) => (a -> WriteValueM Bool) -> (ByteString -> WriteValueM Bool)
data Handler (errs :: [(* -> *) -> Constraint]) a
type ReadValueM a = Handler '[ThrowsFailed, ThrowsInProgress, ThrowsNotPermitted, ThrowsNotAuthorized, ThrowsNotSupported] a
type WriteValueM a = Handler '[ThrowsFailed, ThrowsInProgress, ThrowsNotPermitted, ThrowsInvalidValueLength, ThrowsNotAuthorized, ThrowsNotSupported] a
class ThrowsFailed m
errFailed :: ThrowsFailed m => m a
class ThrowsInProgress m
errInProgress :: ThrowsInProgress m => m a
class ThrowsNotPermitted m
errNotPermitted :: ThrowsNotPermitted m => m a
class ThrowsNotAuthorized m
errNotAuthorized :: ThrowsNotAuthorized m => m a
class ThrowsNotSupported m
errNotSupported :: ThrowsNotSupported m => m a
class ThrowsInvalidValueLength m
errInvalidValueLength :: ThrowsInvalidValueLength m => m a