Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- sendMessage :: MonadLifx m => HostAddress -> Message a -> m a
- broadcastMessage :: MonadLifx m => Message a -> m [(HostAddress, a)]
- discoverDevices :: MonadLifx m => Maybe Int -> m [HostAddress]
- data Message a where
- GetService :: Message StateService
- GetPower :: Message StatePower
- SetPower :: Bool -> Message ()
- GetColor :: Message LightState
- SetColor :: HSBK -> Duration -> Message ()
- SetLightPower :: Bool -> Duration -> Message ()
- data HSBK = HSBK {
- hue :: Word16
- saturation :: Word16
- brightness :: Word16
- kelvin :: Word16
- newtype Duration = Duration Word32
- type Lifx = LifxT IO
- runLifx :: Lifx a -> IO a
- newtype LifxT m a = LifxT {}
- runLifxT :: MonadIO m => Int -> LifxT m a -> m (Either LifxError a)
- data LifxError
- class MonadIO m => MonadLifx m where
- getSocket :: m Socket
- getSource :: m Word32
- getTimeout :: m Int
- incrementCounter :: m ()
- getCounter :: m Word8
- lifxThrow :: LifxError -> m a
- handleOldMessage :: Word8 -> Word8 -> Word16 -> ByteString -> m ()
- data LightState = LightState {}
- data StateService = StateService {}
- data Service
- newtype StatePower = StatePower {}
- encodeMessage :: Bool -> Bool -> Word8 -> Word32 -> Message a -> ByteString
- data Header = Header {
- size :: Word16
- protocol :: Word16
- addressable :: Bool
- tagged :: Bool
- origin :: Word8
- source :: Word32
- target :: Word64
- resRequired :: Bool
- ackRequired :: Bool
- sequenceCounter :: Word8
- packetType :: Word16
Documentation
sendMessage :: MonadLifx m => HostAddress -> Message a -> m a Source #
broadcastMessage :: MonadLifx m => Message a -> m [(HostAddress, a)] Source #
discoverDevices :: MonadLifx m => Maybe Int -> m [HostAddress] Source #
If an integer argument is given, wait until we have responses from that number of devices. Otherwise just keep waiting until timeout.
GetService :: Message StateService | |
GetPower :: Message StatePower | |
SetPower :: Bool -> Message () | |
GetColor :: Message LightState | |
SetColor :: HSBK -> Duration -> Message () | |
SetLightPower :: Bool -> Duration -> Message () |
HSBK | |
|
Instances
Eq HSBK Source # | |
Ord HSBK Source # | |
Show HSBK Source # | |
Generic HSBK Source # | |
type Rep HSBK Source # | |
Defined in Lifx.Lan type Rep HSBK = D1 ('MetaData "HSBK" "Lifx.Lan" "lifx-lan-0.3.0-GAAfhhepnfu1kJe4hZeFDh" 'False) (C1 ('MetaCons "HSBK" 'PrefixI 'True) ((S1 ('MetaSel ('Just "hue") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16) :*: S1 ('MetaSel ('Just "saturation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16)) :*: (S1 ('MetaSel ('Just "brightness") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16) :*: S1 ('MetaSel ('Just "kelvin") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16)))) |
runLifx :: Lifx a -> IO a Source #
Note that this throws LifxError
s as IOException
s, and sets timeout to 5 seconds.
Use runLifxT
for more control.
Instances
Monad m => Monad (LifxT m) Source # | |
Functor m => Functor (LifxT m) Source # | |
Monad m => Applicative (LifxT m) Source # | |
MonadIO m => MonadIO (LifxT m) Source # | |
MonadIO m => MonadLifx (LifxT m) Source # | |
Defined in Lifx.Lan getSocket :: LifxT m Socket Source # getSource :: LifxT m Word32 Source # getTimeout :: LifxT m Int Source # incrementCounter :: LifxT m () Source # getCounter :: LifxT m Word8 Source # lifxThrow :: LifxError -> LifxT m a Source # handleOldMessage :: Word8 -> Word8 -> Word16 -> ByteString -> LifxT m () Source # |
Instances
class MonadIO m => MonadLifx m where Source #
getSocket :: m Socket Source #
getSource :: m Word32 Source #
getTimeout :: m Int Source #
incrementCounter :: m () Source #
getCounter :: m Word8 Source #
lifxThrow :: LifxError -> m a Source #
:: Word8 | expected counter value |
-> Word8 | actual counter value |
-> Word16 | packet type |
-> ByteString | payload |
-> m () |
Instances
Responses
data LightState Source #
Instances
data StateService Source #
Instances
Instances
Eq Service Source # | |
Ord Service Source # | |
Show Service Source # | |
Generic Service Source # | |
type Rep Service Source # | |
Defined in Lifx.Lan type Rep Service = D1 ('MetaData "Service" "Lifx.Lan" "lifx-lan-0.3.0-GAAfhhepnfu1kJe4hZeFDh" 'False) ((C1 ('MetaCons "ServiceUDP" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ServiceReserved1" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ServiceReserved2" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ServiceReserved3" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ServiceReserved4" 'PrefixI 'False) (U1 :: Type -> Type)))) |
newtype StatePower Source #
Instances
Low-level
encodeMessage :: Bool -> Bool -> Word8 -> Word32 -> Message a -> ByteString Source #
Header | |
|