pvdata

package
v0.0.0-...-379887d Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PVStatus_OK      = PVByte(0)
	PVStatus_WARNING = PVByte(1)
	PVStatus_ERROR   = PVByte(2)
	PVStatus_FATAL   = PVByte(3)
)
View Source
const (
	NULL_TYPE_CODE           = 0xFF
	ONLY_ID_TYPE_CODE        = 0xFE
	FULL_WITH_ID_TYPE_CODE   = 0xFD
	FULL_TAGGED_ID_TYPE_CODE = 0xFC
)
View Source
const (
	BOOLEAN = 0x00
	BYTE    = 0x20
	SHORT   = 0x21
	INT     = 0x22
	LONG    = 0x23
	UBYTE   = 0x24
	USHORT  = 0x25
	UINT    = 0x26
	ULONG   = 0x27
	FLOAT   = 0x42
	DOUBLE  = 0x43
	STRING  = 0x60

	ARRAY_BITS     = 0x18
	VARIABLE_ARRAY = 0x08
	BOUNDED_ARRAY  = 0x10
	FIXED_ARRAY    = 0x18
	BOUNDED_STRING = 0x86
	STRUCT         = 0x80
	UNION          = 0x81
	VARIANT_UNION  = 0x82
	STRUCT_ARRAY   = STRUCT | VARIABLE_ARRAY
	UNION_ARRAY    = UNION | VARIABLE_ARRAY
)

Variables

This section is empty.

Functions

func BoolValue

func BoolValue(x interface{}) (bool, bool)

func Decode

func Decode(s *DecoderState, vs ...interface{}) error

func Encode

func Encode(s *EncoderState, vs ...interface{}) error

Encode writes vs to s.Buf. All items in vs must implement PVField or be a pointer to something that can be converted to a PVField.

func IntValue

func IntValue(x interface{}) (int, bool)

Types

type Alarm

type Alarm struct {
	Severity PVInt    `pvaccess:"severity"`
	Status   PVInt    `pvaccess:"status"`
	Message  PVString `pvaccess:"message"`
}

func (Alarm) TypeID

func (Alarm) TypeID() string

type AlarmLimit

type AlarmLimit struct {
	Active           PVBoolean `pvaccess:"active"`
	LowAlarmLimit    PVDouble  `pvaccess:"lowAlarmLimit"`
	LowWarningLimit  PVDouble  `pvaccess:"lowWarningLimit"`
	HighWarningLimit PVDouble  `pvaccess:"highWarningLimit"`
	HighAlarmLimit   PVDouble  `pvaccess:"highAlarmLimit"`

	LowAlarmSeverity    PVInt `pvaccess:"lowAlarmSeverity"`
	LowWarningSeverity  PVInt `pvaccess:"lowWarningSeverity"`
	HighWarningSeverity PVInt `pvaccess:"highWarningSeverity"`
	HighAlarmSeverity   PVInt `pvaccess:"highAlarmSeverity"`

	Hysteresis PVDouble `pvaccess:"hysteresis"`
}

func (AlarmLimit) TypeID

func (AlarmLimit) TypeID() string

type Control

type Control struct {
	LimitLow  PVDouble `pvaccess:"limitLow"`
	LimitHigh PVDouble `pvaccess:"limitHigh"`
	MinStep   PVDouble `pvaccess:"minStep"`
}

func (Control) TypeID

func (Control) TypeID() string

type DecoderState

type DecoderState struct {
	Buf       Reader
	ByteOrder binary.ByteOrder
	// contains filtered or unexported fields
}

func (*DecoderState) PushReader

func (s *DecoderState) PushReader(r Reader) func()

func (*DecoderState) ReadUint16

func (s *DecoderState) ReadUint16() (uint16, error)

func (*DecoderState) ReadUint32

func (s *DecoderState) ReadUint32() (uint32, error)

func (*DecoderState) ReadUint64

func (s *DecoderState) ReadUint64() (uint64, error)

type Display

type Display struct {
	LimitLow    PVDouble `pvaccess:"limitLow"`
	LimitHigh   PVDouble `pvaccess:"limitHigh"`
	Description PVString `pvaccess:"description"`
	Units       PVString `pvaccess:"units"`
	Precision   PVInt    `pvaccess:"precision"`
	Form        Enum     `pvaccess:"enum"`
}

func (Display) TypeID

func (Display) TypeID() string

type EncoderState

type EncoderState struct {
	Buf       Writer
	ByteOrder binary.ByteOrder
	// contains filtered or unexported fields
}

func (*EncoderState) PushWriter

func (s *EncoderState) PushWriter(w Writer) func()

func (*EncoderState) WriteUint16

func (s *EncoderState) WriteUint16(v uint16) error

func (*EncoderState) WriteUint32

func (s *EncoderState) WriteUint32(v uint32) error

func (*EncoderState) WriteUint64

func (s *EncoderState) WriteUint64(v uint64) error

type Enum

type Enum struct {
	Index   PVInt    `pvaccess:"index"`
	Choices []string `pvaccess:"choices"`
}

func (Enum) TypeID

func (Enum) TypeID() string

type FieldDesc

type FieldDesc struct {
	// TypeCode represents the real FieldDesc, or NULL_TYPE_CODE
	// The other special codes will be inferred from HasID, HasTag
	TypeCode      byte
	HasID, HasTag bool
	ID            PVUShort
	Tag           PVInt // FIXME: Figure out size of tag
	Size          PVSize
	StructType    PVString
	Fields        []StructFieldDesc
}

func ValueToField

func ValueToField(v reflect.Value) (FieldDesc, error)

func (*FieldDesc) PVDecode

func (f *FieldDesc) PVDecode(s *DecoderState) error

func (*FieldDesc) PVEncode

func (f *FieldDesc) PVEncode(s *EncoderState) error

type FieldDescer

type FieldDescer interface {
	FieldDesc() (FieldDesc, error)
}

type PVAny

type PVAny struct {
	Data PVField
}

PVAny is a variant union, encoded as a field description, followed by data

func NewPVAny

func NewPVAny(data interface{}) PVAny

func (PVAny) FieldDesc

func (v PVAny) FieldDesc() (FieldDesc, error)

func (*PVAny) PVDecode

func (v *PVAny) PVDecode(s *DecoderState) error

func (*PVAny) PVEncode

func (v *PVAny) PVEncode(s *EncoderState) error

PVEncode outputs a field description followed by the serialized field. As a special case, encoding a nil PVAny pointer will output zero bytes.

type PVArray

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

func NewPVFixedArray

func NewPVFixedArray(slicePtr interface{}) PVArray

func (PVArray) Equal

func (a PVArray) Equal(b PVArray) bool

func (PVArray) FieldDesc

func (a PVArray) FieldDesc() (FieldDesc, error)

func (PVArray) PVDecode

func (a PVArray) PVDecode(s *DecoderState) error

func (PVArray) PVEncode

func (a PVArray) PVEncode(s *EncoderState) error

type PVBitSet

type PVBitSet struct {
	Present []bool
}

BitSet type

func NewBitSetWithBits

func NewBitSetWithBits(bits ...int) PVBitSet

func (PVBitSet) Get

func (bs PVBitSet) Get(bit int) bool

func (*PVBitSet) PVDecode

func (bs *PVBitSet) PVDecode(s *DecoderState) error

func (PVBitSet) PVEncode

func (bs PVBitSet) PVEncode(s *EncoderState) error

type PVBoolean

type PVBoolean bool

func (PVBoolean) FieldDesc

func (PVBoolean) FieldDesc() (FieldDesc, error)

func (*PVBoolean) PVDecode

func (v *PVBoolean) PVDecode(s *DecoderState) error

func (PVBoolean) PVEncode

func (v PVBoolean) PVEncode(s *EncoderState) error

type PVBoundedString

type PVBoundedString struct {
	*PVString
	Bound PVSize
}

func (PVBoundedString) FieldDesc

func (v PVBoundedString) FieldDesc() (FieldDesc, error)

func (PVBoundedString) PVEncode

func (v PVBoundedString) PVEncode(s *EncoderState) error

type PVByte

type PVByte int8

func (PVByte) FieldDesc

func (PVByte) FieldDesc() (FieldDesc, error)

func (*PVByte) PVDecode

func (v *PVByte) PVDecode(s *DecoderState) error

func (PVByte) PVEncode

func (v PVByte) PVEncode(s *EncoderState) error

type PVDouble

type PVDouble float64

func (PVDouble) FieldDesc

func (PVDouble) FieldDesc() (FieldDesc, error)

func (*PVDouble) PVDecode

func (v *PVDouble) PVDecode(s *DecoderState) error

func (PVDouble) PVEncode

func (v PVDouble) PVEncode(s *EncoderState) error

type PVField

type PVField interface {
	PVEncode(s *EncoderState) error
	PVDecode(s *DecoderState) error
}

type PVFloat

type PVFloat float32

func (PVFloat) FieldDesc

func (PVFloat) FieldDesc() (FieldDesc, error)

func (*PVFloat) PVDecode

func (v *PVFloat) PVDecode(s *DecoderState) error

func (PVFloat) PVEncode

func (v PVFloat) PVEncode(s *EncoderState) error

type PVInt

type PVInt int32

func (PVInt) FieldDesc

func (PVInt) FieldDesc() (FieldDesc, error)

func (*PVInt) PVDecode

func (v *PVInt) PVDecode(s *DecoderState) error

func (PVInt) PVEncode

func (v PVInt) PVEncode(s *EncoderState) error

type PVLong

type PVLong int64

func (PVLong) FieldDesc

func (PVLong) FieldDesc() (FieldDesc, error)

func (*PVLong) PVDecode

func (v *PVLong) PVDecode(s *DecoderState) error

func (PVLong) PVEncode

func (v PVLong) PVEncode(s *EncoderState) error

type PVShort

type PVShort int16

func (PVShort) FieldDesc

func (PVShort) FieldDesc() (FieldDesc, error)

func (*PVShort) PVDecode

func (v *PVShort) PVDecode(s *DecoderState) error

func (PVShort) PVEncode

func (v PVShort) PVEncode(s *EncoderState) error

type PVSize

type PVSize int64

func (*PVSize) PVDecode

func (v *PVSize) PVDecode(s *DecoderState) error

func (PVSize) PVEncode

func (v PVSize) PVEncode(s *EncoderState) error

type PVStatus

type PVStatus struct {
	Type     PVByte
	Message  PVString
	CallTree PVString
}

func (PVStatus) Error

func (v PVStatus) Error() string

func (*PVStatus) PVDecode

func (v *PVStatus) PVDecode(s *DecoderState) error

func (*PVStatus) PVEncode

func (v *PVStatus) PVEncode(s *EncoderState) error

type PVString

type PVString string

String types

func (PVString) FieldDesc

func (v PVString) FieldDesc() (FieldDesc, error)

func (*PVString) PVDecode

func (v *PVString) PVDecode(s *DecoderState) error

func (PVString) PVEncode

func (v PVString) PVEncode(s *EncoderState) error

type PVStructure

type PVStructure struct {
	ID string
	// contains filtered or unexported fields
}

func NewPVStructure

func NewPVStructure(data interface{}) (PVStructure, error)

NewPVStructure creates a PVStructure from a pointer to a struct type or a PVStructure.

func (PVStructure) Field

func (v PVStructure) Field(name string) PVField

func (PVStructure) FieldDesc

func (v PVStructure) FieldDesc() (FieldDesc, error)

func (PVStructure) PVDecode

func (v PVStructure) PVDecode(s *DecoderState) error

func (PVStructure) PVEncode

func (v PVStructure) PVEncode(s *EncoderState) error

TODO: Support bitfields for partial pack/unpack

func (PVStructure) String

func (v PVStructure) String() string

func (PVStructure) SubField

func (v PVStructure) SubField(name ...string) PVField

type PVStructureDiff

type PVStructureDiff struct {
	ChangedBitSet PVBitSet
	Value         interface{}
}

func (*PVStructureDiff) PVDecode

func (v *PVStructureDiff) PVDecode(s *DecoderState) error

func (PVStructureDiff) PVEncode

func (v PVStructureDiff) PVEncode(s *EncoderState) error

type PVStructureDiffPut

type PVStructureDiffPut struct {
	ChangedBitSet PVBitSet
	Value         interface{}
}

func (*PVStructureDiffPut) PVDecode

func (v *PVStructureDiffPut) PVDecode(s *DecoderState) error

func (PVStructureDiffPut) PVEncode

func (v PVStructureDiffPut) PVEncode(s *EncoderState) error

type PVUByte

type PVUByte uint8

func (PVUByte) FieldDesc

func (PVUByte) FieldDesc() (FieldDesc, error)

func (*PVUByte) PVDecode

func (v *PVUByte) PVDecode(s *DecoderState) error

func (PVUByte) PVEncode

func (v PVUByte) PVEncode(s *EncoderState) error

type PVUInt

type PVUInt uint32

func (PVUInt) FieldDesc

func (PVUInt) FieldDesc() (FieldDesc, error)

func (*PVUInt) PVDecode

func (v *PVUInt) PVDecode(s *DecoderState) error

func (PVUInt) PVEncode

func (v PVUInt) PVEncode(s *EncoderState) error

type PVULong

type PVULong uint64

func (PVULong) FieldDesc

func (PVULong) FieldDesc() (FieldDesc, error)

func (*PVULong) PVDecode

func (v *PVULong) PVDecode(s *DecoderState) error

func (PVULong) PVEncode

func (v PVULong) PVEncode(s *EncoderState) error

type PVUShort

type PVUShort uint16

func (PVUShort) FieldDesc

func (PVUShort) FieldDesc() (FieldDesc, error)

func (*PVUShort) PVDecode

func (v *PVUShort) PVDecode(s *DecoderState) error

func (PVUShort) PVEncode

func (v PVUShort) PVEncode(s *EncoderState) error

type Reader

type Reader interface {
	io.Reader
	io.ByteReader
}

type StructFieldDesc

type StructFieldDesc struct {
	Name  string
	Field FieldDesc
}

type Time

type Time struct {
	Time    time.Time
	UserTag PVInt
}

func (*Time) PVDecode

func (t *Time) PVDecode(s *DecoderState) error

func (Time) PVEncode

func (t Time) PVEncode(s *EncoderState) error

func (Time) TypeID

func (Time) TypeID() string

type TypeIDer

type TypeIDer interface {
	TypeID() string
}

type ValueAlarm

type ValueAlarm AlarmLimit

valueAlarm_t is used by older PVAccess servers. TODO: The limit fields of ValueAlarm can be any integer or floating point type, not just doubles.

func (ValueAlarm) TypeID

func (ValueAlarm) TypeID() string

type Writer

type Writer interface {
	io.Writer
	io.ByteWriter
	io.StringWriter
}

Jump to

Keyboard shortcuts

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