powersensor

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: AGPL-3.0 Imports: 14 Imported by: 6

Documentation

Overview

Package powersensor defines the interfaces of a powersensor

Index

Constants

View Source
const SubtypeName = "power_sensor"

SubtypeName is a constant that identifies the component resource API string "power_sensor".

Variables

View Source
var (
	// ErrMethodUnimplementedVoltage returns error if the Voltage method is unimplemented.
	ErrMethodUnimplementedVoltage = errors.New("Voltage Unimplemented")
	// ErrMethodUnimplementedCurrent returns error if the Current method is unimplemented.
	ErrMethodUnimplementedCurrent = errors.New("Current Unimplemented")
	// ErrMethodUnimplementedPower returns error if the Power method is unimplemented.
	ErrMethodUnimplementedPower = errors.New("Power Unimplemented")
)
View Source
var API = resource.APINamespaceRDK.WithComponentType(SubtypeName)

API is a variable that identifies the component resource API.

Functions

func Named

func Named(name string) resource.Name

Named is a helper for getting the named PowerSensor's typed resource name.

func NamesFromRobot

func NamesFromRobot(r robot.Robot) []string

NamesFromRobot is a helper for getting all PowerSensor names from the given Robot.

func NewRPCServiceServer

func NewRPCServiceServer(coll resource.APIResourceCollection[PowerSensor]) interface{}

NewRPCServiceServer constructs a PowerSesnsor gRPC service serviceServer.

func Readings

func Readings(ctx context.Context, g PowerSensor, extra map[string]interface{}) (map[string]interface{}, error)

Readings is a helper for getting all readings from a PowerSensor.

Types

type PowerSensor

type PowerSensor interface {
	sensor.Sensor
	Voltage(ctx context.Context, extra map[string]interface{}) (float64, bool, error)
	Current(ctx context.Context, extra map[string]interface{}) (float64, bool, error)
	Power(ctx context.Context, extra map[string]interface{}) (float64, error)
}

A PowerSensor reports information about voltage, current and power.

func FromDependencies

func FromDependencies(deps resource.Dependencies, name string) (PowerSensor, error)

FromDependencies is a helper for getting the named PowerSensor from a collection of dependencies.

func FromRobot

func FromRobot(r robot.Robot, name string) (PowerSensor, error)

FromRobot is a helper for getting the named PowerSensor from the given Robot.

func NewClientFromConn

func NewClientFromConn(
	ctx context.Context,
	conn rpc.ClientConn,
	remoteName string,
	name resource.Name,
	logger golog.Logger,
) (PowerSensor, error)

NewClientFromConn constructs a new client from connection passed in.

Directories

Path Synopsis
Package fake is a fake PowerSensor for testing
Package fake is a fake PowerSensor for testing
Package ina this is blank for mac
Package ina this is blank for mac
Package register registers all relevant motors
Package register registers all relevant motors

Jump to

Keyboard shortcuts

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