Documentation
¶
Overview ¶
Package schema contains the Buttplug message schema for version 0.
Index ¶
- func IsInternalMessage(m Message) bool
- type ClientID
- type ClientMessage
- type Device
- type DeviceAddedMessage
- type DeviceIndex
- type DeviceListMessage
- type DeviceMessages
- type DeviceName
- type DeviceRemovedMessage
- type ErrorMessage
- type FleshlightLaunchFW12CmdMessage
- type InternalMessage
- type KiirooCmdMessage
- type LogLevel
- type LogMessage
- type Message
- type MessageType
- type OKMessage
- type Payload
- type PingMessage
- type RequestDeviceListMessage
- type RequestLogLevel
- type RequestLogMessage
- type RequestServerInfoMessage
- type ServerID
- type ServerInfoMessage
- type ServerMessage
- type SingleMotorVibrateCmdMessage
- type StartScanningMessage
- type StopAllDevicesMessage
- type StopDeviceCmdMessage
- type StopScanningMessage
- type SystemID
- type TestMessage
- type VorzeA10CycloneCmdMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsInternalMessage ¶
IsInternalMessage returns whether the message is an internal-only message.
Types ¶
type ClientID ¶
type ClientID int
ClientID: user-set id for the message. 0 denotes system message and is reserved.
type ClientMessage ¶
type ClientMessage interface {
Message
// ClientID returns the ID field of the message.
ClientID() ClientID
// WithID sets the ID field of the shallow-copied message and returns the modified message.
WithID(id ClientID) ClientMessage
// contains filtered or unexported methods
}
ClientMessage represents a message that can be sent from the client to the server. It extends Message with a way to set the client ID to be used when sending the message.
The following messages are defined:
- DeviceListMessage
- FleshlightLaunchFW12CmdMessage
- KiirooCmdMessage
- OKMessage
- PingMessage
- RequestDeviceListMessage
- RequestLogMessage
- RequestServerInfoMessage
- ServerInfoMessage
- SingleMotorVibrateCmdMessage
- StartScanningMessage
- StopAllDevicesMessage
- StopDeviceCmdMessage
- StopScanningMessage
- TestMessage
- VorzeA10CycloneCmdMessage
type Device ¶ added in v0.0.6
type Device struct {
// DeviceName: name of the device.
DeviceName DeviceName `json:"DeviceName"`
// DeviceIndex: index used for referencing the device in device messages.
DeviceIndex DeviceIndex `json:"DeviceIndex"`
// DeviceMessages: a list of the messages a device will accept on this
// server implementation.
DeviceMessages DeviceMessages `json:"DeviceMessages"`
}
type DeviceAddedMessage ¶
type DeviceAddedMessage struct {
// ID: used for non-direct-reply messages that can only be sent from server
// to client, using the reserved system message Id of 0.
ID SystemID `json:"Id"`
// DeviceName: name of the device.
DeviceName DeviceName `json:"DeviceName"`
// DeviceIndex: index used for referencing the device in device messages.
DeviceIndex DeviceIndex `json:"DeviceIndex"`
// DeviceMessages: a list of the messages a device will accept on this
// server implementation.
DeviceMessages DeviceMessages `json:"DeviceMessages"`
}
DeviceAddedMessage: notifies client that a device of a certain type has been added to the server.
func (*DeviceAddedMessage) LogValue ¶
func (d *DeviceAddedMessage) LogValue() slog.Value
LogValue implements slog.LogValuer.
func (*DeviceAddedMessage) Type ¶
func (d *DeviceAddedMessage) Type() MessageType
Type returns MessageTypeDeviceAdded.
type DeviceIndex ¶
type DeviceIndex int
DeviceIndex: index used for referencing the device in device messages.
type DeviceListMessage ¶
type DeviceListMessage struct {
// ID: user-set id for the message. 0 denotes system message and is
// reserved.
ID ClientID `json:"Id"`
// Devices: array of device ids and names.
Devices []Device `json:"Devices"`
}
DeviceListMessage: list of all available devices known to the system.
func (*DeviceListMessage) ClientID ¶
func (d *DeviceListMessage) ClientID() ClientID
ClientID implements ClientMessage
func (*DeviceListMessage) LogValue ¶
func (d *DeviceListMessage) LogValue() slog.Value
LogValue implements slog.LogValuer.
func (*DeviceListMessage) Type ¶
func (d *DeviceListMessage) Type() MessageType
Type returns MessageTypeDeviceList.
func (*DeviceListMessage) WithID ¶
func (d *DeviceListMessage) WithID(id ClientID) ClientMessage
WithID implements ClientMessage.
type DeviceMessages ¶
type DeviceMessages []string
DeviceMessages: a list of the messages a device will accept on this server implementation.
type DeviceRemovedMessage ¶
type DeviceRemovedMessage struct {
// ID: used for non-direct-reply messages that can only be sent from server
// to client, using the reserved system message Id of 0.
ID SystemID `json:"Id"`
// DeviceIndex: index used for referencing the device in device messages.
DeviceIndex DeviceIndex `json:"DeviceIndex"`
}
DeviceRemovedMessage: notifies client that a device of a certain type has been removed from the server.
func (*DeviceRemovedMessage) LogValue ¶
func (d *DeviceRemovedMessage) LogValue() slog.Value
LogValue implements slog.LogValuer.
func (*DeviceRemovedMessage) Type ¶
func (d *DeviceRemovedMessage) Type() MessageType
Type returns MessageTypeDeviceRemoved.
type ErrorMessage ¶
type ErrorMessage struct {
// ID: user-set id for the message. 0 denotes system message and is
// reserved.
ID ServerID `json:"Id"`
ErrorMessage string `json:"ErrorMessage"`
ErrorCode float64 `json:"ErrorCode"`
}
ErrorMessage: signifies the server encountered an error while processing the message indicated by the id.
func (*ErrorMessage) LogValue ¶
func (e *ErrorMessage) LogValue() slog.Value
LogValue implements slog.LogValuer.
func (*ErrorMessage) ServerID ¶
func (e *ErrorMessage) ServerID() ServerID
ServerID implements ServerMessage
func (*ErrorMessage) Type ¶
func (e *ErrorMessage) Type() MessageType
Type returns MessageTypeError.
type FleshlightLaunchFW12CmdMessage ¶
type FleshlightLaunchFW12CmdMessage struct {
// ID: user-set id for the message. 0 denotes system message and is
// reserved.
ID ClientID `json:"Id"`
// DeviceIndex: index used for referencing the device in device messages.
DeviceIndex DeviceIndex `json:"DeviceIndex"`
// Speed at which to move to designated position.
Speed int `json:"Speed"`
// Position to which to move Fleshlight.
Position int `json:"Position"`
}
FleshlightLaunchFW12CmdMessage: sends speed and position command to the Fleshlight Launch Device denoted by the device index.
func (*FleshlightLaunchFW12CmdMessage) ClientID ¶
func (f *FleshlightLaunchFW12CmdMessage) ClientID() ClientID
ClientID implements ClientMessage
func (*FleshlightLaunchFW12CmdMessage) LogValue ¶
func (f *FleshlightLaunchFW12CmdMessage) LogValue() slog.Value
LogValue implements slog.LogValuer.
func (*FleshlightLaunchFW12CmdMessage) Type ¶
func (f *FleshlightLaunchFW12CmdMessage) Type() MessageType
Type returns MessageTypeFleshlightLaunchFW12Cmd.
func (*FleshlightLaunchFW12CmdMessage) WithID ¶
func (f *FleshlightLaunchFW12CmdMessage) WithID(id ClientID) ClientMessage
WithID implements ClientMessage.
type InternalMessage ¶
type InternalMessage struct{}
InternalMessage is a special type that the library uses for internal-only messages. Messages of this type were never emitted from the server.
func (InternalMessage) MarshalJSON ¶
func (m InternalMessage) MarshalJSON() ([]byte, error)
MarshalJSON returns an error because internal messages cannot be marshaled.
func (InternalMessage) Type ¶
func (m InternalMessage) Type() MessageType
Type returns an empty string for internal messages.
type KiirooCmdMessage ¶
type KiirooCmdMessage struct {
// ID: user-set id for the message. 0 denotes system message and is
// reserved.
ID ClientID `json:"Id"`
// DeviceIndex: index used for referencing the device in device messages.
DeviceIndex DeviceIndex `json:"DeviceIndex"`
// Command to send to Kiiroo device.
Command string `json:"Command"`
}
KiirooCmdMessage: sends a raw byte string to a Kiiroo Onyx/Pearl device.
func (*KiirooCmdMessage) ClientID ¶
func (k *KiirooCmdMessage) ClientID() ClientID
ClientID implements ClientMessage
func (*KiirooCmdMessage) LogValue ¶
func (k *KiirooCmdMessage) LogValue() slog.Value
LogValue implements slog.LogValuer.
func (*KiirooCmdMessage) Type ¶
func (k *KiirooCmdMessage) Type() MessageType
Type returns MessageTypeKiirooCmd.
func (*KiirooCmdMessage) WithID ¶
func (k *KiirooCmdMessage) WithID(id ClientID) ClientMessage
WithID implements ClientMessage.
type LogMessage ¶
type LogMessage struct {
// ID: used for non-direct-reply messages that can only be sent from server
// to client, using the reserved system message Id of 0.
ID SystemID `json:"Id"`
// LogLevel: log level of message.
LogLevel LogLevel `json:"LogLevel"`
// LogMessage: log message from server.
LogMessage string `json:"LogMessage"`
}
LogMessage: log message from the server.
func (*LogMessage) LogValue ¶
func (l *LogMessage) LogValue() slog.Value
LogValue implements slog.LogValuer.
type Message ¶
type Message interface {
// Type returns the message type of the message.
Type() MessageType
// contains filtered or unexported methods
}
Message represents a single message in the buttplug.io protocol.
The following messages are defined:
- DeviceAddedMessage
- DeviceListMessage
- DeviceRemovedMessage
- ErrorMessage
- FleshlightLaunchFW12CmdMessage
- KiirooCmdMessage
- LogMessage
- OKMessage
- PingMessage
- RequestDeviceListMessage
- RequestLogMessage
- RequestServerInfoMessage
- ServerInfoMessage
- SingleMotorVibrateCmdMessage
- StartScanningMessage
- StopAllDevicesMessage
- StopDeviceCmdMessage
- StopScanningMessage
- TestMessage
- VorzeA10CycloneCmdMessage
type MessageType ¶
type MessageType string
MessageType is the type string used to identify a buttplug.io message from the wire.
const ( // MessageTypeDeviceAdded is the type string for a [DeviceAddedMessage]. MessageTypeDeviceAdded MessageType = "DeviceAdded" // MessageTypeDeviceList is the type string for a [DeviceListMessage]. MessageTypeDeviceList MessageType = "DeviceList" // MessageTypeDeviceRemoved is the type string for a [DeviceRemovedMessage]. MessageTypeDeviceRemoved MessageType = "DeviceRemoved" // MessageTypeError is the type string for a [ErrorMessage]. MessageTypeError MessageType = "Error" // MessageTypeFleshlightLaunchFW12Cmd is the type string for a [FleshlightLaunchFW12CmdMessage]. MessageTypeFleshlightLaunchFW12Cmd MessageType = "FleshlightLaunchFW12Cmd" // MessageTypeKiirooCmd is the type string for a [KiirooCmdMessage]. MessageTypeKiirooCmd MessageType = "KiirooCmd" // MessageTypeLog is the type string for a [LogMessage]. MessageTypeLog MessageType = "Log" // MessageTypeOK is the type string for a [OKMessage]. MessageTypeOK MessageType = "Ok" // MessageTypePing is the type string for a [PingMessage]. MessageTypePing MessageType = "Ping" // MessageTypeRequestDeviceList is the type string for a [RequestDeviceListMessage]. MessageTypeRequestDeviceList MessageType = "RequestDeviceList" // MessageTypeRequestLog is the type string for a [RequestLogMessage]. MessageTypeRequestLog MessageType = "RequestLog" // MessageTypeRequestServerInfo is the type string for a [RequestServerInfoMessage]. MessageTypeRequestServerInfo MessageType = "RequestServerInfo" // MessageTypeServerInfo is the type string for a [ServerInfoMessage]. MessageTypeServerInfo MessageType = "ServerInfo" // MessageTypeSingleMotorVibrateCmd is the type string for a [SingleMotorVibrateCmdMessage]. MessageTypeSingleMotorVibrateCmd MessageType = "SingleMotorVibrateCmd" // MessageTypeStartScanning is the type string for a [StartScanningMessage]. MessageTypeStartScanning MessageType = "StartScanning" // MessageTypeStopAllDevices is the type string for a [StopAllDevicesMessage]. MessageTypeStopAllDevices MessageType = "StopAllDevices" // MessageTypeStopDeviceCmd is the type string for a [StopDeviceCmdMessage]. MessageTypeStopDeviceCmd MessageType = "StopDeviceCmd" // MessageTypeStopScanning is the type string for a [StopScanningMessage]. MessageTypeStopScanning MessageType = "StopScanning" // MessageTypeTest is the type string for a [TestMessage]. MessageTypeTest MessageType = "Test" // MessageTypeVorzeA10CycloneCmd is the type string for a [VorzeA10CycloneCmdMessage]. MessageTypeVorzeA10CycloneCmd MessageType = "VorzeA10CycloneCmd" )
All defined message types.
type OKMessage ¶
type OKMessage struct {
// ID: user-set id for the message. 0 denotes system message and is
// reserved.
ID ClientID `json:"Id"`
}
OKMessage: signifies successful processing of the message indicated by the id.
func (*OKMessage) ClientID ¶
ClientID implements ClientMessage
func (*OKMessage) LogValue ¶
LogValue implements slog.LogValuer.
func (*OKMessage) WithID ¶
func (o *OKMessage) WithID(id ClientID) ClientMessage
WithID implements ClientMessage.
type Payload ¶
type Payload []Message
Payload is a list of messages sent from the buttplug.io websocket server. Use this type to parse each message in the payload.
func (Payload) LogValue ¶
LogValue implements slog.LogValuer.
func (Payload) MarshalJSONTo ¶
MarshalJSONTo writes the payload as the JSON websocket wire protocol.
func (*Payload) UnmarshalJSONFrom ¶
UnmarshalJSONFrom implements json.UnmarshalerFrom. It consumes one full array of messages from the given JSON decoder.
type PingMessage ¶
type PingMessage struct {
// ID: user-set id for the message. 0 denotes system message and is
// reserved.
ID ClientID `json:"Id"`
}
PingMessage: connection keep-alive message.
func (*PingMessage) ClientID ¶
func (p *PingMessage) ClientID() ClientID
ClientID implements ClientMessage
func (*PingMessage) LogValue ¶
func (p *PingMessage) LogValue() slog.Value
LogValue implements slog.LogValuer.
func (*PingMessage) WithID ¶
func (p *PingMessage) WithID(id ClientID) ClientMessage
WithID implements ClientMessage.
type RequestDeviceListMessage ¶
type RequestDeviceListMessage struct {
// ID: user-set id for the message. 0 denotes system message and is
// reserved.
ID ClientID `json:"Id"`
}
RequestDeviceListMessage: request for the server to send a list of devices to the client.
func (*RequestDeviceListMessage) ClientID ¶
func (r *RequestDeviceListMessage) ClientID() ClientID
ClientID implements ClientMessage
func (*RequestDeviceListMessage) LogValue ¶
func (r *RequestDeviceListMessage) LogValue() slog.Value
LogValue implements slog.LogValuer.
func (*RequestDeviceListMessage) Type ¶
func (r *RequestDeviceListMessage) Type() MessageType
Type returns MessageTypeRequestDeviceList.
func (*RequestDeviceListMessage) WithID ¶
func (r *RequestDeviceListMessage) WithID(id ClientID) ClientMessage
WithID implements ClientMessage.
type RequestLogLevel ¶
type RequestLogLevel string
LogLevel: maximum level of log message to receive.
const ( RequestLogLevelOff RequestLogLevel = "Off" RequestLogLevelFatal RequestLogLevel = "Fatal" RequestLogLevelError RequestLogLevel = "Error" RequestLogLevelWarn RequestLogLevel = "Warn" RequestLogLevelInfo RequestLogLevel = "Info" RequestLogLevelDebug RequestLogLevel = "Debug" RequestLogLevelTrace RequestLogLevel = "Trace" )
Enumeration values for RequestLogLevel of [RequestLog].
type RequestLogMessage ¶
type RequestLogMessage struct {
// ID: user-set id for the message. 0 denotes system message and is
// reserved.
ID ClientID `json:"Id"`
// LogLevel: maximum level of log message to receive.
LogLevel RequestLogLevel `json:"LogLevel"`
}
RequestLogMessage: request for server to stream log messages of a certain level to client.
func (*RequestLogMessage) ClientID ¶
func (r *RequestLogMessage) ClientID() ClientID
ClientID implements ClientMessage
func (*RequestLogMessage) LogValue ¶
func (r *RequestLogMessage) LogValue() slog.Value
LogValue implements slog.LogValuer.
func (*RequestLogMessage) Type ¶
func (r *RequestLogMessage) Type() MessageType
Type returns MessageTypeRequestLog.
func (*RequestLogMessage) WithID ¶
func (r *RequestLogMessage) WithID(id ClientID) ClientMessage
WithID implements ClientMessage.
type RequestServerInfoMessage ¶
type RequestServerInfoMessage struct {
// ID: user-set id for the message. 0 denotes system message and is
// reserved.
ID ClientID `json:"Id"`
// ClientName: name of the client software.
ClientName string `json:"ClientName"`
}
RequestServerInfoMessage: request server version, and relay client name.
func (*RequestServerInfoMessage) ClientID ¶
func (r *RequestServerInfoMessage) ClientID() ClientID
ClientID implements ClientMessage
func (*RequestServerInfoMessage) LogValue ¶
func (r *RequestServerInfoMessage) LogValue() slog.Value
LogValue implements slog.LogValuer.
func (*RequestServerInfoMessage) Type ¶
func (r *RequestServerInfoMessage) Type() MessageType
Type returns MessageTypeRequestServerInfo.
func (*RequestServerInfoMessage) WithID ¶
func (r *RequestServerInfoMessage) WithID(id ClientID) ClientMessage
WithID implements ClientMessage.
type ServerID ¶
type ServerID int
ServerID: user-set id for the message. 0 denotes system message and is reserved.
type ServerInfoMessage ¶
type ServerInfoMessage struct {
// ID: user-set id for the message. 0 denotes system message and is
// reserved.
ID ClientID `json:"Id"`
// MessageVersion: message template version of the server software.
MessageVersion int `json:"MessageVersion"`
// MaxPingTime: maximum time (in milliseconds) the server will wait between
// ping messages from client before shutting down.
MaxPingTime int `json:"MaxPingTime"`
// MajorVersion: major version of server.
MajorVersion int `json:"MajorVersion"`
// MinorVersion: minor version of server.
MinorVersion int `json:"MinorVersion"`
// BuildVersion: build version of server.
BuildVersion int `json:"BuildVersion"`
// ServerName: name of the server. Can be 0-length.
ServerName string `json:"ServerName"`
}
ServerInfoMessage: server version information, in Major.Minor.Build format.
func (*ServerInfoMessage) ClientID ¶
func (s *ServerInfoMessage) ClientID() ClientID
ClientID implements ClientMessage
func (*ServerInfoMessage) LogValue ¶
func (s *ServerInfoMessage) LogValue() slog.Value
LogValue implements slog.LogValuer.
func (*ServerInfoMessage) Type ¶
func (s *ServerInfoMessage) Type() MessageType
Type returns MessageTypeServerInfo.
func (*ServerInfoMessage) WithID ¶
func (s *ServerInfoMessage) WithID(id ClientID) ClientMessage
WithID implements ClientMessage.
type ServerMessage ¶
type ServerMessage interface {
Message
// ServerID returns the ID field of the message.
ServerID() ServerID
// contains filtered or unexported methods
}
ServerMessage represents a message that can be sent from the server to the client. It extends Message.
The following messages are defined:
type SingleMotorVibrateCmdMessage ¶
type SingleMotorVibrateCmdMessage struct {
// ID: user-set id for the message. 0 denotes system message and is
// reserved.
ID ClientID `json:"Id"`
// DeviceIndex: index used for referencing the device in device messages.
DeviceIndex DeviceIndex `json:"DeviceIndex"`
// Speed: device vibration speed (floating point, 0 < x < 1), stepping will
// be device specific.
Speed float64 `json:"Speed"`
}
SingleMotorVibrateCmdMessage: sends a vibrate command to a device that supports vibration.
func (*SingleMotorVibrateCmdMessage) ClientID ¶
func (s *SingleMotorVibrateCmdMessage) ClientID() ClientID
ClientID implements ClientMessage
func (*SingleMotorVibrateCmdMessage) LogValue ¶
func (s *SingleMotorVibrateCmdMessage) LogValue() slog.Value
LogValue implements slog.LogValuer.
func (*SingleMotorVibrateCmdMessage) Type ¶
func (s *SingleMotorVibrateCmdMessage) Type() MessageType
Type returns MessageTypeSingleMotorVibrateCmd.
func (*SingleMotorVibrateCmdMessage) WithID ¶
func (s *SingleMotorVibrateCmdMessage) WithID(id ClientID) ClientMessage
WithID implements ClientMessage.
type StartScanningMessage ¶
type StartScanningMessage struct {
// ID: user-set id for the message. 0 denotes system message and is
// reserved.
ID ClientID `json:"Id"`
}
StartScanningMessage: request for the server to start scanning for new devices.
func (*StartScanningMessage) ClientID ¶
func (s *StartScanningMessage) ClientID() ClientID
ClientID implements ClientMessage
func (*StartScanningMessage) LogValue ¶
func (s *StartScanningMessage) LogValue() slog.Value
LogValue implements slog.LogValuer.
func (*StartScanningMessage) Type ¶
func (s *StartScanningMessage) Type() MessageType
Type returns MessageTypeStartScanning.
func (*StartScanningMessage) WithID ¶
func (s *StartScanningMessage) WithID(id ClientID) ClientMessage
WithID implements ClientMessage.
type StopAllDevicesMessage ¶
type StopAllDevicesMessage struct {
// ID: user-set id for the message. 0 denotes system message and is
// reserved.
ID ClientID `json:"Id"`
}
StopAllDevicesMessage: stops all actions currently being taken by all connected devices.
func (*StopAllDevicesMessage) ClientID ¶
func (s *StopAllDevicesMessage) ClientID() ClientID
ClientID implements ClientMessage
func (*StopAllDevicesMessage) LogValue ¶
func (s *StopAllDevicesMessage) LogValue() slog.Value
LogValue implements slog.LogValuer.
func (*StopAllDevicesMessage) Type ¶
func (s *StopAllDevicesMessage) Type() MessageType
Type returns MessageTypeStopAllDevices.
func (*StopAllDevicesMessage) WithID ¶
func (s *StopAllDevicesMessage) WithID(id ClientID) ClientMessage
WithID implements ClientMessage.
type StopDeviceCmdMessage ¶
type StopDeviceCmdMessage struct {
// ID: user-set id for the message. 0 denotes system message and is
// reserved.
ID ClientID `json:"Id"`
// DeviceIndex: index used for referencing the device in device messages.
DeviceIndex DeviceIndex `json:"DeviceIndex"`
}
StopDeviceCmdMessage: stops the all actions currently being taken by a device.
func (*StopDeviceCmdMessage) ClientID ¶
func (s *StopDeviceCmdMessage) ClientID() ClientID
ClientID implements ClientMessage
func (*StopDeviceCmdMessage) LogValue ¶
func (s *StopDeviceCmdMessage) LogValue() slog.Value
LogValue implements slog.LogValuer.
func (*StopDeviceCmdMessage) Type ¶
func (s *StopDeviceCmdMessage) Type() MessageType
Type returns MessageTypeStopDeviceCmd.
func (*StopDeviceCmdMessage) WithID ¶
func (s *StopDeviceCmdMessage) WithID(id ClientID) ClientMessage
WithID implements ClientMessage.
type StopScanningMessage ¶
type StopScanningMessage struct {
// ID: user-set id for the message. 0 denotes system message and is
// reserved.
ID ClientID `json:"Id"`
}
StopScanningMessage: request for the server to stop scanning for new devices.
func (*StopScanningMessage) ClientID ¶
func (s *StopScanningMessage) ClientID() ClientID
ClientID implements ClientMessage
func (*StopScanningMessage) LogValue ¶
func (s *StopScanningMessage) LogValue() slog.Value
LogValue implements slog.LogValuer.
func (*StopScanningMessage) Type ¶
func (s *StopScanningMessage) Type() MessageType
Type returns MessageTypeStopScanning.
func (*StopScanningMessage) WithID ¶
func (s *StopScanningMessage) WithID(id ClientID) ClientMessage
WithID implements ClientMessage.
type SystemID ¶
type SystemID int
SystemID: used for non-direct-reply messages that can only be sent from server to client, using the reserved system message Id of 0.
type TestMessage ¶
type TestMessage struct {
// ID: user-set id for the message. 0 denotes system message and is
// reserved.
ID ClientID `json:"Id"`
// TestString: string to be echo'd back from server. Setting this to 'Error'
// will cause an error to be thrown.
TestString string `json:"TestString"`
}
TestMessage: used for connection/application testing. Causes server to echo back the string sent. Sending string of 'Error' will result in a server error. .
func (*TestMessage) ClientID ¶
func (t *TestMessage) ClientID() ClientID
ClientID implements ClientMessage
func (*TestMessage) LogValue ¶
func (t *TestMessage) LogValue() slog.Value
LogValue implements slog.LogValuer.
func (*TestMessage) WithID ¶
func (t *TestMessage) WithID(id ClientID) ClientMessage
WithID implements ClientMessage.
type VorzeA10CycloneCmdMessage ¶
type VorzeA10CycloneCmdMessage struct {
// ID: user-set id for the message. 0 denotes system message and is
// reserved.
ID ClientID `json:"Id"`
// DeviceIndex: index used for referencing the device in device messages.
DeviceIndex DeviceIndex `json:"DeviceIndex"`
// Speed: rotation speed command for the Cyclone.
Speed int `json:"Speed"`
// Clockwise: true for clockwise rotation (in relation to device facing
// user), false for Counter-clockwise.
Clockwise bool `json:"Clockwise"`
}
VorzeA10CycloneCmdMessage: sends a raw byte string to a Kiiroo Onyx/Pearl device.
func (*VorzeA10CycloneCmdMessage) ClientID ¶
func (v *VorzeA10CycloneCmdMessage) ClientID() ClientID
ClientID implements ClientMessage
func (*VorzeA10CycloneCmdMessage) LogValue ¶
func (v *VorzeA10CycloneCmdMessage) LogValue() slog.Value
LogValue implements slog.LogValuer.
func (*VorzeA10CycloneCmdMessage) Type ¶
func (v *VorzeA10CycloneCmdMessage) Type() MessageType
Type returns MessageTypeVorzeA10CycloneCmd.
func (*VorzeA10CycloneCmdMessage) WithID ¶
func (v *VorzeA10CycloneCmdMessage) WithID(id ClientID) ClientMessage
WithID implements ClientMessage.