DummySwitch

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2020 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EventHandler

func EventHandler(h func(sw.Switcher, sw.Device)) func(*DummySwitch)

EventHandler sets a callback function through which the bandswitch will report Events

func Switch

func Switch(sc SwitchConfig) func(*DummySwitch)

Switch is a functional option to set the switch's configuration.

Types

type DummySwitch

type DummySwitch struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewDummySwitch

func NewDummySwitch(options ...func(*DummySwitch)) *DummySwitch

func (*DummySwitch) Close

func (d *DummySwitch) Close()

Close shuts down the switch.

func (*DummySwitch) GetPort

func (d *DummySwitch) GetPort(portName string) (sw.Port, error)

GetPort returns switch.Port struct containing the current state of the requested port.

func (*DummySwitch) Init

func (d *DummySwitch) Init() error

func (*DummySwitch) Name

func (d *DummySwitch) Name() string

Name returns the Name of this Dummy Switch

func (*DummySwitch) Serialize

func (d *DummySwitch) Serialize() sw.Device

Serialize returns a switch.Device struct containing the current state and configuration of this Dummy switch.

func (*DummySwitch) SetPort

func (d *DummySwitch) SetPort(portRequest sw.Port) error

SetPort sets the Terminals of a particular Port. The portRequest can contain n termials.

type PinConfig

type PinConfig struct {
	Name  string
	Index int
}

PinConfig describes a gpio pin.

type PortConfig

type PortConfig struct {
	Name      string
	Index     int
	Exclusive bool
	Terminals []PinConfig
}

PortConfig describes a port which is a collection of gpio pins. This struct is injected through the functional option "Port" during construction of BandswitchGPIO.

type SwitchConfig

type SwitchConfig struct {
	Name      string
	Index     int
	Exclusive bool
	Ports     []PortConfig
}

SwitchConfig describes a switch which is a collection of ports.

Jump to

Keyboard shortcuts

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