encoding

package
v0.0.0-...-25d832f Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppDataTypeMismatch

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

func (AppDataTypeMismatch) Error

func (e AppDataTypeMismatch) Error() string

type Decoder

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

Decoder is the struct used to turn byte arrays to bacnet types. All public methods of decoder can set the internal error value. If such error is set, all decoding methods will be no-ops. This allows to defer error checking after several decoding operations

func NewDecoder

func NewDecoder(b []byte) *Decoder

func (*Decoder) AppData

func (d *Decoder) AppData(v interface{})

AppData read the next tag and value. The value type advertised in tag must be a standard bacnet application data type and must match the type passed in the v parameter. If no error is returned, v will contain the data read

func (*Decoder) ContextAbstractType

func (d *Decoder) ContextAbstractType(expectedTagNumber byte, v interface{})

func (*Decoder) ContextObjectID

func (d *Decoder) ContextObjectID(expectedTagID byte, objectID *bacnet.ObjectID)

ContextObjectID read a (context)tag / value pair where the value type is an unsigned int If ErrorIncorrectTag is set, the internal buffer cursor is ready to read again the same tag.

func (*Decoder) ContextValue

func (d *Decoder) ContextValue(expectedTagID byte, val *uint32)

ContextValue reads the next context tag/value couple and set val accordingly. Sets the decoder error if the tagID isn't the expected or if the tag isn't contextual. If ErrorIncorrectTag is set, the internal buffer cursor is ready to read again the same tag.

func (*Decoder) Error

func (d *Decoder) Error() error

func (*Decoder) ResetError

func (d *Decoder) ResetError()

type Encoder

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

Encoder is the struct used to turn bacnet types to byte arrays. All public methods of encoder can set the internal error value. If such error is set, all encoding methods will be no-ops. This allows to defer error checking after several encoding operations

func NewEncoder

func NewEncoder() Encoder

func (*Encoder) AppData

func (e *Encoder) AppData(v interface{})

AppData writes a tag and value of any standard bacnet application data type. Returns an error if v if of a invalid type

func (*Encoder) Bytes

func (e *Encoder) Bytes() []byte

func (*Encoder) ContextAsbtractType

func (e *Encoder) ContextAsbtractType(tabNumber byte, v bacnet.PropertyValue)

func (*Encoder) ContextObjectID

func (e *Encoder) ContextObjectID(tabNumber byte, objectID bacnet.ObjectID)

ContextObjectID write a (context)tag / value pair where the value type is an unsigned int

func (*Encoder) ContextUnsigned

func (e *Encoder) ContextUnsigned(tabNumber byte, value uint32)

ContextUnsigned write a (context)tag / value pair where the value type is an unsigned int

func (*Encoder) Error

func (e *Encoder) Error() error

type ErrorIncorrectTagID

type ErrorIncorrectTagID struct {
	Expected byte
	Got      byte
}

ErrorIncorrectTagID is the error return when the decoded tag doesn't have the expected ID

func (ErrorIncorrectTagID) Error

func (e ErrorIncorrectTagID) Error() string

Jump to

Keyboard shortcuts

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