driverapi

package
v0.0.0-...-a1a5cdc Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver interface {
	Start() error
	Stop() error
	GetConf() DriverConf
	Copy() Driver
	String() string
}

func NewDriver

func NewDriver(config DriverConf, apiAdpt adaptorapi.Adaptor, rcvQ *message.Queue, sndQ *message.Queue) (Driver, error)

type DriverConf

type DriverConf interface {
	NewDriver(adaptorapi.Adaptor, *message.Queue, *message.Queue) (Driver, error)
	ValidateConf() error
	GetType() string
	GetID() string
	GetAdaptorID() string
	GetSubscriptions() []string
}

type DriverConfEnvelope

type DriverConfEnvelope struct {
	Type          string      `json:"type"`
	ID            string      `json:"id"`
	AdaptorID     string      `json:"adaptor-id"`
	Qualifier     string      `json:"qualifier"`
	Subscriptions []string    `json:"subscriptions"`
	Conf          interface{} `json:"conf"`
}

DriverConfEnvelope is used primarly for easy marshalling/unmarshalling of various DriverConf.

type DriversConfEnvelope

type DriversConfEnvelope struct {
	MachineID string `json:"machine-id"`
	Confs     []DriverConfEnvelope
}

DriversConfEnvelope is used primarly for easy marshalling/unmarshalling of 1 or more dirvers.

type Robot

type Robot struct {
	Name string
	Work func()

	AutoRun bool
	// contains filtered or unexported fields
}

Robot is a named entity that manages a collection of devices. It contains its own work routine and a collection of custom commands to control a robot remotely via the Gobot api.

func NewRobot

func NewRobot(v ...interface{}) *Robot

NewRobot returns a new Robot. It supports the following optional params:

name:	string with the name of the Robot. A name will be automatically generated if no name is supplied.
[]Device: Devices which are automatically started and stopped with the robot
func(): The work routine the robot will execute once all devices have been initialized and started

func (*Robot) AddDevice

func (r *Robot) AddDevice(d gobot.Device) gobot.Device

AddDevice adds a new Device to the robots collection of devices. Returns the added device.

func (*Robot) Device

func (r *Robot) Device(name string) gobot.Device

Device returns a device given a name. Returns nil if the Device does not exist.

func (*Robot) Devices

func (r *Robot) Devices() *gobot.Devices

Devices returns all devices associated with this Robot.

func (*Robot) Running

func (r *Robot) Running() bool

Running returns if the Robot is currently started or not

func (*Robot) Start

func (r *Robot) Start(args ...interface{}) (err error)

Start a Robot's Devices, and work.

func (*Robot) Stop

func (r *Robot) Stop() error

Stop stops a Robot's Devices

Jump to

Keyboard shortcuts

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