veregister

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package veregister contains the register definitions for the VE.Direct protocol.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedType = fmt.Errorf("unsuported product type")

Functions

func AppendBmv

func AppendBmv(rl *RegisterList)

AppendBmv appends all registers of BMV units to the given RegisterList. The list is based on: https://www.victronenergy.com/upload/documents/BMV-7xx-HEX-Protocol.pdf

func AppendBmvHistoric

func AppendBmvHistoric(rl *RegisterList)

AppendBmvHistoric appends all registers of the Historic category to the given RegisterList.

func AppendBmvMonitor

func AppendBmvMonitor(rl *RegisterList)

AppendBmvMonitor appends all registers of the Monitor category to the given RegisterList.

func AppendBmvProduct

func AppendBmvProduct(rl *RegisterList)

AppendBmvProduct appends all registers of the Product category to the given RegisterList.

func AppendInverter

func AppendInverter(rl *RegisterList)

AppendInverter appends all registers of phoenix inverters to the given RegisterList. The list is based on: https://www.victronenergy.com/upload/documents/VE.Direct-HEX-Protocol-Phoenix-Inverter.pdf

func AppendInverterAcOutControl

func AppendInverterAcOutControl(rl *RegisterList)

AppendInverterAcOutControl appends all registers of the AC-out settings category to the given RegisterList.

func AppendInverterBatteryControl

func AppendInverterBatteryControl(rl *RegisterList)

AppendInverterBatteryControl appends all registers of the Battery settings category to the given RegisterList.

func AppendInverterDynamicCutoff

func AppendInverterDynamicCutoff(rl *RegisterList)

AppendInverterDynamicCutoff appends all registers of the Dynamic Cutoff category to the given RegisterList.

func AppendInverterGeneric

func AppendInverterGeneric(rl *RegisterList)

AppendInverterGeneric appends all registers of the Generic category to the given RegisterList.

func AppendInverterHistory

func AppendInverterHistory(rl *RegisterList)

AppendInverterHistory appends all registers of the History category to the given RegisterList.

func AppendInverterOperation

func AppendInverterOperation(rl *RegisterList)

AppendInverterOperation appends all registers of the Operation category to the given RegisterList.

func AppendInverterProduct

func AppendInverterProduct(rl *RegisterList)

AppendInverterProduct appends all registers of the Product category to the given RegisterList.

func AppendSolar

func AppendSolar(rl *RegisterList)

AppendSolar appends all registers of solar chargers to the given RegisterList. The list is based on: https://www.victronenergy.com/upload/documents/BlueSolar-HEX-protocol.pdf

func AppendSolarChargerData

func AppendSolarChargerData(rl *RegisterList)

AppendSolarChargerData appends all registers of the Charger category to the given RegisterList.

func AppendSolarGeneric

func AppendSolarGeneric(rl *RegisterList)

AppendSolarGeneric appends all registers of the Generic category to the given RegisterList.

func AppendSolarPanelData

func AppendSolarPanelData(rl *RegisterList)

AppendSolarPanelData appends all registers of the Panel category to the given RegisterList.

func AppendSolarProduct

func AppendSolarProduct(rl *RegisterList)

AppendSolarProduct appends all registers of the Product category to the given RegisterList.

func AppendSolarSettings

func AppendSolarSettings(rl *RegisterList)

AppendSolarSettings appends all registers of the Settings category to the given RegisterList.

Types

type EnumRegister

type EnumRegister interface {
	Register
	Enum() map[int]string
}

type EnumRegisterStruct

type EnumRegisterStruct struct {
	RegisterStruct
	// contains filtered or unexported fields
}

EnumRegisterStruct is for registers that store enum values.

func (EnumRegisterStruct) Factory

Factory returns the enum factory.

func (EnumRegisterStruct) Type

func (r EnumRegisterStruct) Type() Type

Type returns the type of the register.

type FieldListRegisterStruct added in v0.0.4

type FieldListRegisterStruct struct {
	RegisterStruct
	// contains filtered or unexported fields
}

FieldListRegisterStruct is for registers that store a list of fields.

func (FieldListRegisterStruct) Factory added in v0.0.4

Factory returns the field list factory.

func (FieldListRegisterStruct) Type added in v0.0.4

func (r FieldListRegisterStruct) Type() Type

Type returns the type of the register.

type NumberRegister

type NumberRegister interface {
	Register
	Unit() string
	Signed() bool
	Factor() int
	Offset() float64
}

type NumberRegisterStruct

type NumberRegisterStruct struct {
	RegisterStruct
	// contains filtered or unexported fields
}

NumberRegisterStruct is for registers that store numeric (integer or float) values.

func (NumberRegisterStruct) Factor

func (r NumberRegisterStruct) Factor() int

Factor returns the factor to multiply the number with (e.g. 10 when the number is in 0.1V resolution).

func (NumberRegisterStruct) Offset

func (r NumberRegisterStruct) Offset() float64

Offset returns the offset to add to the number.

func (NumberRegisterStruct) Signed

func (r NumberRegisterStruct) Signed() bool

Signed returns true when the number is signed.

func (NumberRegisterStruct) Type

func (r NumberRegisterStruct) Type() Type

Type returns the type of the register.

func (NumberRegisterStruct) Unit

func (r NumberRegisterStruct) Unit() string

Unit returns the unit of the number (e.g. "V" for volt).

type Register

type Register interface {
	Type() Type
	Category() string
	Name() string
	Description() string
	Sort() int
	Address() uint16
	Static() bool
	Writable() bool
}

type RegisterList

type RegisterList struct {
	NumberRegisters    []NumberRegisterStruct
	TextRegisters      []TextRegisterStruct
	EnumRegisters      []EnumRegisterStruct
	FieldListRegisters []FieldListRegisterStruct
}

RegisterList is a container holding {Number,Text,Enum}RegisterStructs.

func GetRegisterListByProductType

func GetRegisterListByProductType(t veproduct.Type) (rl RegisterList, err error)

func NewRegisterList

func NewRegisterList() RegisterList

NewRegisterList creates a new RegisterList.

func (*RegisterList) AppendEnumRegisterStruct

func (rl *RegisterList) AppendEnumRegisterStruct(r ...EnumRegisterStruct)

AppendEnumRegisterStruct appends the given EnumRegisterStructs to the list.

func (*RegisterList) AppendFieldListRegisterStruct added in v0.0.4

func (rl *RegisterList) AppendFieldListRegisterStruct(r ...FieldListRegisterStruct)

AppendFieldListRegisterStruct appends the given FieldListRegisterStructs to the list.

func (*RegisterList) AppendNumberRegisterStruct

func (rl *RegisterList) AppendNumberRegisterStruct(r ...NumberRegisterStruct)

AppendNumberRegisterStruct appends the given NumberRegisterStructs to the list.

func (*RegisterList) AppendTextRegisterStruct

func (rl *RegisterList) AppendTextRegisterStruct(r ...TextRegisterStruct)

AppendTextRegisterStruct appends the given TextRegisterStructs to the list.

func (*RegisterList) FilterByName

func (rl *RegisterList) FilterByName(exclude ...string)

FilterByName removes all registers with the specified name from the list.

func (*RegisterList) FilterRegister

func (rl *RegisterList) FilterRegister(f func(r Register) bool)

FilterRegister removes all registers from the list for which the filter function return false. This is useful since the user does not need to care about the different register types.

func (*RegisterList) GetRegisters

func (rl *RegisterList) GetRegisters() []Register

GetRegisters returns all types of registers sorted by their sort value in a common interface slice.

func (*RegisterList) Len

func (rl *RegisterList) Len() int

Len returns the number of registers in the list.

type RegisterStruct

type RegisterStruct struct {
	// contains filtered or unexported fields
}

RegisterStruct is the base struct for all register types.

func (RegisterStruct) Address

func (r RegisterStruct) Address() uint16

Address returns the memory address used to fetch register from the device.

func (RegisterStruct) Category

func (r RegisterStruct) Category() string

Category returns the category of the register (e.g. "Essential").

func (RegisterStruct) Description

func (r RegisterStruct) Description() string

Description returns the description of the register (e.g. "Panel Voltage").

func (RegisterStruct) Name

func (r RegisterStruct) Name() string

Name returns the technical name of the register (e.g. "PanelVoltage").

func (RegisterStruct) Sort

func (r RegisterStruct) Sort() int

Sort returns the sort order of the registers.

func (RegisterStruct) Static

func (r RegisterStruct) Static() bool

Static returns true when the register is static and not updated by the device.

func (RegisterStruct) Type

func (r RegisterStruct) Type() Type

Type returns the type of the register.

func (RegisterStruct) Writable

func (r RegisterStruct) Writable() bool

Writable returns true when the register can be written to.

type TextRegisterStruct

type TextRegisterStruct struct {
	RegisterStruct
}

TextRegisterStruct is for registers that store text values.

func (TextRegisterStruct) Type

func (r TextRegisterStruct) Type() Type

Type returns the type of the register.

type Type

type Type uint
const (
	Undefined Type = iota
	Number
	Text
	Enum
	FieldList
)

Jump to

Keyboard shortcuts

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