pdu

package
v0.0.0-...-a6dc647 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CombinedPattern = regexp.MustCompile(`^(?:(?:([0-9]+)|([*])):)?(?:([*])|` + _field_address.String() + `|` + _ip_address_mask_port.String() + `)` + _at_route.String() + `$`)

Functions

func NewPCI

func NewPCI(args Args, kwArgs KWArgs, options ...Option) *_PCI

func PackIpAddr

func PackIpAddr(addrTuple *AddressTuple[string, uint16]) (octetString []byte)

PackIpAddr Given an IP address tuple like ('1.2.3.4', 47808) return the six-octet string useful for a BACnet address.

func Uint16ToPort

func Uint16ToPort(number uint16) []byte

Types

type Address

type Address struct {
	AddrType    AddressType
	AddrNet     *uint16
	AddrAddress []byte
	AddrLen     *uint8
	AddrRoute   *Address

	AddrIP             *uint32
	AddrMask           *uint32
	AddrHost           *uint32
	AddrSubnet         *uint32
	AddrPort           *uint16
	AddrTuple          *AddressTuple[string, uint16]
	AddrBroadcastTuple *AddressTuple[string, uint16]
	// contains filtered or unexported fields
}

func NewAddress

func NewAddress(args Args) (*Address, error)

func NewGlobalBroadcast

func NewGlobalBroadcast(route *Address) *Address

TODO: convert to struct

func NewLocalBroadcast

func NewLocalBroadcast(route *Address) *Address

func NewLocalStation

func NewLocalStation(addr any, route *Address) (*Address, error)

TODO: convert to struct

func NewRemoteBroadcast

func NewRemoteBroadcast(net uint16, route *Address) *Address

TODO: convert to struct

func NewRemoteStation

func NewRemoteStation(net *uint16, addr any, route *Address) (*Address, error)

TODO: convert to struct

func (*Address) AlternateString

func (a *Address) AlternateString() (string, bool)

func (*Address) DeepCopy

func (a *Address) DeepCopy() any

func (*Address) Equals

func (a *Address) Equals(other any) bool

func (*Address) Format

func (a *Address) Format(s fmt.State, v rune)

func (*Address) Serialize

func (d *Address) Serialize() ([]byte, error)

func (*Address) SerializeWithWriteBuffer

func (d *Address) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*Address) String

func (d *Address) String() string

type AddressTuple

type AddressTuple[L any, R any] struct {
	Left  L
	Right R
}

func NewAddressTuple

func NewAddressTuple[L any, R any](l L, r R) *AddressTuple[L, R]

func UnpackIpAddr

func UnpackIpAddr(addr []byte) (addrTuple *AddressTuple[string, uint16])

UnpackIpAddr Given a six-octet BACnet address, return an IP address tuple.

func (*AddressTuple[L, R]) DeepCopy

func (a *AddressTuple[L, R]) DeepCopy() any

func (*AddressTuple[L, R]) Format

func (a *AddressTuple[L, R]) Format(s fmt.State, v rune)

func (*AddressTuple[L, R]) String

func (a *AddressTuple[L, R]) String() string

type AddressType

type AddressType int
const (
	NULL_ADDRESS AddressType = iota
	LOCAL_BROADCAST_ADDRESS
	LOCAL_STATION_ADDRESS
	REMOTE_BROADCAST_ADDRESS
	REMOTE_STATION_ADDRESS
	GLOBAL_BROADCAST_ADDRESS
)

func (AddressType) String

func (a AddressType) String() string

type IPCI

type IPCI interface {
	spi.Message
	GetLeafName() string
	SetRootMessage(spi.Message)
	GetRootMessage() spi.Message
	SetPDUUserData(spi.Message)
	GetPDUUserData() spi.Message
	GetPDUSource() *Address
	SetPDUSource(*Address)
	GetPDUDestination() *Address
	SetPDUDestination(*Address)
	Update(pci Arg) error
	DeepCopy() any
}

type PCI

type PCI interface {
	IPCI

	SetExpectingReply(bool)
	GetExpectingReply() bool
	SetNetworkPriority(model.NPDUNetworkPriority)
	GetNetworkPriority() model.NPDUNetworkPriority

	GetPCI() PCI
}

type PDU

type PDU interface {
	PCI
	PDUData
	DeepCopy() any
}

func NewPDU

func NewPDU(args Args, kwArgs KWArgs, options ...Option) PDU

type PDUData

type PDUData interface {
	Copyable
	SetPduData([]byte)
	GetPduData() []byte
	Get() (byte, error)
	GetShort() (int16, error)
	GetLong() (int64, error)
	GetData(dlen int) ([]byte, error)
	Put(byte)
	PutData(...byte)
	PutShort(uint16)
	PutLong(uint32)
}

func NewPDUData

func NewPDUData(args Args, kwArgs KWArgs, _ ...Option) PDUData

Jump to

Keyboard shortcuts

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