 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package protocol provides ways to playback movement.
Index ¶
- Variables
- type Action
- type Dumpable
- type LatencyCalibrator
- type Loader
- type LoaderFunc
- type Mover
- type Pausable
- type Player
- type PositionLimiter
- type Skippable
- type SpeedLimiter
- type TimedAction
- type TimedActions
- type TimedActionsPlayer
- func (ta *TimedActionsPlayer) Dump() (TimedActions, error)
- func (ta *TimedActionsPlayer) Latency(t time.Duration)
- func (ta *TimedActionsPlayer) LimitPosition(low, high int)
- func (ta *TimedActionsPlayer) LimitSpeed(slow, fast int)
- func (ta *TimedActionsPlayer) Pause() error
- func (ta *TimedActionsPlayer) Play() <-chan Action
- func (ta *TimedActionsPlayer) Resume() error
- func (ta *TimedActionsPlayer) Skip(p time.Duration) error
- func (ta *TimedActionsPlayer) Stop() error
 
Constants ¶
This section is empty.
Variables ¶
var ErrTimeout = errors.New("operation timed out")
    ErrTimeout is the error returned when a requested operation could not be performed in time.
Functions ¶
This section is empty.
Types ¶
type Dumpable ¶ added in v0.0.4
type Dumpable interface {
	// Dump the full script as TimedActions.
	Dump() (TimedActions, error)
}
    Dumpable is a interface thtat wraps the dump method.
type LatencyCalibrator ¶
LatencyCalibrator wraps the Latency method.
type Loader ¶
type Loader interface {
	// Load a script from the provided reader.
	Load(r io.Reader) (p Player, err error)
}
    Loader is the interface that wraps the Load method.
type LoaderFunc ¶
LoaderFunc type is an adapter to allow the use of ordinary functions as script loader.
type Mover ¶
type Mover interface {
	Move(position, speed int)
}
    Mover interface provides a device that can move to a position in percent with a specific speed.
type Pausable ¶
type Pausable interface {
	// Pause playback.
	Pause() error
	// Resume playback from the current position.
	Resume() error
}
    Pausable is a interface that defines the pause and resume actions.
type Player ¶
type Player interface {
	// Start playback of the loaded script the reader channel should be
	// attached to a device.
	Play() <-chan Action
	// Stop stops playback and resets the player.
	Stop() error
}
    Player is an interface that has the basic functions to play a script.
type PositionLimiter ¶
type PositionLimiter interface {
	LimitPosition(lowest, highest int)
}
    PositionLimiter wraps the limitposition method.
type Skippable ¶
type Skippable interface {
	// Skip (jump) to the specified position/timecode.
	Skip(position time.Duration) error
}
    Skippable is a interface that wraps the skip method.
type SpeedLimiter ¶
type SpeedLimiter interface {
	LimitSpeed(slowest, fastest int)
}
    SpeedLimiter wraps the limitposition method.
type TimedAction ¶
TimedAction wraps Action together with a timestamp.
func (TimedAction) MarshalJSON ¶ added in v0.0.4
func (ta TimedAction) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (*TimedAction) UnmarshalJSON ¶ added in v0.0.4
func (ta *TimedAction) UnmarshalJSON(in []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type TimedActions ¶ added in v0.0.4
type TimedActions []TimedAction
TimedActions is an ordered list of TimeAction items.
type TimedActionsPlayer ¶
type TimedActionsPlayer struct {
	// Script that the player will use.
	Script []TimedAction
	// contains filtered or unexported fields
}
    TimedActionsPlayer can playback an array of TimeActions. It can be used by protocols that can pre-calculate TimeActions.
All of the SkippableScriptPlayer methods are implemented except for ScriptLoader. Protocols only need to implement ScriptLoader themselves and set the Script field with their result.
func NewTimedActionsPlayer ¶
func NewTimedActionsPlayer() *TimedActionsPlayer
NewTimedActionsPlayer returns a new TimedActionsPlayer.
func (*TimedActionsPlayer) Dump ¶ added in v0.0.4
func (ta *TimedActionsPlayer) Dump() (TimedActions, error)
Dump will return the loaded script as TimedActions.
func (*TimedActionsPlayer) Latency ¶
func (ta *TimedActionsPlayer) Latency(t time.Duration)
Latency implements the LatencyCalibrator interface to calibrate the latency.
func (*TimedActionsPlayer) LimitPosition ¶
func (ta *TimedActionsPlayer) LimitPosition(low, high int)
LimitPosition implements the PositionLimiter interface. low is the lowest position in percent to move to. high is the highst position in percent to move to.
func (*TimedActionsPlayer) LimitSpeed ¶
func (ta *TimedActionsPlayer) LimitSpeed(slow, fast int)
LimitSpeed implements the SpeedLimiter interface. slow is the slowest speed in percent to move with. fast is the highst speed in percent to move with.
func (*TimedActionsPlayer) Pause ¶
func (ta *TimedActionsPlayer) Pause() error
Pause will halt playback at the current position.
func (*TimedActionsPlayer) Play ¶
func (ta *TimedActionsPlayer) Play() <-chan Action
Play will start executing the loaded script from the start.
func (*TimedActionsPlayer) Resume ¶
func (ta *TimedActionsPlayer) Resume() error
Resume will continue playback from the paused location.
func (*TimedActionsPlayer) Skip ¶
func (ta *TimedActionsPlayer) Skip(p time.Duration) error
Skip will jump to a specific position.
func (*TimedActionsPlayer) Stop ¶
func (ta *TimedActionsPlayer) Stop() error
Stop stops playback and resets player.
       Directories
      ¶
      Directories
      ¶
    
    | Path | Synopsis | 
|---|---|
| Package funscript manages the Funscript format. | Package funscript manages the Funscript format. | 
| Package kiiroo manages the Kiiroo haptics protocol. | Package kiiroo manages the Kiiroo haptics protocol. | 
| Package raw manages the raw launch protocol. | Package raw manages the raw launch protocol. |