buttplug-hs-core-0.1.0.0: Client library for buttplug.io
Copyright(c) James Sully 2020-2021
LicenseBSD 3-Clause
Maintainersullyj3@gmail.com
Stabilityexperimental
Portabilityuntested
Safe HaskellNone
LanguageHaskell2010

Buttplug.Core

Description

An implementation of the Buttplug Intimate Device Control Standard (https://buttplug.io/)

Synopsis

Overview

See (https://buttplug.io/documentation/) for documentation of the Buttplug protocol.

The basic idea is:

  • The Buttplug protocol is designed to simplify the process of using computers to control sex toys, by abstracting over individual hardware details.
  • A Buttplug server is responsible for connecting to individual devices, and understanding the specific details of operating them. I recommend Intiface-cli-rs, a command line server implementation: (https://github.com/intiface/intiface-cli-rs)
  • Applications act as Buttplug clients, speaking a straightforward message format to the server, which abstracts over the individual details of different devices. In this way developers are presented with a simple API for controlling a wide variety of different toys.

This package contains the core types and functionality for writing clients, including:

As this library is still experimental, please feel free to suggest API improvements!

Tutorial

Connectors and connections

class Connector c Source #

Abstracts over methods of connecting to a buttplug server. The connector contains all the information necessary for establishing a connection.

Minimal complete definition

runClient, sendMessages, receiveMsgs

type family Connection c = conn | conn -> c Source #

A Connector determines a unique connection type that is used for communication.

Instances

Instances details
type Connection WebSocketConnector Source # 
Instance details

Defined in Buttplug.Core.Connector

type Connection WebSocketConnector = Connection

runClient :: Connector c => c -> (Connection c -> IO a) -> IO a Source #

Main entry point for communicating with the Buttplug server. Establish a connection to the server and pass the connection handle to the continuation.

sendMessages :: Connector c => Connection c -> [Message] -> IO () Source #

Send Messages to the server. In the Buttplug protocol, all messages are wrapped in a JSON array (here a Haskell list) to facilitate sending multiple messages simultaneously. Use sendMessage to send a single message.

receiveMsgs :: Connector c => Connection c -> IO [Message] Source #

receive Messages from the server

sendMessage :: forall c. Connector c => Connection c -> Message -> IO () Source #

Send the server a single Message

data ConnectorException Source #

An exception type abstracting over the exceptions that might arise in the course of communication with the buttplug server. Connector instances in general should throw these rather than Exceptions specific to the connection type.

Messages

clientMessageVersion :: Word Source #

The version of the Buttplug message protocol that the client speaks. (currently version 2)

data Message Source #

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.

Constructors

MsgOk 

Fields

MsgError 
MsgPing 

Fields

MsgRequestServerInfo 
MsgServerInfo 
MsgStartScanning 

Fields

MsgStopScanning 

Fields

MsgScanningFinished 

Fields

MsgRequestDeviceList 

Fields

MsgDeviceList 

Fields

MsgDeviceAdded 
MsgDeviceRemoved 

Fields

MsgRawWriteCmd 
MsgRawReadCmd 
MsgRawReading 
MsgRawSubscribeCmd 
MsgRawUnsubscribeCmd 
MsgStopDeviceCmd 

Fields

MsgStopAllDevices 

Fields

MsgVibrateCmd 
MsgLinearCmd 
MsgRotateCmd 
MsgBatteryLevelCmd 

Fields

MsgBatteryLevelReading 
MsgRSSILevelCmd 

Fields

MsgRSSILevelReading 

Instances

Instances details
Eq Message Source # 
Instance details

Defined in Buttplug.Core.Message

Methods

(==) :: Message -> Message -> Bool #

(/=) :: Message -> Message -> Bool #

Show Message Source # 
Instance details

Defined in Buttplug.Core.Message

Generic Message Source # 
Instance details

Defined in Buttplug.Core.Message

Associated Types

type Rep Message :: Type -> Type #

Methods

from :: Message -> Rep Message x #

to :: Rep Message x -> Message #

FromJSON Message Source # 
Instance details

Defined in Buttplug.Core.Message

Methods

parseJSON :: Value -> Parser Message

parseJSONList :: Value -> Parser [Message]

ToJSON Message Source # 
Instance details

Defined in Buttplug.Core.Message

Methods

toJSON :: Message -> Value

toEncoding :: Message -> Encoding

toJSONList :: [Message] -> Value

toEncodingList :: [Message] -> Encoding

type Rep Message Source # 
Instance details

Defined in Buttplug.Core.Message

type Rep Message = D1 ('MetaData "Message" "Buttplug.Core.Message" "buttplug-hs-core-0.1.0.0-inplace" 'False) ((((C1 ('MetaCons "MsgOk" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word)) :+: (C1 ('MetaCons "MsgError" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: (S1 ('MetaSel ('Just "msgErrorMessage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "msgErrorCode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ErrorCode))) :+: C1 ('MetaCons "MsgPing" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word)))) :+: (C1 ('MetaCons "MsgRequestServerInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: (S1 ('MetaSel ('Just "msgClientName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "msgMessageVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word))) :+: (C1 ('MetaCons "MsgServerInfo" 'PrefixI 'True) ((S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgServerName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "msgMessageVersion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgMaxPingTime") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word))) :+: C1 ('MetaCons "MsgStartScanning" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word))))) :+: ((C1 ('MetaCons "MsgStopScanning" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word)) :+: (C1 ('MetaCons "MsgScanningFinished" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word)) :+: C1 ('MetaCons "MsgRequestDeviceList" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word)))) :+: ((C1 ('MetaCons "MsgDeviceList" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgDevices") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Device])) :+: C1 ('MetaCons "MsgDeviceAdded" 'PrefixI 'True) ((S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgDeviceName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text)) :*: (S1 ('MetaSel ('Just "msgDeviceIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgDeviceMessages") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map DeviceMessageType MessageAttributes))))) :+: (C1 ('MetaCons "MsgDeviceRemoved" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgDeviceIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word)) :+: C1 ('MetaCons "MsgRawWriteCmd" 'PrefixI 'True) ((S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgDeviceIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word)) :*: (S1 ('MetaSel ('Just "msgEndpoint") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "msgData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RawData) :*: S1 ('MetaSel ('Just "msgWriteWithResponse") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))))))) :+: (((C1 ('MetaCons "MsgRawReadCmd" 'PrefixI 'True) ((S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgDeviceIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word)) :*: (S1 ('MetaSel ('Just "msgEndpoint") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "msgExpectedLength") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgWaitForData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool)))) :+: (C1 ('MetaCons "MsgRawReading" 'PrefixI 'True) ((S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgDeviceIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word)) :*: (S1 ('MetaSel ('Just "msgEndpoint") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "msgData") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 RawData))) :+: C1 ('MetaCons "MsgRawSubscribeCmd" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: (S1 ('MetaSel ('Just "msgDeviceIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgEndpoint") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))))) :+: (C1 ('MetaCons "MsgRawUnsubscribeCmd" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: (S1 ('MetaSel ('Just "msgDeviceIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgEndpoint") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))) :+: (C1 ('MetaCons "MsgStopDeviceCmd" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgDeviceIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word)) :+: C1 ('MetaCons "MsgStopAllDevices" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word))))) :+: ((C1 ('MetaCons "MsgVibrateCmd" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: (S1 ('MetaSel ('Just "msgDeviceIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgSpeeds") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Vibrate]))) :+: (C1 ('MetaCons "MsgLinearCmd" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: (S1 ('MetaSel ('Just "msgDeviceIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgVectors") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [LinearActuate]))) :+: C1 ('MetaCons "MsgRotateCmd" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: (S1 ('MetaSel ('Just "msgDeviceIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgRotations") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Rotate]))))) :+: ((C1 ('MetaCons "MsgBatteryLevelCmd" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgDeviceIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word)) :+: C1 ('MetaCons "MsgBatteryLevelReading" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: (S1 ('MetaSel ('Just "msgDeviceIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgBatteryLevel") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double)))) :+: (C1 ('MetaCons "MsgRSSILevelCmd" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgDeviceIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word)) :+: C1 ('MetaCons "MsgRSSILevelReading" 'PrefixI 'True) (S1 ('MetaSel ('Just "msgId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: (S1 ('MetaSel ('Just "msgDeviceIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "msgRSSILevel") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))))))))

data ErrorCode Source #

Errors from the server, used in the Error message.

(https://buttplug-spec.docs.buttplug.io/status.html#error)

Constructors

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

Instances details
Enum ErrorCode Source # 
Instance details

Defined in Buttplug.Core.Message

Eq ErrorCode Source # 
Instance details

Defined in Buttplug.Core.Message

Show ErrorCode Source # 
Instance details

Defined in Buttplug.Core.Message

Generic ErrorCode Source # 
Instance details

Defined in Buttplug.Core.Message

Associated Types

type Rep ErrorCode :: Type -> Type #

FromJSON ErrorCode Source # 
Instance details

Defined in Buttplug.Core.Message

Methods

parseJSON :: Value -> Parser ErrorCode

parseJSONList :: Value -> Parser [ErrorCode]

ToJSON ErrorCode Source # 
Instance details

Defined in Buttplug.Core.Message

Methods

toJSON :: ErrorCode -> Value

toEncoding :: ErrorCode -> Encoding

toJSONList :: [ErrorCode] -> Value

toEncodingList :: [ErrorCode] -> Encoding

type Rep ErrorCode Source # 
Instance details

Defined in Buttplug.Core.Message

type Rep ErrorCode = D1 ('MetaData "ErrorCode" "Buttplug.Core.Message" "buttplug-hs-core-0.1.0.0-inplace" 'False) ((C1 ('MetaCons "ERROR_UNKNOWN" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ERROR_INIT" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "ERROR_PING" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "ERROR_MSG" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ERROR_DEVICE" 'PrefixI 'False) (U1 :: Type -> Type))))

data Vibrate Source #

Used in VibrateCmd to specify the speed of the motor at the given index

Constructors

Vibrate 

Instances

Instances details
Eq Vibrate Source # 
Instance details

Defined in Buttplug.Core.Message

Methods

(==) :: Vibrate -> Vibrate -> Bool #

(/=) :: Vibrate -> Vibrate -> Bool #

Show Vibrate Source # 
Instance details

Defined in Buttplug.Core.Message

Generic Vibrate Source # 
Instance details

Defined in Buttplug.Core.Message

Associated Types

type Rep Vibrate :: Type -> Type #

Methods

from :: Vibrate -> Rep Vibrate x #

to :: Rep Vibrate x -> Vibrate #

FromJSON Vibrate Source # 
Instance details

Defined in Buttplug.Core.Message

Methods

parseJSON :: Value -> Parser Vibrate

parseJSONList :: Value -> Parser [Vibrate]

ToJSON Vibrate Source # 
Instance details

Defined in Buttplug.Core.Message

Methods

toJSON :: Vibrate -> Value

toEncoding :: Vibrate -> Encoding

toJSONList :: [Vibrate] -> Value

toEncodingList :: [Vibrate] -> Encoding

type Rep Vibrate Source # 
Instance details

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)))

data Rotate Source #

Used in RotateCmd to specify the speed and direction of rotation of the motor at the given index

Constructors

Rotate 

Instances

Instances details
Eq Rotate Source # 
Instance details

Defined in Buttplug.Core.Message

Methods

(==) :: Rotate -> Rotate -> Bool #

(/=) :: Rotate -> Rotate -> Bool #

Show Rotate Source # 
Instance details

Defined in Buttplug.Core.Message

Generic Rotate Source # 
Instance details

Defined in Buttplug.Core.Message

Associated Types

type Rep Rotate :: Type -> Type #

Methods

from :: Rotate -> Rep Rotate x #

to :: Rep Rotate x -> Rotate #

FromJSON Rotate Source # 
Instance details

Defined in Buttplug.Core.Message

Methods

parseJSON :: Value -> Parser Rotate

parseJSONList :: Value -> Parser [Rotate]

ToJSON Rotate Source # 
Instance details

Defined in Buttplug.Core.Message

Methods

toJSON :: Rotate -> Value

toEncoding :: Rotate -> Encoding

toJSONList :: [Rotate] -> Value

toEncodingList :: [Rotate] -> Encoding

type Rep Rotate Source # 
Instance details

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

Instances details
Eq LinearActuate Source # 
Instance details

Defined in Buttplug.Core.Message

Show LinearActuate Source # 
Instance details

Defined in Buttplug.Core.Message

Generic LinearActuate Source # 
Instance details

Defined in Buttplug.Core.Message

Associated Types

type Rep LinearActuate :: Type -> Type #

FromJSON LinearActuate Source # 
Instance details

Defined in Buttplug.Core.Message

Methods

parseJSON :: Value -> Parser LinearActuate

parseJSONList :: Value -> Parser [LinearActuate]

ToJSON LinearActuate Source # 
Instance details

Defined in Buttplug.Core.Message

Methods

toJSON :: LinearActuate -> Value

toEncoding :: LinearActuate -> Encoding

toJSONList :: [LinearActuate] -> Value

toEncodingList :: [LinearActuate] -> Encoding

type Rep LinearActuate Source # 
Instance details

Defined in Buttplug.Core.Message

type Rep LinearActuate = D1 ('MetaData "LinearActuate" "Buttplug.Core.Message" "buttplug-hs-core-0.1.0.0-inplace" 'False) (C1 ('MetaCons "LinearActuate" 'PrefixI 'True) (S1 ('MetaSel ('Just "linActIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: (S1 ('MetaSel ('Just "linActDuration") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "linActPosition") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Double))))

newtype RawData Source #

Used for the Raw* messages.

Constructors

RawData ByteString 

Instances

Instances details
Eq RawData Source # 
Instance details

Defined in Buttplug.Core.Message

Methods

(==) :: RawData -> RawData -> Bool #

(/=) :: RawData -> RawData -> Bool #

Show RawData Source # 
Instance details

Defined in Buttplug.Core.Message

Generic RawData Source # 
Instance details

Defined in Buttplug.Core.Message

Associated Types

type Rep RawData :: Type -> Type #

Methods

from :: RawData -> Rep RawData x #

to :: Rep RawData x -> RawData #

FromJSON RawData Source # 
Instance details

Defined in Buttplug.Core.Message

Methods

parseJSON :: Value -> Parser RawData

parseJSONList :: Value -> Parser [RawData]

ToJSON RawData Source # 
Instance details

Defined in Buttplug.Core.Message

Methods

toJSON :: RawData -> Value

toEncoding :: RawData -> Encoding

toJSONList :: [RawData] -> Value

toEncodingList :: [RawData] -> Encoding

type Rep RawData Source # 
Instance details

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)))

Devices

data MessageAttributes Source #

For a particular actuation feature (Vibration, Rotation, or Linear), represents how many of that feature the device has, and the available resolution of control of that feature. See (https://buttplug-spec.docs.buttplug.io/enumeration.html#message-attributes-for-devicelist-and-deviceadded) for details.

Instances

Instances details
Eq MessageAttributes Source # 
Instance details

Defined in Buttplug.Core.Device

Show MessageAttributes Source # 
Instance details

Defined in Buttplug.Core.Device

Generic MessageAttributes Source # 
Instance details

Defined in Buttplug.Core.Device

Associated Types

type Rep MessageAttributes :: Type -> Type #

FromJSON MessageAttributes Source # 
Instance details

Defined in Buttplug.Core.Device

Methods

parseJSON :: Value -> Parser MessageAttributes

parseJSONList :: Value -> Parser [MessageAttributes]

ToJSON MessageAttributes Source # 
Instance details

Defined in Buttplug.Core.Device

type Rep MessageAttributes Source # 
Instance details

Defined in Buttplug.Core.Device

type Rep MessageAttributes = D1 ('MetaData "MessageAttributes" "Buttplug.Core.Device" "buttplug-hs-core-0.1.0.0-inplace" 'False) (C1 ('MetaCons "MessageAttributes" 'PrefixI 'True) (S1 ('MetaSel ('Just "attrFeatureCount") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Word)) :*: S1 ('MetaSel ('Just "attrStepCount") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe [Word]))))

data Device Source #

An intimate device, containing info about the functionality it supports.

Instances

Instances details
Eq Device Source # 
Instance details

Defined in Buttplug.Core.Device

Methods

(==) :: Device -> Device -> Bool #

(/=) :: Device -> Device -> Bool #

Show Device Source # 
Instance details

Defined in Buttplug.Core.Device

Generic Device Source # 
Instance details

Defined in Buttplug.Core.Device

Associated Types

type Rep Device :: Type -> Type #

Methods

from :: Device -> Rep Device x #

to :: Rep Device x -> Device #

FromJSON Device Source # 
Instance details

Defined in Buttplug.Core.Device

Methods

parseJSON :: Value -> Parser Device

parseJSONList :: Value -> Parser [Device]

ToJSON Device Source # 
Instance details

Defined in Buttplug.Core.Device

Methods

toJSON :: Device -> Value

toEncoding :: Device -> Encoding

toJSONList :: [Device] -> Value

toEncodingList :: [Device] -> Encoding

type Rep Device Source # 
Instance details

Defined in Buttplug.Core.Device

type Rep Device = D1 ('MetaData "Device" "Buttplug.Core.Device" "buttplug-hs-core-0.1.0.0-inplace" 'False) (C1 ('MetaCons "Device" 'PrefixI 'True) (S1 ('MetaSel ('Just "deviceName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "deviceIndex") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word) :*: S1 ('MetaSel ('Just "deviceMessages") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map DeviceMessageType MessageAttributes)))))

data DeviceMessageType Source #

Represents which message types the device supports See (https://buttplug-spec.docs.buttplug.io/enumeration.html#message-attributes-for-devicelist-and-deviceadded) for details.

Instances

Instances details
Eq DeviceMessageType Source # 
Instance details

Defined in Buttplug.Core.Device

Ord DeviceMessageType Source # 
Instance details

Defined in Buttplug.Core.Device

Show DeviceMessageType Source # 
Instance details

Defined in Buttplug.Core.Device

Generic DeviceMessageType Source # 
Instance details

Defined in Buttplug.Core.Device

Associated Types

type Rep DeviceMessageType :: Type -> Type #

FromJSON DeviceMessageType Source # 
Instance details

Defined in Buttplug.Core.Device

Methods

parseJSON :: Value -> Parser DeviceMessageType

parseJSONList :: Value -> Parser [DeviceMessageType]

FromJSONKey DeviceMessageType Source # 
Instance details

Defined in Buttplug.Core.Device

Methods

fromJSONKey :: FromJSONKeyFunction DeviceMessageType

fromJSONKeyList :: FromJSONKeyFunction [DeviceMessageType]

ToJSON DeviceMessageType Source # 
Instance details

Defined in Buttplug.Core.Device

ToJSONKey DeviceMessageType Source # 
Instance details

Defined in Buttplug.Core.Device

Methods

toJSONKey :: ToJSONKeyFunction DeviceMessageType

toJSONKeyList :: ToJSONKeyFunction [DeviceMessageType]

type Rep DeviceMessageType Source # 
Instance details

Defined in Buttplug.Core.Device

type Rep DeviceMessageType = D1 ('MetaData "DeviceMessageType" "Buttplug.Core.Device" "buttplug-hs-core-0.1.0.0-inplace" 'False) (((C1 ('MetaCons "DevRawWriteCmd" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DevRawReadCmd" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "DevRawSubscribeCmd" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DevRawUnsubscribeCmd" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "DevStopDeviceCmd" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DevVibrateCmd" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "DevLinearCmd" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DevRotateCmd" 'PrefixI 'False) (U1 :: Type -> Type))))