Documentation
¶
Overview ¶
Package control handles incoming requests and actions.
The Controller type wraps a LaunchManager and implements HTTP handlers for it.
Index ¶
- Variables
- func LoadScript(r io.Reader, contentType string, p Personalization) (protocol.Player, error)
- type Controller
- func (c *Controller) DumpHandler(w http.ResponseWriter, r *http.Request)
- func (c *Controller) PauseHandler(w http.ResponseWriter, r *http.Request)
- func (c *Controller) PlayHandler(w http.ResponseWriter, r *http.Request)
- func (c *Controller) ResumeHandler(w http.ResponseWriter, r *http.Request)
- func (c *Controller) SkipHandler(w http.ResponseWriter, r *http.Request)
- func (c *Controller) StopHandler(w http.ResponseWriter, r *http.Request)
- func (c *Controller) WebsocketHandler(w http.ResponseWriter, r *http.Request)
- type Loader
- type Personalization
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupported = errors.New("unsupported script")
ErrUnsupported is returned when the script can't be loaded by any scriptplayer.
var Loaders = []Loader{ { Loader: &funscript.Loader{}, ContentTypes: []string{ "application/prs.funscript+json", "application/json", }, }, { Loader: protocol.LoaderFunc(raw.Load), ContentTypes: []string{ "application/prs.launchcontrol+json", "application/json", }, }, { Loader: protocol.LoaderFunc(kiiroo.Load), ContentTypes: []string{ "text/prs.kiiroo", "x-text/kiiroo", "text/plain", }, }, { Loader: protocol.LoaderFunc(kiiroo.LoadText), ContentTypes: []string{ "text/plain", }, }, { Loader: protocol.LoaderFunc(kiiroo.LoadJSON), ContentTypes: []string{ "application/prs.kiiroo+json", "application/json", }, }, }
Loaders contains all the registered ScriptLoaders.
Functions ¶
func LoadScript ¶
LoadScript tries to load specified script with all ScriptPlayers and returns the first one that's succesfull. Loaders that are tried can be filtered by specifying the content type.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller translates http requests into manager actions.
func NewController ¶
func NewController(m *device.LaunchManager) *Controller
NewController returns a new controller for the given manager.
func (*Controller) DumpHandler ¶
func (c *Controller) DumpHandler(w http.ResponseWriter, r *http.Request)
DumpHandler is a http.Handler to dump the current script.
func (*Controller) PauseHandler ¶
func (c *Controller) PauseHandler(w http.ResponseWriter, r *http.Request)
PauseHandler is a http.Handler to pause playback.
func (*Controller) PlayHandler ¶
func (c *Controller) PlayHandler(w http.ResponseWriter, r *http.Request)
PlayHandler is a http.Handler to load and play scripts.
func (*Controller) ResumeHandler ¶
func (c *Controller) ResumeHandler(w http.ResponseWriter, r *http.Request)
ResumeHandler is a http.Handler to resume playback.
func (*Controller) SkipHandler ¶
func (c *Controller) SkipHandler(w http.ResponseWriter, r *http.Request)
SkipHandler is a http.Handler to jump to a given timecode.
func (*Controller) StopHandler ¶
func (c *Controller) StopHandler(w http.ResponseWriter, r *http.Request)
StopHandler is a http.Handler to stop playback.
func (*Controller) WebsocketHandler ¶
func (c *Controller) WebsocketHandler(w http.ResponseWriter, r *http.Request)
WebsocketHandler implements http.Handler that reponds with a websocket writing status messages in JSON.
type Loader ¶
Loader wraps a scriptloader with it's supported mediatypes.
func (Loader) IsSupported ¶
IsSupported checks if the loader can handle specified content type.
type Personalization ¶
type Personalization struct { Latency time.Duration PositionMin int // Lowest position PositionMax int // Highest position SpeedMin int // Slowest speed to move at SpeedMax int // Fastest speed to move at }
Personalization are settings customizing a scripts behaviour
func NewPersonalization ¶
func NewPersonalization() Personalization
NewPersonalization return a Personalization with the default values.