bacnet

package
v0.0.2-0...-59a517f Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: Apache-2.0, ISC, MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VLC_TYPE_IP               byte = 0x81
	VLC_FUNCTION_UNICAST_NPDU byte = 0x0a
)

VLC Header constants

View Source
const (
	NPDU_VERSION_ASHRAE_135_1995 byte = 0x01
	NPDU_FLAG_EXPECTING_RESPONSE byte = 0x04
)

NPDU header constant

View Source
const (
	MAX_BACNET_FRAME_LEN = 1476
)
View Source
const (
	SERVER_CHOICE_READ_PROPERTY byte = 0x0c
)

APDU Server Choice constants

Variables

This section is empty.

Functions

func ReadVLC

func ReadVLC(c net.Conn) (vlc *VLC, npdu *NPDU, apdu *APDU, leftovers []byte, err error, isBACNet bool)

func SendVLC

func SendVLC(c net.Conn, payload []byte) error

Types

type APDU

type APDU struct {
	TypeAndFlags byte              `json:"type_and_flags"`
	SegmentSizes SegmentParameters `json:"segment_sizes"`
	InvokeID     byte              `json:"invoke_id"`
	ServerChoice byte              `json:"server_choice"`
}

func (*APDU) Marshal

func (apdu *APDU) Marshal() ([]byte, error)

Marshal encodes a full APDU to binary

func (*APDU) Unmarshal

func (apdu *APDU) Unmarshal(b []byte) (out []byte, err error)

Unmarshal decodes a full APDU from binary

type Frame

type Frame struct {
	VLC     *VLC        `json:"vlc,omitempty"`
	NPDU    *NPDU       `json:"npdu,omitempty"`
	APDU    *APDU       `json:"apdu,omitempty"`
	Payload interface{} `json:"payload,omitempty"`
}

type Log

type Log struct {
	IsBACNet                    bool   `json:"is_bacnet"`
	InstanceNumber              uint32 `json:"instance_number"`
	VendorID                    uint16 `json:"vendor_id"`
	VendorName                  string `json:"vendor_name,omitempty"`
	FirmwareRevision            string `json:"firmware_revision,omitempty"`
	ApplicationSoftwareRevision string `json:"application_software_revision,omitempty"`
	ObjectName                  string `json:"object_name,omitempty"`
	ModelName                   string `json:"model_name,omitempty"`
	Description                 string `json:"description,omitempty"`
	Location                    string `json:"location,omitempty"`
}

func (*Log) QueryApplicationSoftwareRevision

func (log *Log) QueryApplicationSoftwareRevision(c net.Conn) (err error)

func (*Log) QueryDescription

func (log *Log) QueryDescription(c net.Conn) (err error)

func (*Log) QueryDeviceID

func (log *Log) QueryDeviceID(c net.Conn) (err error)

func (*Log) QueryFirmwareRevision

func (log *Log) QueryFirmwareRevision(c net.Conn) (err error)

func (*Log) QueryLocation

func (log *Log) QueryLocation(c net.Conn) (err error)

func (*Log) QueryModelName

func (log *Log) QueryModelName(c net.Conn) (err error)

func (*Log) QueryObjectName

func (log *Log) QueryObjectName(c net.Conn) (err error)

func (*Log) QueryVendorName

func (log *Log) QueryVendorName(c net.Conn) (err error)

func (*Log) QueryVendorNumber

func (log *Log) QueryVendorNumber(c net.Conn) (err error)

type NPDU

type NPDU struct {
	Version byte
	Control byte
}

func (*NPDU) Marshal

func (npdu *NPDU) Marshal() ([]byte, error)

Marshal encodes an NPDU header to binary

func (*NPDU) Unmarshal

func (npdu *NPDU) Unmarshal(b []byte) ([]byte, error)

Unmarshal decodes an NPDU header from binary

type ObjectID

type ObjectID uint32
const (
	OID_ANY ObjectID = 0x023fffff
)

type PropertyID

type PropertyID byte
const (
	PID_OID                           PropertyID = 75
	PID_VENDOR_NUMBER                 PropertyID = 0x78
	PID_VENDOR_NAME                   PropertyID = 0x79
	PID_FIRMWARE_REVISION             PropertyID = 0x2c
	PID_APPLICATION_SOFTWARE_REVISION PropertyID = 0x0c
	PID_OBJECT_NAME                   PropertyID = 0x4d
	PID_MODEL_NAME                    PropertyID = 0x46
	PID_DESCRIPTION                   PropertyID = 0x1c
	PID_LOCATION                      PropertyID = 0x3a
)

type ReadProperty

type ReadProperty struct {
	Object   ObjectID   `json:"object"`
	Property PropertyID `json:"property"`
}

func (*ReadProperty) Marshal

func (rp *ReadProperty) Marshal() ([]byte, error)

func (*ReadProperty) Unmarshal

func (rp *ReadProperty) Unmarshal(b []byte) (leftovers []byte, err error)

type ReadPropertyRequest

type ReadPropertyRequest struct {
	NPDU      NPDU         `json:"npdu"`
	APDU      APDU         `json:"apdu"`
	Selection ReadProperty `json:"read_property"`
}

func NewReadPropertyRequest

func NewReadPropertyRequest(oid ObjectID, pid PropertyID) *ReadPropertyRequest

func (*ReadPropertyRequest) Marshal

func (rp *ReadPropertyRequest) Marshal() (out []byte, err error)

type SegmentParameters

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

type VLC

type VLC struct {
	Type     byte
	Function byte
	Length   uint16
}

func (*VLC) Marshal

func (vlc *VLC) Marshal() ([]byte, error)

Marshal encodes a VLC header to binary

func (*VLC) Unmarshal

func (vlc *VLC) Unmarshal(b []byte) ([]byte, error)

Unmarshal decodes a VLC header from binary

Jump to

Keyboard shortcuts

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