ble 0.3.2.1 → 0.3.3.0
raw patch · 4 files changed
+22/−4 lines, 4 files
Files
- ble.cabal +1/−1
- package.yaml +1/−1
- src/Bluetooth.hs +1/−1
- src/Bluetooth/Internal/Types.hs +19/−1
ble.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack name: ble-version: 0.3.2.1+version: 0.3.3.0 synopsis: Bluetooth Low Energy (BLE) peripherals description: This package provides a Haskell API for writing Bluetooth Low Energy peripherals. stability: alpha
package.yaml view
@@ -1,5 +1,5 @@ name: ble-version: 0.3.2.1+version: 0.3.3.0 synopsis: Bluetooth Low Energy (BLE) peripherals description: > This package provides a Haskell API for writing Bluetooth Low Energy
src/Bluetooth.hs view
@@ -88,7 +88,7 @@ , CharacteristicProperty(..) , Characteristic , CharacteristicBS- , Advertisement+ , Advertisement(..) , WithObjectPath
src/Bluetooth/Internal/Types.hs view
@@ -27,6 +27,7 @@ Representable (..), connectBus, objectPath, objectRoot) import DBus.Types (dBusConnectionName, root)+import GHC.Exts (IsList (..)) import GHC.Generics (Generic) import Lens.Micro import Lens.Micro.TH (makeFields)@@ -372,6 +373,11 @@ Peripheral -> toRep ("peripheral" :: T.Text) fromRep _ = error "not implemented" +-- | 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_ :: AdvertisementType , advertisementServiceUUIDs :: [UUID]@@ -379,9 +385,21 @@ , advertisementManufacturerData :: Map.Map Word16 BS.ByteString , advertisementServiceData :: Map.Map UUID BS.ByteString , advertisementIncludeTxPower :: Bool- } deriving (Generic)+ } deriving (Eq, Show, Generic) makeFields ''Advertisement++instance IsList Advertisement where+ type Item Advertisement = UUID+ fromList services' = Advertisement+ { advertisementType_ = Peripheral+ , advertisementServiceUUIDs = services'+ , advertisementSolicitUUIDs = []+ , advertisementManufacturerData = mempty+ , advertisementServiceData = mempty+ , advertisementIncludeTxPower = False+ }+ toList adv = adv ^. serviceUUIDs instance Representable Advertisement where type RepType Advertisement = 'TypeDict 'TypeString 'TypeVariant