Documentation ¶
Overview ¶
Package powersensor defines the interfaces of a powersensor
Index ¶
- Constants
- Variables
- func Named(name string) resource.Name
- func NamesFromRobot(r robot.Robot) []string
- func NewCurrentCollector(resource interface{}, params data.CollectorParams) (data.Collector, error)
- func NewPowerCollector(resource interface{}, params data.CollectorParams) (data.Collector, error)
- func NewRPCServiceServer(coll resource.APIResourceCollection[PowerSensor]) interface{}
- func NewReadingsCollector(resource interface{}, params data.CollectorParams) (data.Collector, error)
- func NewVoltageCollector(resource interface{}, params data.CollectorParams) (data.Collector, error)
- type PowerSensor
Constants ¶
const SubtypeName = "power_sensor"
SubtypeName is a constant that identifies the component resource API string "power_sensor".
Variables ¶
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") )
var API = resource.APINamespaceRDK.WithComponentType(SubtypeName)
API is a variable that identifies the component resource API.
Functions ¶
func NamesFromRobot ¶
NamesFromRobot is a helper for getting all PowerSensor names from the given Robot.
func NewCurrentCollector ¶ added in v0.13.0
func NewCurrentCollector(resource interface{}, params data.CollectorParams) (data.Collector, error)
NewCurrentCollector returns a collector to register a current method. If one is already registered with the same MethodMetadata it will panic.
func NewPowerCollector ¶ added in v0.13.0
func NewPowerCollector(resource interface{}, params data.CollectorParams) (data.Collector, error)
NewPowerCollector returns a collector to register a power method. If one is already registered with the same MethodMetadata it will panic.
func NewRPCServiceServer ¶
func NewRPCServiceServer(coll resource.APIResourceCollection[PowerSensor]) interface{}
NewRPCServiceServer constructs a PowerSesnsor gRPC service serviceServer.
func NewReadingsCollector ¶ added in v0.15.0
func NewReadingsCollector(resource interface{}, params data.CollectorParams) (data.Collector, error)
NewReadingsCollector returns a collector to register a readings method. If one is already registered with the same MethodMetadata it will panic.
func NewVoltageCollector ¶ added in v0.13.0
func NewVoltageCollector(resource interface{}, params data.CollectorParams) (data.Collector, error)
NewVoltageCollector returns a collector to register a voltage method. If one is already registered with the same MethodMetadata it will panic.
Types ¶
type PowerSensor ¶
type PowerSensor interface { resource.Sensor resource.Resource 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 logging.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 |
Package renogy implements the renogy charge controller sensor for DC batteries.
|
Package renogy implements the renogy charge controller sensor for DC batteries. |