Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- sendMessage :: MonadLifx m => HostAddress -> Message a -> m a
- data Message a where
- 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
- data LightState = LightState {}
- newtype StatePower = StatePower {}
- encodeMessage :: 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 #
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.2.0-EXDZ9MuSZ9YFWpI9PywcjM" '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 1 second.
Use runLifxT
for more control.
DecodeFailure ByteString ByteOffset String | |
RecvTimeout | |
WrongPacketType Word16 Word16 | |
WrongSender SockAddr SockAddr | |
WrongSequenceNumber Word8 Word8 |
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 #
Responses
data LightState Source #
Instances
newtype StatePower Source #
Instances
Low-level
encodeMessage :: Bool -> Word8 -> Word32 -> Message a -> ByteString Source #
Header | |
|