Documentation
¶
Overview ¶
Package toggleswitch contains a gRPC based switch client.
Package toggleswitch contains a gRPC based switch service server.
Package toggleswitch defines a multi-position switch.
Index ¶
Constants ¶
const SubtypeName = "switch"
SubtypeName is a constant that identifies the component resource API string.
Variables ¶
var API = resource.APINamespaceRDK.WithComponentType(SubtypeName)
API is a variable that identifies the component resource API.
var ErrInvalidPosition = func(switchName string, position, maxPosition int) error { return fmt.Errorf("switch component %v position %d is invalid (max: %d)", switchName, position, maxPosition) }
ErrInvalidPosition is the returned error if switch position is invalid.
Functions ¶
func NamesFromRobot ¶
NamesFromRobot is a helper for getting all switch names from the given Robot.
func NewRPCServiceServer ¶
func NewRPCServiceServer(coll resource.APIResourceCollection[Switch]) interface{}
NewRPCServiceServer constructs a switch gRPC service server. It is intentionally untyped to prevent use outside of tests.
Types ¶
type Switch ¶
type Switch interface { resource.Resource // SetPosition sets the switch to the specified position. // Position must be within the valid range for the switch type. // This will block until done or a new operation cancels this one. SetPosition(ctx context.Context, position uint32, extra map[string]interface{}) error // GetPosition returns the current position of the switch. GetPosition(ctx context.Context, extra map[string]interface{}) (uint32, error) // GetNumberOfPositions returns the total number of valid positions for this switch. GetNumberOfPositions(ctx context.Context, extra map[string]interface{}) (uint32, error) }
A Switch represents a physical multi-position switch.
func FromDependencies ¶
func FromDependencies(deps resource.Dependencies, name string) (Switch, error)
FromDependencies is a helper for getting the named button component from a collection of dependencies.
Directories
¶
Path | Synopsis |
---|---|
Package fake implements fake switches with different position counts.
|
Package fake implements fake switches with different position counts. |
Package register registers all relevant switches and also API specific functions
|
Package register registers all relevant switches and also API specific functions |