network

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: GPL-2.0 Imports: 11 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ObjectNil = errors.New("object list can not be empty")
)

Functions

This section is empty.

Types

type Device

type Device struct {
	Ip            string
	Port          int
	DeviceID      int
	NetworkNumber int
	MacMSTP       int
	MaxApdu       uint32
	Segmentation  uint32
	StoreID       string
	DeviceName    string
	VendorName    string
	// contains filtered or unexported fields
}

func NewDevice

func NewDevice(net *Network, device *Device) (*Device, error)

NewDevice returns a new instance of ta bacnet device

func (*Device) DeviceDiscover

func (device *Device) DeviceDiscover(options *bacnet.WhoIsOpts) ([]*Device, error)

func (*Device) DeviceObjects

func (device *Device) DeviceObjects(deviceID btypes.ObjectInstance, checkAPDU bool) (objectList []btypes.ObjectID, err error)

DeviceObjects get device objects

func (*Device) GetDeviceDetails

func (device *Device) GetDeviceDetails(deviceID btypes.ObjectInstance) (resp *DeviceDetails, err error)

GetDeviceDetails get the device name, max adpu and so on first read device and see what it supports and get the name and so on try and get the object list if it's an error then loop through the arrayIndex to build the object list

func (*Device) GetDevicePoints

func (device *Device) GetDevicePoints(deviceID btypes.ObjectInstance) (resp []*PointDetails, err error)

GetDevicePoints build a device points list first read device and see what it supports and get the name and so on try and get the object list if it's an error then loop through the arrayIndex to build the object list with the object list do a point's discovery, get the name, units and so on

func (*Device) PointDetails

func (device *Device) PointDetails(pnt *Point) (resp *PointDetails, err error)

PointDetails use this when wanting to read point name, units and so on

func (*Device) PointReadBool

func (device *Device) PointReadBool(pnt *Point) (uint32, error)

PointReadBool use this when wanting to read point values for an BI, BV, BO

func (*Device) PointReadFloat32

func (device *Device) PointReadFloat32(pnt *Point) (float32, error)

PointReadFloat32 use this when wanting to read point values for an AI, AV, AO

func (*Device) PointReadMultiState

func (device *Device) PointReadMultiState(pnt *Point) (uint32, error)

PointReadMultiState use this when wanting to read point values for an MI, MV, MO

func (*Device) PointReadPriority

func (device *Device) PointReadPriority(pnt *Point) (pri *priority.Float32, err error)

PointReadPriority use this when wanting to read point values for an AI, AV, AO

func (*Device) PointReleasePriority

func (device *Device) PointReleasePriority(pnt *Point, pri uint8) error

PointReleasePriority use this when releasing a priority

func (*Device) PointWriteAnalogue

func (device *Device) PointWriteAnalogue(pnt *Point, value float32) error

PointWriteAnalogue use this when wanting to write a new value for an AV, AO

func (*Device) PointWriteBool

func (device *Device) PointWriteBool(pnt *Point, value uint32) error

PointWriteBool use this when wanting to write a new value for an BV, AO

func (*Device) PointWriteMultiState

func (device *Device) PointWriteMultiState(pnt *Point, value uint32) error

PointWriteMultiState use this when wanting to write a new value for an MV, MO

func (*Device) Read

func (device *Device) Read(obj *Object) (out btypes.PropertyData, err error)

func (*Device) ReadDeviceName

func (device *Device) ReadDeviceName(ObjectID btypes.ObjectInstance) (string, error)

func (*Device) ReadPointName

func (device *Device) ReadPointName(pnt *Point) (string, error)

func (*Device) ReadString

func (device *Device) ReadString(obj *Object) (string, error)

ReadString to read a string like objectName

func (*Device) ToBitString

func (device *Device) ToBitString(d btypes.PropertyData) *btypes.BitString

func (*Device) Whois

func (device *Device) Whois(options *bacnet.WhoIsOpts) ([]btypes.Device, error)

func (*Device) Write

func (device *Device) Write(write *Write) error

func (*Device) WriteDeviceName

func (device *Device) WriteDeviceName(ObjectID btypes.ObjectInstance, value string) error

func (*Device) WritePointName

func (device *Device) WritePointName(pnt *Point, value string) error

type DeviceDetails

type DeviceDetails struct {
	Name                      string            `json:"name"`
	MaxApdu                   uint32            `json:"max_apdu"`
	VendorName                string            `json:"vendor_name"`
	Segmentation              uint32            `json:"segmentation"`
	ProtocolServicesSupported *btypes.BitString `json:"protocol_services_supported"`
}

type DevicePoints

type DevicePoints struct {
	Name                      string            `json:"name"`
	MaxApdu                   uint32            `json:"max_apdu"`
	VendorName                string            `json:"vendor_name"`
	Segmentation              uint32            `json:"segmentation"`
	ProtocolServicesSupported *btypes.BitString `json:"protocol_services_supported"`
}

type Network

type Network struct {
	Interface  string
	Ip         string
	Port       int
	SubnetCIDR int
	StoreID    string

	Store *Store
	// contains filtered or unexported fields
}

func New

func New(net *Network) (*Network, error)

New returns a new instance of bacnet network

func (*Network) GetDeviceDetails added in v0.1.2

func (net *Network) GetDeviceDetails(device btypes.Device) (resp *DeviceDetails, err error)

func (*Network) NetworkClose

func (net *Network) NetworkClose(closeLogs bool) error

func (*Network) NetworkDiscover added in v0.1.2

func (net *Network) NetworkDiscover(options *bacnet.WhoIsOpts) ([]btypes.Device, error)

func (*Network) NetworkRun

func (net *Network) NetworkRun()

func (*Network) Whois

func (net *Network) Whois(options *bacnet.WhoIsOpts) ([]btypes.Device, error)

type Object

type Object struct {
	ObjectID   btypes.ObjectInstance `json:"object_id"`
	ObjectType btypes.ObjectType     `json:"object_type"`
	Prop       btypes.PropertyType   `json:"prop"`
	ArrayIndex uint32                `json:"array_index"`
}

type Point

type Point struct {
	ObjectID         btypes.ObjectInstance `json:"object_id,omitempty"`
	ObjectType       btypes.ObjectType     `json:"object_type,omitempty"`
	WriteValue       interface{}
	WriteNull        bool
	WritePriority    uint8
	ReadPresentValue bool
	ReadPriority     bool
}

type PointDetails

type PointDetails struct {
	Name       string                `json:"name,omitempty"`
	Unit       uint32                `json:"unit,omitempty"`
	UnitString string                `json:"unit_string,omitempty"`
	ObjectID   btypes.ObjectInstance `json:"object_id,omitempty"`
	ObjectType btypes.ObjectType     `json:"object_type,omitempty"`
	PointType  string                `json:"point_type,omitempty"`
}

type Store

type Store struct {
	BacStore *store.Handler
}

func NewStore

func NewStore() *Store

func (*Store) GetDevice

func (store *Store) GetDevice(uuid string) (*Device, error)

func (*Store) GetNetwork

func (store *Store) GetNetwork(uuid string) (*Network, error)

func (*Store) NewNetwork added in v0.1.7

func (store *Store) NewNetwork(storeID, iface, ip string, port, subnet int) error

NewNetwork updated a cached

func (*Store) UpdateDevice

func (store *Store) UpdateDevice(storeID string, net *Network, device *Device) error

UpdateDevice updated a cached device

type Write

type Write struct {
	ObjectID      btypes.ObjectInstance
	ObjectType    btypes.ObjectType
	Prop          btypes.PropertyType
	WriteValue    interface{}
	WriteNull     bool
	WritePriority uint8
}

Jump to

Keyboard shortcuts

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