primitivedata

package
v0.0.0-...-d6403d3 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Deprecated: use model.TagClass_APPLICATION_TAGS
	TagApplicationTagClass = readWriteModel.TagClass_APPLICATION_TAGS
	// Deprecated: use model.TagClass_CONTEXT_SPECIFIC_TAGS
	TagContextTagClass = readWriteModel.TagClass_CONTEXT_SPECIFIC_TAGS
	TagOpeningTagClass = 2
	TagClosingTagClass = 3

	// Deprecated: use  model.BACnetDataType_NULL
	TagNullAppTag = readWriteModel.BACnetDataType_NULL
	// Deprecated: use  model.BACnetDataType_BOOLEAN
	TagBooleanAppTag = readWriteModel.BACnetDataType_BOOLEAN
	// Deprecated: use  model.BACnetDataType_UNSIGNED_INTEGER
	TagUnsignedAppTag = readWriteModel.BACnetDataType_UNSIGNED_INTEGER
	// Deprecated: use  model.BACnetDataType_SIGNED_INTEGER
	TagIntegerAppTag = readWriteModel.BACnetDataType_SIGNED_INTEGER
	// Deprecated: use  model.BACnetDataType_REAL
	TagRealAppTag = readWriteModel.BACnetDataType_REAL
	// Deprecated: use  model.BACnetDataType_DOUBLE
	TagDoubleAppTag = readWriteModel.BACnetDataType_DOUBLE
	// Deprecated: use  model.BACnetDataType_OCTET_STRING
	TagOctetStringAppTag = readWriteModel.BACnetDataType_OCTET_STRING
	// Deprecated: use  model.BACnetDataType_CHARACTER_STRING
	TagCharacterStringAppTag = readWriteModel.BACnetDataType_CHARACTER_STRING
	// Deprecated: use  model.BACnetDataType_BIT_STRING
	TagBitStringAppTag = readWriteModel.BACnetDataType_BIT_STRING
	// Deprecated: use  model.BACnetDataType_ENUMERATED
	TagEnumeratedAppTag = readWriteModel.BACnetDataType_ENUMERATED
	// Deprecated: use  model.BACnetDataType_DATE
	TagDateAppTag = readWriteModel.BACnetDataType_DATE
	// Deprecated: use  model.BACnetDataType_TIME
	TagTimeAppTag = readWriteModel.BACnetDataType_TIME
	// Deprecated: use  model.BACnetDataType_BACNET_OBJECT_IDENTIFIER
	TagObjectIdentifierAppTag = readWriteModel.BACnetDataType_BACNET_OBJECT_IDENTIFIER
	TagReservedAppTag13       = 13
	TagReservedAppTag14       = 14
	TagReservedAppTag15       = 15
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationTag

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

func NewApplicationTag

func NewApplicationTag(args Args) (*ApplicationTag, error)

func (ApplicationTag) AppToContext

func (t ApplicationTag) AppToContext(context uint) (*ContextTag, error)

func (ApplicationTag) AppToObject

func (t ApplicationTag) AppToObject() (any, error)

func (ApplicationTag) ContextToApp

func (t ApplicationTag) ContextToApp(dataType uint) (Tag, error)

func (ApplicationTag) Decode

func (t ApplicationTag) Decode(pdu PDUData) error

func (ApplicationTag) Encode

func (t ApplicationTag) Encode(pdu PDUData)

func (ApplicationTag) Equals

func (t ApplicationTag) Equals(other any) bool

func (ApplicationTag) Format

func (t ApplicationTag) Format(s fmt.State, v rune)

func (ApplicationTag) GetTagClass

func (t ApplicationTag) GetTagClass() readWriteModel.TagClass

func (ApplicationTag) GetTagData

func (t ApplicationTag) GetTagData() []byte

func (ApplicationTag) GetTagLvt

func (t ApplicationTag) GetTagLvt() int

func (ApplicationTag) GetTagNumber

func (t ApplicationTag) GetTagNumber() uint

func (ApplicationTag) PrintDebugContents

func (t ApplicationTag) PrintDebugContents(indent int, file io.Writer, _ids []uintptr)

type Atomic

type Atomic[T ComparableAndOrdered] struct {
	AtomicContract[T]
	// contains filtered or unexported fields
}

Atomic is an abstract struct

func NewAtomic

func NewAtomic[T ComparableAndOrdered](subStruct interface {
	AtomicContract[T]
	AtomicRequirements
}) *Atomic[T]

func (*Atomic[T]) Coerce

func (a *Atomic[T]) Coerce(arg any) T

func (*Atomic[T]) Compare

func (a *Atomic[T]) Compare(other any) int

func (*Atomic[T]) Equals

func (a *Atomic[T]) Equals(other any) bool

func (*Atomic[T]) GetAppTag

func (a *Atomic[T]) GetAppTag() readWriteModel.BACnetDataType

func (*Atomic[T]) GetValue

func (a *Atomic[T]) GetValue() T

func (*Atomic[T]) LowerThan

func (a *Atomic[T]) LowerThan(other any) bool

type AtomicContract

type AtomicContract[T ComparableAndOrdered] interface {
	Compare(other any) int
	LowerThan(other any) bool
	Equals(other any) bool
	GetValue() T
}

AtomicContract provides a set of functions which can be overwritten by a sub struct

type AtomicRequirements

type AtomicRequirements interface {
	IsValid(arg any) bool
}

AtomicRequirements provides a set of functions which must be overwritten by a sub struct

type BitString

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

func NewBitString

func NewBitString(args Args) (*BitString, error)

func NewBitStringWithExtension

func NewBitStringWithExtension(bitStringExtension BitStringExtension, args Args) (*BitString, error)

func (*BitString) Compare

func (b *BitString) Compare(other any) int

func (*BitString) Decode

func (b *BitString) Decode(arg Arg) error

func (*BitString) Encode

func (b *BitString) Encode(arg Arg) error

func (*BitString) Equals

func (b *BitString) Equals(other any) bool

func (*BitString) GetAppTag

func (b *BitString) GetAppTag() model.BACnetDataType

func (*BitString) GetValue

func (b *BitString) GetValue() []bool

func (*BitString) LowerThan

func (b *BitString) LowerThan(other any) bool

func (*BitString) String

func (b *BitString) String() string

type BitStringExtension

type BitStringExtension interface {
	fmt.Stringer
	GetBitNames() map[string]int
	GetBitLen() int
}

BitStringExtension can be used to inherit from BitString

type Boolean

type Boolean struct {
	*Atomic[int] //Note we need int as bool can't be used
	// contains filtered or unexported fields
}

func NewBoolean

func NewBoolean(arg Arg) (*Boolean, error)

func (*Boolean) Decode

func (b *Boolean) Decode(arg Arg) error

func (*Boolean) Encode

func (b *Boolean) Encode(arg Arg) error

func (*Boolean) GetAppTag

func (b *Boolean) GetAppTag() model.BACnetDataType

func (*Boolean) GetBoolValue

func (b *Boolean) GetBoolValue() bool

func (*Boolean) GetValue

func (b *Boolean) GetValue() int

GetValue gives an int value because bool can't be used in constraint. GA convenience method GetBoolValue exists.

func (*Boolean) IsValid

func (b *Boolean) IsValid(arg any) bool

func (*Boolean) String

func (b *Boolean) String() string

type CharacterString

type CharacterString struct {
	*Atomic[string]
	*CommonMath
	// contains filtered or unexported fields
}

func NewCharacterString

func NewCharacterString(arg Arg) (*CharacterString, error)

func (*CharacterString) Decode

func (c *CharacterString) Decode(arg Arg) error

func (*CharacterString) Encode

func (c *CharacterString) Encode(arg Arg) error

func (*CharacterString) GetAppTag

func (c *CharacterString) GetAppTag() model.BACnetDataType

func (*CharacterString) IsValid

func (c *CharacterString) IsValid(arg any) bool

func (*CharacterString) String

func (c *CharacterString) String() string

type ClosingTag

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

func NewClosingTag

func NewClosingTag(context Arg) (*ClosingTag, error)

func (ClosingTag) AppToContext

func (t ClosingTag) AppToContext(context uint) (*ContextTag, error)

func (ClosingTag) AppToObject

func (t ClosingTag) AppToObject() (any, error)

func (ClosingTag) ContextToApp

func (t ClosingTag) ContextToApp(dataType uint) (Tag, error)

func (ClosingTag) Decode

func (t ClosingTag) Decode(pdu PDUData) error

func (ClosingTag) Encode

func (t ClosingTag) Encode(pdu PDUData)

func (ClosingTag) Equals

func (t ClosingTag) Equals(other any) bool

func (ClosingTag) Format

func (t ClosingTag) Format(s fmt.State, v rune)

func (ClosingTag) GetTagClass

func (t ClosingTag) GetTagClass() readWriteModel.TagClass

func (ClosingTag) GetTagData

func (t ClosingTag) GetTagData() []byte

func (ClosingTag) GetTagLvt

func (t ClosingTag) GetTagLvt() int

func (ClosingTag) GetTagNumber

func (t ClosingTag) GetTagNumber() uint

func (ClosingTag) PrintDebugContents

func (t ClosingTag) PrintDebugContents(indent int, file io.Writer, _ids []uintptr)

type CommonMath

type CommonMath struct {
}

type ComparableAndOrdered

type ComparableAndOrdered interface {
	comparable
	cmp.Ordered
}

type ContextTag

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

func NewContextTag

func NewContextTag(args Args) (*ContextTag, error)

func (ContextTag) AppToContext

func (t ContextTag) AppToContext(context uint) (*ContextTag, error)

func (ContextTag) AppToObject

func (t ContextTag) AppToObject() (any, error)

func (ContextTag) ContextToApp

func (t ContextTag) ContextToApp(dataType uint) (Tag, error)

func (ContextTag) Decode

func (t ContextTag) Decode(pdu PDUData) error

func (ContextTag) Encode

func (t ContextTag) Encode(pdu PDUData)

func (ContextTag) Equals

func (t ContextTag) Equals(other any) bool

func (ContextTag) Format

func (t ContextTag) Format(s fmt.State, v rune)

func (ContextTag) GetTagClass

func (t ContextTag) GetTagClass() readWriteModel.TagClass

func (ContextTag) GetTagData

func (t ContextTag) GetTagData() []byte

func (ContextTag) GetTagLvt

func (t ContextTag) GetTagLvt() int

func (ContextTag) GetTagNumber

func (t ContextTag) GetTagNumber() uint

func (ContextTag) PrintDebugContents

func (t ContextTag) PrintDebugContents(indent int, file io.Writer, _ids []uintptr)

type Date

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

func NewDate

func NewDate(args Args) (*Date, error)

func (*Date) Coerce

func (d *Date) Coerce(arg Date) DateTuple

func (*Date) Compare

func (d *Date) Compare(other any) int

func (*Date) Decode

func (d *Date) Decode(arg Arg) error

func (*Date) Encode

func (d *Date) Encode(arg Arg) error

func (*Date) Equals

func (d *Date) Equals(other any) bool

func (*Date) GetAppTag

func (d *Date) GetAppTag() model.BACnetDataType

func (*Date) GetValue

func (d *Date) GetValue() DateTuple

func (*Date) IsValid

func (d *Date) IsValid(arg any) bool

func (*Date) LowerThan

func (d *Date) LowerThan(other any) bool

func (*Date) String

func (d *Date) String() string

type DateTuple

type DateTuple struct {
	Year      int
	Month     int
	Day       int
	DayOfWeek int
}

type Double

type Double struct {
	*Atomic[float64]
	*CommonMath
	// contains filtered or unexported fields
}

func NewDouble

func NewDouble(arg Arg) (*Double, error)

func (*Double) Decode

func (d *Double) Decode(arg Arg) error

func (*Double) Encode

func (d *Double) Encode(arg Arg) error

func (*Double) GetAppTag

func (d *Double) GetAppTag() model.BACnetDataType

func (*Double) IsValid

func (d *Double) IsValid(arg any) bool

func (*Double) String

func (d *Double) String() string

type Enumerated

type Enumerated struct {
	*Atomic[uint64]
	EnumeratedContract
	// contains filtered or unexported fields
}

func NewEnumerated

func NewEnumerated(args Args) (*Enumerated, error)

func (*Enumerated) Compare

func (e *Enumerated) Compare(other any) int

func (*Enumerated) Decode

func (e *Enumerated) Decode(arg Arg) error

func (*Enumerated) Encode

func (e *Enumerated) Encode(arg Arg) error

func (*Enumerated) GetAppTag

func (e *Enumerated) GetAppTag() model.BACnetDataType

func (*Enumerated) GetEnumerations

func (e *Enumerated) GetEnumerations() map[string]uint64

func (*Enumerated) GetItem

func (e *Enumerated) GetItem(item any) (result any, ok bool)

func (*Enumerated) GetLong

func (e *Enumerated) GetLong() uint64

func (*Enumerated) GetValueString

func (e *Enumerated) GetValueString() string

func (*Enumerated) GetXlateTable

func (e *Enumerated) GetXlateTable() map[any]any

func (*Enumerated) IsValid

func (e *Enumerated) IsValid(arg any) bool

func (*Enumerated) Keylist

func (e *Enumerated) Keylist() []string

func (*Enumerated) SetEnumerated

func (e *Enumerated) SetEnumerated(_ *Enumerated)

func (*Enumerated) String

func (e *Enumerated) String() string

type EnumeratedContract

type EnumeratedContract interface {
	GetEnumerations() map[string]uint64
	GetXlateTable() map[any]any
	// SetEnumerated is required because we do more stuff in the constructor and can't wait for the substruct to finish that
	SetEnumerated(enumerated *Enumerated)
}

EnumeratedContract provides a set of functions which can be overwritten by a sub struct

type Integer

type Integer struct {
	*Atomic[int32]
	*CommonMath
	// contains filtered or unexported fields
}

func NewInteger

func NewInteger(arg Arg) (*Integer, error)

func (*Integer) Decode

func (i *Integer) Decode(arg Arg) error

func (*Integer) Encode

func (i *Integer) Encode(arg Arg) error

func (*Integer) GetAppTag

func (i *Integer) GetAppTag() model.BACnetDataType

func (*Integer) IsValid

func (i *Integer) IsValid(arg any) bool

func (*Integer) String

func (i *Integer) String() string

type IsAtomic

type IsAtomic interface {
	// contains filtered or unexported methods
}

type Null

type Null struct {
	*Atomic[int]
	// contains filtered or unexported fields
}

func NewNull

func NewNull(arg Arg) (*Null, error)

func (*Null) Decode

func (n *Null) Decode(arg Arg) error

func (*Null) Encode

func (n *Null) Encode(arg Arg) error

func (*Null) GetAppTag

func (n *Null) GetAppTag() model.BACnetDataType

func (*Null) IsValid

func (n *Null) IsValid(arg any) bool

func (*Null) String

func (n *Null) String() string

type ObjectIdentifier

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

func NewObjectIdentifier

func NewObjectIdentifier(args Args) (*ObjectIdentifier, error)

func (*ObjectIdentifier) Coerce

func (*ObjectIdentifier) Compare

func (o *ObjectIdentifier) Compare(other any) int

func (*ObjectIdentifier) Decode

func (o *ObjectIdentifier) Decode(arg Arg) error

func (*ObjectIdentifier) Encode

func (o *ObjectIdentifier) Encode(arg Arg) error

func (*ObjectIdentifier) Equals

func (o *ObjectIdentifier) Equals(other any) bool

func (*ObjectIdentifier) GetAppTag

func (o *ObjectIdentifier) GetAppTag() model.BACnetDataType

func (*ObjectIdentifier) GetValue

func (*ObjectIdentifier) IsValid

func (o *ObjectIdentifier) IsValid(arg any) bool

func (*ObjectIdentifier) LowerThan

func (o *ObjectIdentifier) LowerThan(other any) bool

func (*ObjectIdentifier) String

func (o *ObjectIdentifier) String() string

type ObjectIdentifierTuple

type ObjectIdentifierTuple struct {
	Left  any
	Right int
}

type ObjectType

type ObjectType struct {
	*Enumerated
	// contains filtered or unexported fields
}

func NewObjectType

func NewObjectType(args Args) (*ObjectType, error)

func (*ObjectType) GetEnumerations

func (o *ObjectType) GetEnumerations() map[string]uint64

func (*ObjectType) SetEnumerated

func (o *ObjectType) SetEnumerated(enumerated *Enumerated)

func (*ObjectType) SetObjectType

func (o *ObjectType) SetObjectType(_ *ObjectType)

func (*ObjectType) String

func (o *ObjectType) String() string

type ObjectTypeContract

type ObjectTypeContract interface {
	EnumeratedContract
	// SetObjectType is required because we do more stuff in the constructor and can't wait for the substruct to finish that
	SetObjectType(objectType *ObjectType)
}

ObjectTypeContract provides a set of functions which can be overwritten by a sub struct

type OctetString

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

func NewOctetString

func NewOctetString(arg Arg) (*OctetString, error)

func (*OctetString) Compare

func (o *OctetString) Compare(other any) int

func (*OctetString) Decode

func (o *OctetString) Decode(arg Arg) error

func (*OctetString) Encode

func (o *OctetString) Encode(arg Arg) error

func (*OctetString) Equals

func (o *OctetString) Equals(other any) bool

func (*OctetString) GetAppTag

func (o *OctetString) GetAppTag() model.BACnetDataType

func (*OctetString) GetValue

func (o *OctetString) GetValue() []byte

func (*OctetString) IsValid

func (o *OctetString) IsValid(arg any) bool

func (*OctetString) LowerThan

func (o *OctetString) LowerThan(other any) bool

func (*OctetString) String

func (o *OctetString) String() string

type OpeningTag

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

func NewOpeningTag

func NewOpeningTag(context Arg) (*OpeningTag, error)

func (OpeningTag) AppToContext

func (t OpeningTag) AppToContext(context uint) (*ContextTag, error)

func (OpeningTag) AppToObject

func (t OpeningTag) AppToObject() (any, error)

func (OpeningTag) ContextToApp

func (t OpeningTag) ContextToApp(dataType uint) (Tag, error)

func (OpeningTag) Decode

func (t OpeningTag) Decode(pdu PDUData) error

func (OpeningTag) Encode

func (t OpeningTag) Encode(pdu PDUData)

func (OpeningTag) Equals

func (t OpeningTag) Equals(other any) bool

func (OpeningTag) Format

func (t OpeningTag) Format(s fmt.State, v rune)

func (OpeningTag) GetTagClass

func (t OpeningTag) GetTagClass() readWriteModel.TagClass

func (OpeningTag) GetTagData

func (t OpeningTag) GetTagData() []byte

func (OpeningTag) GetTagLvt

func (t OpeningTag) GetTagLvt() int

func (OpeningTag) GetTagNumber

func (t OpeningTag) GetTagNumber() uint

func (OpeningTag) PrintDebugContents

func (t OpeningTag) PrintDebugContents(indent int, file io.Writer, _ids []uintptr)

type Real

type Real struct {
	*Atomic[float32]
	*CommonMath
	// contains filtered or unexported fields
}

func NewReal

func NewReal(arg Arg) (*Real, error)

func (*Real) Decode

func (r *Real) Decode(arg Arg) error

func (*Real) Encode

func (r *Real) Encode(arg Arg) error

func (*Real) GetAppTag

func (r *Real) GetAppTag() model.BACnetDataType

func (*Real) IsValid

func (r *Real) IsValid(arg any) bool

func (*Real) String

func (r *Real) String() string

type Tag

type Tag interface {
	DebugContentPrinter
	GetTagClass() readWriteModel.TagClass
	GetTagNumber() uint
	GetTagLvt() int
	GetTagData() []byte
	Encode(pdu PDUData)
	Decode(pdu PDUData) error
	AppToObject() (any, error)
	AppToContext(context uint) (*ContextTag, error)
	ContextToApp(dataType uint) (Tag, error) // TODO: can't be ApplicationTag because boolean gets encoded as Tag???
	// contains filtered or unexported methods
}

func NewTag

func NewTag(args Args) (Tag, error)

type TagList

type TagList struct {
	*DefaultRFormatter
	// contains filtered or unexported fields
}

func NewTagList

func NewTagList(arg Arg) *TagList

func (*TagList) Append

func (b *TagList) Append(tag Tag)

func (*TagList) Decode

func (b *TagList) Decode(data PDUData) error

func (*TagList) Encode

func (b *TagList) Encode(data PDUData)

func (*TagList) Extend

func (b *TagList) Extend(tags ...Tag)

func (*TagList) GetContext

func (b *TagList) GetContext(context uint) (any, error)

GetContext Return a tag or a list of tags context encoded.

func (*TagList) GetTagList

func (b *TagList) GetTagList() []Tag

func (*TagList) Peek

func (b *TagList) Peek() Tag

func (*TagList) Pop

func (b *TagList) Pop() Tag

func (*TagList) PrintDebugContents

func (b *TagList) PrintDebugContents(indent int, file io.Writer, _ids []uintptr)

func (*TagList) Push

func (b *TagList) Push(tag Tag)

type Time

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

func NewTime

func NewTime(args Args) (*Time, error)

func (*Time) Coerce

func (t *Time) Coerce(arg Time) TimeTuple

func (*Time) Compare

func (t *Time) Compare(other any) int

func (*Time) Decode

func (t *Time) Decode(arg Arg) error

func (*Time) Encode

func (t *Time) Encode(arg Arg) error

func (*Time) Equals

func (t *Time) Equals(other any) bool

func (*Time) GetAppTag

func (t *Time) GetAppTag() model.BACnetDataType

func (*Time) GetValue

func (t *Time) GetValue() TimeTuple

func (*Time) IsValid

func (t *Time) IsValid(arg any) bool

func (*Time) LowerThan

func (t *Time) LowerThan(other any) bool

func (*Time) String

func (t *Time) String() string

type TimeTuple

type TimeTuple struct {
	Hour      int
	Minute    int
	Second    int
	Hundredth int
}

type Unsigned

type Unsigned struct {
	*Atomic[uint32]
	*CommonMath
	// contains filtered or unexported fields
}

func NewUnsigned

func NewUnsigned(arg Arg) (*Unsigned, error)

func (*Unsigned) Decode

func (u *Unsigned) Decode(arg Arg) error

func (*Unsigned) Encode

func (u *Unsigned) Encode(arg Arg) error

func (*Unsigned) GetAppTag

func (u *Unsigned) GetAppTag() readWriteModel.BACnetDataType

func (*Unsigned) IsValid

func (u *Unsigned) IsValid(arg any) bool

func (*Unsigned) String

func (u *Unsigned) String() string

type Unsigned16

type Unsigned16 struct {
	*Atomic[uint16]
	*CommonMath
	// contains filtered or unexported fields
}

func NewUnsigned16

func NewUnsigned16(arg Arg) (*Unsigned16, error)

func (*Unsigned16) Decode

func (u *Unsigned16) Decode(arg Arg) error

func (*Unsigned16) Encode

func (u *Unsigned16) Encode(arg Arg) error

func (*Unsigned16) GetAppTag

func (u *Unsigned16) GetAppTag() model.BACnetDataType

func (*Unsigned16) IsValid

func (u *Unsigned16) IsValid(arg any) bool

func (*Unsigned16) String

func (u *Unsigned16) String() string

type Unsigned8

type Unsigned8 struct {
	*Atomic[uint8]
	*CommonMath
	// contains filtered or unexported fields
}

func NewUnsigned8

func NewUnsigned8(arg Arg) (*Unsigned8, error)

func (*Unsigned8) Decode

func (u *Unsigned8) Decode(arg Arg) error

func (*Unsigned8) Encode

func (u *Unsigned8) Encode(arg Arg) error

func (*Unsigned8) GetAppTag

func (u *Unsigned8) GetAppTag() model.BACnetDataType

func (*Unsigned8) IsValid

func (u *Unsigned8) IsValid(arg any) bool

func (*Unsigned8) String

func (u *Unsigned8) String() string

Jump to

Keyboard shortcuts

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