Documentation ¶
Index ¶
- Variables
- func FilterRegisters[R Register](input []R, filterConf RegisterFilterConf) (output []R)
- func SinkLog(prefix string, input <-chan Value)
- func SortRegisterStructs(input []RegisterStruct)
- type EnumRegisterValue
- type Fillable
- type Filterable
- type NullRegisterValue
- type NumericRegisterValue
- type Register
- type RegisterDb
- func (rdb *RegisterDb) Add(registers ...Register)
- func (rdb *RegisterDb) AddStruct(registerStructs ...RegisterStruct)
- func (rdb *RegisterDb) GetAll() []RegisterStruct
- func (rdb *RegisterDb) GetByName(registerName string) (reg RegisterStruct, ok bool)
- func (rdb *RegisterDb) GetFiltered(filter RegisterFilterFunc) []RegisterStruct
- func (rdb *RegisterDb) Subscribe(ctx context.Context, filter RegisterFilterFunc) <-chan RegisterStruct
- type RegisterFilterConf
- type RegisterFilterFunc
- type RegisterStruct
- func (r RegisterStruct) Category() string
- func (r RegisterStruct) Description() string
- func (r RegisterStruct) Enum() map[int]string
- func (r RegisterStruct) Equals(b RegisterStruct) bool
- func (r RegisterStruct) Name() string
- func (r RegisterStruct) RegisterType() RegisterType
- func (r RegisterStruct) Sort() int
- func (r RegisterStruct) Unit() string
- func (r RegisterStruct) Writable() bool
- type RegisterSubscription
- type RegisterType
- type RegisterValue
- type StateKey
- type TextRegisterValue
- type Value
- type ValueFilterFunc
- type ValueStorage
- func (vs *ValueStorage) Fill(value Value)
- func (vs *ValueStorage) GetState() (result []Value)
- func (vs *ValueStorage) GetStateFiltered(filter ValueFilterFunc) (result []Value)
- func (vs *ValueStorage) Shutdown()
- func (vs *ValueStorage) SubscribeReturnInitial(ctx context.Context, filter ValueFilterFunc) (initial []Value, subscription ValueSubscription)
- func (vs *ValueStorage) SubscribeSendInitial(ctx context.Context, filter ValueFilterFunc) (subscription ValueSubscription)
- func (vs *ValueStorage) Wait()
- type ValueSubscription
Constants ¶
This section is empty.
Variables ¶
View Source
var EmptyFilter = func(Value) bool { return true }
Functions ¶
func FilterRegisters ¶
func FilterRegisters[R Register](input []R, filterConf RegisterFilterConf) (output []R)
func SortRegisterStructs ¶
func SortRegisterStructs(input []RegisterStruct)
Types ¶
type EnumRegisterValue ¶
type EnumRegisterValue struct { RegisterValue // contains filtered or unexported fields }
func NewEnumRegisterValue ¶
func NewEnumRegisterValue(deviceName string, register Register, value int) EnumRegisterValue
func (EnumRegisterValue) EnumIdx ¶
func (v EnumRegisterValue) EnumIdx() int
func (EnumRegisterValue) Equals ¶
func (v EnumRegisterValue) Equals(comp Value) bool
func (EnumRegisterValue) GenericValue ¶
func (v EnumRegisterValue) GenericValue() interface{}
func (EnumRegisterValue) String ¶
func (v EnumRegisterValue) String() string
func (EnumRegisterValue) Value ¶
func (v EnumRegisterValue) Value() string
type Filterable ¶ added in v3.2.0
type NullRegisterValue ¶
type NullRegisterValue struct {
RegisterValue
}
func NewNullRegisterValue ¶
func NewNullRegisterValue(deviceName string, register Register) NullRegisterValue
func (NullRegisterValue) Equals ¶
func (v NullRegisterValue) Equals(comp Value) bool
func (NullRegisterValue) GenericValue ¶
func (v NullRegisterValue) GenericValue() interface{}
func (NullRegisterValue) String ¶
func (v NullRegisterValue) String() string
type NumericRegisterValue ¶
type NumericRegisterValue struct { RegisterValue // contains filtered or unexported fields }
func NewNumericRegisterValue ¶
func NewNumericRegisterValue(deviceName string, register Register, value float64) NumericRegisterValue
func (NumericRegisterValue) Equals ¶
func (v NumericRegisterValue) Equals(comp Value) bool
func (NumericRegisterValue) GenericValue ¶
func (v NumericRegisterValue) GenericValue() interface{}
func (NumericRegisterValue) String ¶
func (v NumericRegisterValue) String() string
func (NumericRegisterValue) Value ¶
func (v NumericRegisterValue) Value() float64
type RegisterDb ¶
type RegisterDb struct {
// contains filtered or unexported fields
}
func NewRegisterDb ¶
func NewRegisterDb() (registerDb *RegisterDb)
func (*RegisterDb) Add ¶
func (rdb *RegisterDb) Add(registers ...Register)
func (*RegisterDb) AddStruct ¶
func (rdb *RegisterDb) AddStruct(registerStructs ...RegisterStruct)
func (*RegisterDb) GetAll ¶
func (rdb *RegisterDb) GetAll() []RegisterStruct
func (*RegisterDb) GetByName ¶
func (rdb *RegisterDb) GetByName(registerName string) (reg RegisterStruct, ok bool)
func (*RegisterDb) GetFiltered ¶
func (rdb *RegisterDb) GetFiltered(filter RegisterFilterFunc) []RegisterStruct
func (*RegisterDb) Subscribe ¶
func (rdb *RegisterDb) Subscribe(ctx context.Context, filter RegisterFilterFunc) <-chan RegisterStruct
type RegisterFilterConf ¶
type RegisterFilterFunc ¶
type RegisterFilterFunc func(Filterable) bool
var AllRegisterFilter RegisterFilterFunc = func(Filterable) bool { return true }
func RegisterFilter ¶
func RegisterFilter(registerFilter RegisterFilterConf) RegisterFilterFunc
type RegisterStruct ¶
type RegisterStruct struct {
// contains filtered or unexported fields
}
func NewRegisterStruct ¶
func NewRegisterStruct( category, name, description string, registerType RegisterType, enum map[int]string, unit string, sort int, writable bool, ) RegisterStruct
func NewRegisterStructByInterface ¶
func NewRegisterStructByInterface(reg Register) RegisterStruct
func (RegisterStruct) Category ¶
func (r RegisterStruct) Category() string
func (RegisterStruct) Description ¶
func (r RegisterStruct) Description() string
func (RegisterStruct) Enum ¶
func (r RegisterStruct) Enum() map[int]string
func (RegisterStruct) Equals ¶
func (r RegisterStruct) Equals(b RegisterStruct) bool
func (RegisterStruct) Name ¶
func (r RegisterStruct) Name() string
func (RegisterStruct) RegisterType ¶
func (r RegisterStruct) RegisterType() RegisterType
func (RegisterStruct) Sort ¶
func (r RegisterStruct) Sort() int
func (RegisterStruct) Unit ¶
func (r RegisterStruct) Unit() string
func (RegisterStruct) Writable ¶ added in v3.2.0
func (r RegisterStruct) Writable() bool
type RegisterSubscription ¶
type RegisterSubscription struct {
// contains filtered or unexported fields
}
type RegisterType ¶
type RegisterType int
const ( UndefinedRegister RegisterType = iota NumberRegister TextRegister EnumRegister )
func RegisterTypeFromString ¶
func RegisterTypeFromString(s string) RegisterType
func (RegisterType) String ¶
func (rt RegisterType) String() string
type RegisterValue ¶
type RegisterValue struct {
// contains filtered or unexported fields
}
func (RegisterValue) DeviceName ¶
func (v RegisterValue) DeviceName() string
func (RegisterValue) Register ¶
func (v RegisterValue) Register() Register
type TextRegisterValue ¶
type TextRegisterValue struct { RegisterValue // contains filtered or unexported fields }
func NewTextRegisterValue ¶
func NewTextRegisterValue(deviceName string, register Register, value string) TextRegisterValue
func (TextRegisterValue) Equals ¶
func (v TextRegisterValue) Equals(comp Value) bool
func (TextRegisterValue) GenericValue ¶
func (v TextRegisterValue) GenericValue() interface{}
func (TextRegisterValue) String ¶
func (v TextRegisterValue) String() string
func (TextRegisterValue) Value ¶
func (v TextRegisterValue) Value() string
type ValueFilterFunc ¶
var AllValueFilter ValueFilterFunc = func(Value) bool { return true }
var NonNullValueFilter ValueFilterFunc = func(value Value) bool { _, isNullValue := value.(NullRegisterValue) return !isNullValue }
func DeviceNameValueFilter ¶
func DeviceNameValueFilter(deviceName string) ValueFilterFunc
func DeviceNonNullValueFilter ¶
func DeviceNonNullValueFilter(deviceName string) ValueFilterFunc
func RegisterValueFilter ¶
func RegisterValueFilter(registerFilter RegisterFilterConf) ValueFilterFunc
type ValueStorage ¶
type ValueStorage struct {
// contains filtered or unexported fields
}
func NewValueStorage ¶
func NewValueStorage() (valueStorage *ValueStorage)
func (*ValueStorage) Fill ¶
func (vs *ValueStorage) Fill(value Value)
func (*ValueStorage) GetState ¶
func (vs *ValueStorage) GetState() (result []Value)
func (*ValueStorage) GetStateFiltered ¶
func (vs *ValueStorage) GetStateFiltered(filter ValueFilterFunc) (result []Value)
func (*ValueStorage) Shutdown ¶
func (vs *ValueStorage) Shutdown()
func (*ValueStorage) SubscribeReturnInitial ¶
func (vs *ValueStorage) SubscribeReturnInitial(ctx context.Context, filter ValueFilterFunc) (initial []Value, subscription ValueSubscription)
func (*ValueStorage) SubscribeSendInitial ¶
func (vs *ValueStorage) SubscribeSendInitial(ctx context.Context, filter ValueFilterFunc) (subscription ValueSubscription)
func (*ValueStorage) Wait ¶
func (vs *ValueStorage) Wait()
Wait until all inputs are processed (useful for testing)
type ValueSubscription ¶
type ValueSubscription struct {
// contains filtered or unexported fields
}
func (*ValueSubscription) Drain ¶
func (s *ValueSubscription) Drain() <-chan Value
Click to show internal directories.
Click to hide internal directories.