Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Comm ¶
type Comm struct { IP *netip.AddrPort `json:"ip,omitempty"` // the destination BACnet network // this is used if the target BACnet device is not IP, but being proxied through a BACnet IP router // see: http://www.bacnetwiki.com/wiki/index.php?title=Network_Layer_Protocol_Data_Unit Destination *Destination `json:"destination,omitempty"` }
type Destination ¶
type Destination struct { // Network is the Destination Network 1-65534, or 65535 for broadcast // http://www.bacnetwiki.com/wiki/index.php?title=Destination_Network Network uint16 `json:"network,omitempty"` // Address is in dot-notation when multiple octets // could be upto 18, but in practice 6 or less // http://www.bacnetwiki.com/wiki/index.php?title=MAC_Layer_Address Address DestinationAddress `json:"address,omitempty"` }
Destination representation BACnet NPDU destination settings see: http://www.bacnetwiki.com/wiki/index.php?title=Network_Layer_Protocol_Data_Unit
type DestinationAddress ¶
type DestinationAddress string
func (DestinationAddress) Bytes ¶
func (d DestinationAddress) Bytes() ([]byte, error)
type Device ¶
type Device struct { Name string `json:"name,omitempty"` Title string `json:"title,omitempty"` Comm *Comm `json:"comm,omitempty"` ID bactypes.ObjectInstance `json:"id,omitempty"` COV *COV `json:"cov,omitempty"` // Metadata applied to any traits sharing this devices name. Metadata *traits.Metadata `json:"metadata,omitempty"` DiscoverObjects *bool `json:"discoverObjects,omitempty"` Objects []Object `json:"objects,omitempty"` DefaultWritePriority uint `json:"defaultWritePriority,omitempty"` }
type DeviceRef ¶
type DeviceRef struct {
// contains filtered or unexported fields
}
func NewDeviceRef ¶
func NewDeviceRefID ¶
func NewDeviceRefID(id bactypes.ObjectInstance) *DeviceRef
func (DeviceRef) MarshalJSON ¶
func (*DeviceRef) UnmarshalJSON ¶
type Object ¶
type Object struct { ID ObjectID `json:"id"` Name string `json:"name,omitempty"` Title string `json:"title,omitempty"` COV *COV `json:"COV,omitempty"` Trait trait.Name `json:"trait,omitempty"` Metadata *traits.Metadata `json:"metadata,omitempty"` // applied to any traits created from this object Priorities []Priority `json:"priorities,omitempty"` Properties []Property `json:"properties,omitempty"` }
type ObjectID ¶
func ObjectIDFromString ¶
func (ObjectID) MarshalJSON ¶
func (*ObjectID) UnmarshalJSON ¶
type ObjectRef ¶
type ObjectRef struct {
// contains filtered or unexported fields
}
func NewObjectRef ¶
func NewObjectRefID ¶
func (ObjectRef) MarshalJSON ¶
func (*ObjectRef) UnmarshalJSON ¶
type Property ¶
type Property struct { Name string `json:"name,omitempty"` ID PropertyID `json:"id,omitempty"` }
type PropertyID ¶
func (PropertyID) MarshalJSON ¶
func (p PropertyID) MarshalJSON() ([]byte, error)
func (PropertyID) String ¶
func (p PropertyID) String() string
func (*PropertyID) UnmarshalJSON ¶
func (p *PropertyID) UnmarshalJSON(bytes []byte) error
type RawTrait ¶
type RawTrait struct { Trait Raw json.RawMessage `json:"-"` }
func (*RawTrait) MarshalJSON ¶
func (*RawTrait) UnmarshalJSON ¶
type Root ¶
type Root struct { driver.BaseConfig LocalInterface string `json:"localInterface,omitempty"` LocalPort uint16 `json:"localPort,omitempty"` MaxConcurrentTransactions uint8 `json:"maxConcurrentTransactions,omitempty"` Discovery *Discovery `json:"discovery,omitempty"` ForceDiscovery bool `json:"forceDiscovery,omitempty"` IncludeDiscoveredDevices bool `json:"includeDiscoveredDevices,omitempty"` DeviceNamePrefix string `json:"deviceNamePrefix"` // defaults to "bacnet/device/" if absent in json or using Defaults ObjectNamePrefix string `json:"objectNamePrefix"` // defaults to "obj/" if absent in json, or using Defaults DiscoverObjects bool `json:"discoverObjects,omitempty"` COV *COV `json:"cov,omitempty"` // Metadata is applied to all announced names. Metadata *traits.Metadata `json:"metadata,omitempty"` Devices []Device `json:"devices,omitempty"` Traits []RawTrait `json:"traits,omitempty"` }
Root represents a full collection of related configuration properties
type Trait ¶
type Trait struct { Name string `json:"name,omitempty"` Kind trait.Name `json:"kind,omitempty"` Metadata *traits.Metadata `json:"metadata,omitempty"` // poll period used to poll the objects for pull updates // defaults to 10s PollPeriod *Duration `json:"pollPeriod,omitempty"` // how long to wait when running a poll for it to respond. Defaults to PollPeriod. PollTimeout *Duration `json:"pollTimeout,omitempty"` // When reading multiple properties, split the properties into chunks of this size and execute in parallel. // 0 means do not chunk. ChunkSize int `json:"chunkSize,omitempty"` }
Trait is the common configuration for bacnet device traits. Specific implementations that pull objects together into a trait should embed this type into their specific config types.
type OnOffConfig struct { Trait Value *ValueSource `json:"value,omitempty"` }
func (*Trait) PollPeriodDuration ¶
func (*Trait) PollTimeoutDuration ¶
type ValueSource ¶
type ValueSource struct { Device *DeviceRef `json:"device,omitempty"` Object *ObjectRef `json:"object,omitempty"` Property *PropertyID `json:"property,omitempty"` // used for converting simple units like kW -> W. // The value from the source will be multiplied by Scale when reading, and divided when writing. // For example if the trait is in watts and the device is in kW then Scale should be 1000 (aka kilo). Scale float64 `json:"scale,omitempty"` }
ValueSource configures a single object property as the source of some trait value.
func (ValueSource) Lookup ¶
func (vs ValueSource) Lookup(ctx known.Context) (bactypes.Device, bactypes.Object, property.ID, error)
Lookup finds the gobacnet device, object, and property this ValueSource refers to.
func (ValueSource) Scaled ¶
func (vs ValueSource) Scaled(v any) any
Scaled returns v scaled by the Scale factor. If vs.Scale is 0 or v is not a number then v is returned unchanged.