dock

package
v0.0.0-...-ffe7524 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDigitPattern

func GetDigitPattern(n int, dpoint bool) int

Types

type Dock

type Dock struct {
	Events chan Event
	sync.RWMutex
	// contains filtered or unexported fields
}

func ConnectDock

func ConnectDock(port io.ReadWriter) *Dock

func (*Dock) GetModuleType

func (d *Dock) GetModuleType(port int) ModuleType

func (*Dock) SendDockCommand

func (d *Dock) SendDockCommand(command rune, params ...int) error

func (*Dock) SetModuleData

func (d *Dock) SetModuleData(port int, mtype ModuleType, params ...int) error

type Event

type Event struct {
	EventType
	ModuleType
	Channel int
	Params  []int
	Message string
	Error   error
}

func (Event) String

func (e Event) String() string

type EventType

type EventType int
const (
	EventInvalid EventType = iota
	EventConnected
	EventDisconnected
	EventUpdate
	EventMessage
	EventError
)

func (EventType) String

func (e EventType) String() string

type Module

type Module struct {
	ModuleType
	*Dock
	// contains filtered or unexported fields
}

func (*Module) Channel

func (m *Module) Channel() int

func (*Module) Connected

func (m *Module) Connected() bool

func (*Module) ProcessEvent

func (m *Module) ProcessEvent(ev Event)

func (*Module) Set

func (m *Module) Set(params ...int) error

type ModuleType

type ModuleType int
const (
	Unknown ModuleType = iota
	Joystick
	Slider
	Touch
	Motion
	Light
	Colour
	Dial
	Weather
	Number
	Motor
	Rainbow
	Matrix
)

func FromString

func FromString(name string) ModuleType

func (ModuleType) String

func (m ModuleType) String() string

type Pipe

type Pipe struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewPipe

func NewPipe() *Pipe

func (*Pipe) Close

func (p *Pipe) Close() error

func (*Pipe) Closed

func (p *Pipe) Closed() bool

func (*Pipe) Endpoints

func (p *Pipe) Endpoints() (io.ReadWriteCloser, io.ReadWriteCloser)

type Request

type Request struct {
	RequestType
	Channel  int
	Params   []int
	ParamStr string
	Error    error
}

func (Request) String

func (e Request) String() string

type RequestType

type RequestType int
const (
	ReqInvalid RequestType = iota
	ReqEnquire
	ReqResetToBootloader
	ReqVersion
	ReqPower
	ReqName
	ReqDebug
	ReqSet
	ReqError
)

func (RequestType) String

func (e RequestType) String() string

type Simulator

type Simulator struct {
	sync.Mutex
	Requests chan Request
	// contains filtered or unexported fields
}

func NewSimulator

func NewSimulator(port io.ReadWriteCloser) *Simulator

func (*Simulator) Close

func (s *Simulator) Close()

func (*Simulator) Connect

func (s *Simulator) Connect(modType ModuleType, channel int) error

func (*Simulator) Disconnect

func (s *Simulator) Disconnect(channel int) error

func (*Simulator) NotifyAttachedModules

func (s *Simulator) NotifyAttachedModules() error

func (*Simulator) NotifyUpdate

func (s *Simulator) NotifyUpdate(modType ModuleType, channel int, params ...int) error

func (*Simulator) Type

func (s *Simulator) Type(channel int) ModuleType

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL