Copyright | (c) James Sully 2020-2021 |
---|---|
License | BSD 3-Clause |
Maintainer | sullyj3@gmail.com |
Stability | experimental |
Portability | untested |
Safe Haskell | None |
Language | Haskell2010 |
Contains the Message type, representing Buttplug protocol messages (https://buttplug-spec.docs.buttplug.io/messages.html)
Synopsis
- clientMessageVersion :: Word
- data ErrorCode
- errCodeFromInt :: Int -> Maybe ErrorCode
- fromErrCode :: ErrorCode -> Int
- newtype RawData = RawData ByteString
- data Vibrate = Vibrate {}
- data Rotate = Rotate {}
- data LinearActuate = LinearActuate {}
- data Message
- = MsgOk { }
- | MsgError { }
- | MsgPing { }
- | MsgRequestServerInfo {
- msgId :: Word
- msgClientName :: Text
- msgMessageVersion :: Word
- | MsgServerInfo { }
- | MsgStartScanning { }
- | MsgStopScanning { }
- | MsgScanningFinished { }
- | MsgRequestDeviceList { }
- | MsgDeviceList {
- msgId :: Word
- msgDevices :: [Device]
- | MsgDeviceAdded { }
- | MsgDeviceRemoved {
- msgId :: Word
- msgDeviceIndex :: Word
- | MsgRawWriteCmd {
- msgId :: Word
- msgDeviceIndex :: Word
- msgEndpoint :: Text
- msgData :: RawData
- msgWriteWithResponse :: Bool
- | MsgRawReadCmd { }
- | MsgRawReading {
- msgId :: Word
- msgDeviceIndex :: Word
- msgEndpoint :: Text
- msgData :: RawData
- | MsgRawSubscribeCmd {
- msgId :: Word
- msgDeviceIndex :: Word
- msgEndpoint :: Text
- | MsgRawUnsubscribeCmd {
- msgId :: Word
- msgDeviceIndex :: Word
- msgEndpoint :: Text
- | MsgStopDeviceCmd {
- msgId :: Word
- msgDeviceIndex :: Word
- | MsgStopAllDevices { }
- | MsgVibrateCmd { }
- | MsgLinearCmd {
- msgId :: Word
- msgDeviceIndex :: Word
- msgVectors :: [LinearActuate]
- | MsgRotateCmd {
- msgId :: Word
- msgDeviceIndex :: Word
- msgRotations :: [Rotate]
- | MsgBatteryLevelCmd {
- msgId :: Word
- msgDeviceIndex :: Word
- | MsgBatteryLevelReading {
- msgId :: Word
- msgDeviceIndex :: Word
- msgBatteryLevel :: Double
- | MsgRSSILevelCmd {
- msgId :: Word
- msgDeviceIndex :: Word
- | MsgRSSILevelReading {
- msgId :: Word
- msgDeviceIndex :: Word
- msgRSSILevel :: Int
Documentation
clientMessageVersion :: Word Source #
The version of the Buttplug message protocol that the client speaks. (currently version 2)
Errors from the server, used in the Error message.
ERROR_UNKNOWN | An unknown error occurred. |
ERROR_INIT | Handshake did not succeed. |
ERROR_PING | A ping was not sent in the expected time. |
ERROR_MSG | A message parsing or permission error occurred. |
ERROR_DEVICE | A command sent to a device returned an error. |
Instances
Used for the Raw* messages.
Instances
Eq RawData Source # | |
Show RawData Source # | |
Generic RawData Source # | |
FromJSON RawData Source # | |
Defined in Buttplug.Core.Message parseJSON :: Value -> Parser RawData parseJSONList :: Value -> Parser [RawData] | |
ToJSON RawData Source # | |
Defined in Buttplug.Core.Message toEncoding :: RawData -> Encoding toJSONList :: [RawData] -> Value toEncodingList :: [RawData] -> Encoding | |
type Rep RawData Source # | |
Defined in Buttplug.Core.Message type Rep RawData = D1 ('MetaData "RawData" "Buttplug.Core.Message" "buttplug-hs-core-0.1.0.0-inplace" 'True) (C1 ('MetaCons "RawData" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString))) |
Used in VibrateCmd to specify the speed of the motor at the given index
Instances
Eq Vibrate Source # | |
Show Vibrate Source # | |
Generic Vibrate Source # | |
FromJSON Vibrate Source # | |
Defined in Buttplug.Core.Message parseJSON :: Value -> Parser Vibrate parseJSONList :: Value -> Parser [Vibrate] | |
ToJSON Vibrate Source # | |
Defined in Buttplug.Core.Message toEncoding :: Vibrate -> Encoding toJSONList :: [Vibrate] -> Value toEncodingList :: [Vibrate] -> Encoding | |
type Rep Vibrate Source # | |
Defined in Buttplug.Core.Message type Rep Vibrate = D1 ('MetaData "Vibrate" "Buttplug.Core.Message" "buttplug-hs-core-0.1.0.0-inplace" 'False) (C1 ('MetaCons "Vibrate" 'PrefixI 'True) (S1 ('MetaSel ('Just "vibrateIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "vibrateSpeed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double))) |
Used in RotateCmd to specify the speed and direction of rotation of the motor at the given index
Rotate | |
|
Instances
Eq Rotate Source # | |
Show Rotate Source # | |
Generic Rotate Source # | |
FromJSON Rotate Source # | |
Defined in Buttplug.Core.Message parseJSON :: Value -> Parser Rotate parseJSONList :: Value -> Parser [Rotate] | |
ToJSON Rotate Source # | |
Defined in Buttplug.Core.Message toEncoding :: Rotate -> Encoding toJSONList :: [Rotate] -> Value toEncodingList :: [Rotate] -> Encoding | |
type Rep Rotate Source # | |
Defined in Buttplug.Core.Message type Rep Rotate = D1 ('MetaData "Rotate" "Buttplug.Core.Message" "buttplug-hs-core-0.1.0.0-inplace" 'False) (C1 ('MetaCons "Rotate" 'PrefixI 'True) (S1 ('MetaSel ('Just "rotateIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: (S1 ('MetaSel ('Just "rotateSpeed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double) :*: S1 ('MetaSel ('Just "rotateClockwise") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))) |
data LinearActuate Source #
Used in LinearCmd to specify how to move the linear actuator at the given index
Instances
The type of Buttplug protocol messages. See (https://buttplug-spec.docs.buttplug.io/messages.html) for the protocol specification and an explanation of the purpose of each message.