-- 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.3.4.0 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.Lenses class HasPath s a | s -> a -- | Returns the ObjectPath of an entity. path :: HasPath s a => Lens' s a class HasValue s a | s -> a -- | Returns the actual value of an entity that is wrapped in an value :: HasValue s a => Lens' s a class HasOffset s a | s -> a -- | A Word16 data offset. offset :: HasOffset s a => Lens' s a class HasProperties s a | s -> a -- | The properties of e.g. a characteristic. properties :: HasProperties s a => Lens' s a class HasReadValue s a | s -> a -- | Access the handler for reading a value, if there is one. readValue :: HasReadValue s a => Lens' s a class HasWriteValue s a | s -> a -- | Access the handler for writing a value, if there is one. The handler -- should return True if the value was successfully update. writeValue :: HasWriteValue s a => Lens' s a class HasUuid s a | s -> a -- | The UUID of an entity uuid :: HasUuid s a => Lens' s a class HasCharacteristics s a | s -> a -- | An access for the list of characteristics. characteristics :: HasCharacteristics s a => Lens' s a class HasServices s a | s -> a -- | An access for the list of services. services :: HasServices s a => Lens' s a class HasIncludeTxPower s a | s -> a -- | Accessor for indicating whether an Advertisement announces TX -- power (transmission power). includeTxPower :: HasIncludeTxPower s a => Lens' s a class HasManufacturerData s a | s -> a -- | Accessor for manufacting data. manufacturerData :: HasManufacturerData s a => Lens' s a class HasServiceData s a | s -> a -- | Accessor for manufacting data. serviceData :: HasServiceData s a => Lens' s a class HasServiceUUIDs s a | s -> a -- | Accessor for service UUIDs serviceUUIDs :: HasServiceUUIDs s a => Lens' s a class HasSolicitUUIDs s a | s -> a -- | Accessor for solicit UUIDs. These are UUIDs that an application or -- service expects to be available. solicitUUIDs :: HasSolicitUUIDs s a => Lens' s a class HasType_ s a | s -> a type_ :: HasType_ s a => Lens' s a 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 newtype Handler a Handler :: ExceptT Text IO a -> Handler a [getReadValue] :: Handler a -> ExceptT Text IO a runHandler :: Handler a -> IO (Either Text a) -- | Generic failure errorFailed :: Handler a errorInProgress :: Handler a errorNotPermitted :: Handler a errorNotAuthorized :: Handler a errorNotSupported :: Handler a -- | Indicates that the argument has invalid length. Should not be used -- from a read handler errorInvalidValueLength :: Handler a instance Control.Monad.Error.Class.MonadError Data.Text.Internal.Text Bluetooth.Internal.Errors.Handler instance GHC.Generics.Generic (Bluetooth.Internal.Errors.Handler a) instance Control.Monad.IO.Class.MonadIO Bluetooth.Internal.Errors.Handler instance GHC.Base.Monad Bluetooth.Internal.Errors.Handler instance GHC.Base.Applicative Bluetooth.Internal.Errors.Handler instance GHC.Base.Functor Bluetooth.Internal.Errors.Handler module Bluetooth.Internal.Serialize encodeRead :: Serialize a => Handler a -> Handler ByteString encodeWrite :: (Serialize a) => (a -> Handler Bool) -> (ByteString -> Handler 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] :: forall a. (Representable a) => a -> Any data WithObjectPath a WOP :: ObjectPath -> a -> WithObjectPath a [withObjectPathPath] :: WithObjectPath a -> ObjectPath [withObjectPathValue] :: WithObjectPath a -> 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 type CharacteristicBS = Characteristic ByteString data Characteristic typ Characteristic :: UUID -> [CharacteristicProperty] -> Maybe (Handler typ) -> Maybe (typ -> Handler Bool) -> Characteristic typ [characteristicUuid] :: Characteristic typ -> UUID [characteristicProperties] :: Characteristic typ -> [CharacteristicProperty] [characteristicReadValue] :: Characteristic typ -> Maybe (Handler 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 -> Handler Bool) characteristicIsNotifying :: UUID -> MVar Bool objectPathOf :: UUID -> IORef (Maybe ObjectPath) characteristicObjectPath :: ObjectPath -> Int -> ObjectPath data Service Service :: UUID -> [CharacteristicBS] -> Service [serviceUuid] :: Service -> UUID [serviceCharacteristics] :: Service -> [CharacteristicBS] -- | 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] serviceObjectPath :: ObjectPath -> Int -> ObjectPath data AdvertisementType Broadcast :: AdvertisementType Peripheral :: AdvertisementType -- | An advertisement can be generated automatically with -- advertisementFor, or with the IsList instance. Both -- of these by default assume the advertisement is for a peripheral. -- -- You can also, of course, use the constructor. 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 data Connection Connection :: DBusConnection -> (ObjectPath -> Object -> IO ()) -> Connection [dbusConn] :: Connection -> DBusConnection [addObject] :: Connection -> ObjectPath -> Object -> IO () -- | The unique DBus connection name, Useful for monitoring activity with -- 'dbus-monitor'. For information on how to setup dbus-monitor for -- debugging, see DebuggingDBus. connectionName :: Connection -> Text -- | Creates a connection to DBus. This does *not* represent Bluetooth -- connection. connect :: IO Connection data Error DBusError :: MethodError -> Error BLEError :: Text -> Error newtype BluetoothM a BluetoothM :: (ReaderT Connection (ExceptT Error IO) a) -> BluetoothM a runBluetoothM :: BluetoothM a -> Connection -> IO (Either Error a) toBluetoothM :: (Connection -> IO (Either MethodError a)) -> BluetoothM a -- | This datatype, which is kept opaque, is returned when an application -- is successfully registered, and required as an argument from functions -- that should only be called after the application has been registered. newtype ApplicationRegistered ApplicationRegistered :: ObjectPath -> ApplicationRegistered data Status Success :: Status Failure :: Status instance GHC.Generics.Generic Bluetooth.Internal.Types.Status instance GHC.Enum.Enum Bluetooth.Internal.Types.Status instance GHC.Classes.Ord Bluetooth.Internal.Types.Status instance GHC.Read.Read Bluetooth.Internal.Types.Status instance GHC.Show.Show Bluetooth.Internal.Types.Status instance GHC.Classes.Eq Bluetooth.Internal.Types.Status instance GHC.Generics.Generic Bluetooth.Internal.Types.ApplicationRegistered instance GHC.Show.Show Bluetooth.Internal.Types.ApplicationRegistered instance GHC.Classes.Eq Bluetooth.Internal.Types.ApplicationRegistered instance Control.Monad.Reader.Class.MonadReader Bluetooth.Internal.Types.Connection Bluetooth.Internal.Types.BluetoothM instance Control.Monad.Error.Class.MonadError Bluetooth.Internal.Types.Error 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 GHC.Generics.Generic Bluetooth.Internal.Types.Error instance GHC.Show.Show Bluetooth.Internal.Types.Error instance Bluetooth.Internal.Lenses.HasIncludeTxPower Bluetooth.Internal.Types.Advertisement GHC.Types.Bool instance Bluetooth.Internal.Lenses.HasManufacturerData Bluetooth.Internal.Types.Advertisement (Data.Map.Base.Map GHC.Word.Word16 Data.ByteString.Internal.ByteString) instance Bluetooth.Internal.Lenses.HasServiceData Bluetooth.Internal.Types.Advertisement (Data.Map.Base.Map Bluetooth.Internal.Types.UUID Data.ByteString.Internal.ByteString) instance Bluetooth.Internal.Lenses.HasServiceUUIDs Bluetooth.Internal.Types.Advertisement [Bluetooth.Internal.Types.UUID] instance Bluetooth.Internal.Lenses.HasSolicitUUIDs Bluetooth.Internal.Types.Advertisement [Bluetooth.Internal.Types.UUID] instance Bluetooth.Internal.Lenses.HasType_ Bluetooth.Internal.Types.Advertisement Bluetooth.Internal.Types.AdvertisementType instance GHC.Exts.IsList Bluetooth.Internal.Types.Advertisement instance DBus.Types.Representable Bluetooth.Internal.Types.Advertisement instance Data.Default.Class.Default Bluetooth.Internal.Types.Advertisement instance Data.String.IsString Bluetooth.Internal.Types.Error instance GHC.Generics.Generic Bluetooth.Internal.Types.Advertisement instance GHC.Show.Show Bluetooth.Internal.Types.Advertisement instance GHC.Classes.Eq 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.Lenses.HasPath Bluetooth.Internal.Types.Application DBus.Types.ObjectPath instance Bluetooth.Internal.Lenses.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.Generic Bluetooth.Internal.Types.Application instance Bluetooth.Internal.Lenses.HasCharacteristics Bluetooth.Internal.Types.Service [Bluetooth.Internal.Types.CharacteristicBS] instance Bluetooth.Internal.Lenses.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.Generic Bluetooth.Internal.Types.Service instance Bluetooth.Internal.Lenses.HasProperties (Bluetooth.Internal.Types.Characteristic typ0) [Bluetooth.Internal.Types.CharacteristicProperty] instance Bluetooth.Internal.Lenses.HasReadValue (Bluetooth.Internal.Types.Characteristic typ0) (GHC.Base.Maybe (Bluetooth.Internal.Errors.Handler typ0)) instance Bluetooth.Internal.Lenses.HasUuid (Bluetooth.Internal.Types.Characteristic typ0) Bluetooth.Internal.Types.UUID instance Bluetooth.Internal.Lenses.HasWriteValue (Bluetooth.Internal.Types.Characteristic typ0) (GHC.Base.Maybe (typ0 -> Bluetooth.Internal.Errors.Handler 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.Generic (Bluetooth.Internal.Types.Characteristic typ) instance Bluetooth.Internal.Lenses.HasOffset Bluetooth.Internal.Types.CharacteristicOptions (GHC.Base.Maybe GHC.Word.Word16) instance DBus.Types.Representable Bluetooth.Internal.Types.CharacteristicOptions 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.Lenses.HasPath (Bluetooth.Internal.Types.WithObjectPath a0) DBus.Types.ObjectPath instance Bluetooth.Internal.Lenses.HasValue (Bluetooth.Internal.Types.WithObjectPath a0) a0 instance DBus.Types.Representable Bluetooth.Internal.Types.CharacteristicProperty 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 :: forall a. (Representable a, RepType a ~ AnyDBusDict) => Maybe ObjectPath -> Text -> a -> Interface acceptingOptions :: MethodHandlerT IO ByteString -> CharacteristicOptions -> MethodHandlerT IO ByteString handlerToMethodHandler :: Handler 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 ApplicationRegistered -- | Registers an application (set of services) with Bluez. registerApplication :: Application -> BluetoothM ApplicationRegistered unregisterApplication :: ApplicationRegistered -> 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 () -- | Unregister an adverstisement. unadvertise :: 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 -- | Triggers notifications or indications. triggerNotification :: ApplicationRegistered -> CharacteristicBS -> BluetoothM () bluezName :: Text bluezPath :: ObjectPath -- | This module exports all you should need to build a Bluetooth Low -- Energy (BLE) peripheral. -- -- The core concepts involved are: -- -- -- -- All three have IsString instances and lens field accessors. -- The recommended way of using this library is by using the -- OverloadedStrings pragma and lenses. A complete example can -- be found here. -- --
--   {-# 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 ApplicationRegistered -- | 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 ApplicationRegistered unregisterApplication :: ApplicationRegistered -> 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 -- | Unregister an adverstisement. unadvertise :: WithObjectPath Advertisement -> BluetoothM () -- | Creates a connection to DBus. This does *not* represent Bluetooth -- connection. connect :: IO Connection runBluetoothM :: BluetoothM a -> Connection -> IO (Either Error a) runHandler :: Handler a -> IO (Either Text a) -- | The UUID of an entity uuid :: HasUuid s a => Lens' s a -- | The properties of e.g. a characteristic. properties :: HasProperties s a => Lens' s a -- | Access the handler for reading a value, if there is one. readValue :: HasReadValue s a => Lens' s a -- | Access the handler for writing a value, if there is one. The handler -- should return True if the value was successfully update. writeValue :: HasWriteValue s a => Lens' s a -- | An access for the list of characteristics. characteristics :: HasCharacteristics s a => Lens' s a -- | An access for the list of services. services :: HasServices s a => Lens' s a -- | Returns the ObjectPath of an entity. path :: HasPath s a => Lens' s a type_ :: HasType_ s a => Lens' s a -- | Returns the actual value of an entity that is wrapped in an value :: HasValue s a => Lens' s a -- | Accessor for solicit UUIDs. These are UUIDs that an application or -- service expects to be available. solicitUUIDs :: HasSolicitUUIDs s a => Lens' s a -- | Accessor for service UUIDs serviceUUIDs :: HasServiceUUIDs s a => Lens' s a -- | Accessor for manufacting data. manufacturerData :: HasManufacturerData s a => Lens' s a -- | Accessor for manufacting data. serviceData :: HasServiceData s a => Lens' s a -- | Accessor for indicating whether an Advertisement announces TX -- power (transmission power). includeTxPower :: HasIncludeTxPower s a => Lens' s a -- | The unique DBus connection name, Useful for monitoring activity with -- 'dbus-monitor'. For information on how to setup dbus-monitor for -- debugging, see DebuggingDBus. connectionName :: Connection -> Text characteristicIsNotifying :: UUID -> MVar Bool -- | Triggers notifications or indications. triggerNotification :: ApplicationRegistered -> CharacteristicBS -> BluetoothM () 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 -- | This datatype, which is kept opaque, is returned when an application -- is successfully registered, and required as an argument from functions -- that should only be called after the application has been registered. data ApplicationRegistered 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 -- | An advertisement can be generated automatically with -- advertisementFor, or with the IsList instance. Both -- of these by default assume the advertisement is for a peripheral. -- -- You can also, of course, use the constructor. 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 data WithObjectPath a encodeRead :: Serialize a => Handler a -> Handler ByteString encodeWrite :: (Serialize a) => (a -> Handler Bool) -> (ByteString -> Handler Bool) data Handler a -- | Generic failure errorFailed :: Handler a errorInProgress :: Handler a errorNotPermitted :: Handler a errorNotSupported :: Handler a errorNotAuthorized :: Handler a -- | Indicates that the argument has invalid length. Should not be used -- from a read handler errorInvalidValueLength :: Handler a