Documentation
¶
Index ¶
- Constants
- func NewBACnetDriver() drv.Driver
- type BACnetDriver
- func (d *BACnetDriver) Connect(ctx context.Context) error
- func (d *BACnetDriver) Disconnect() error
- func (d *BACnetDriver) GetConnectionMetrics() (connectionSeconds int64, reconnectCount int64, localAddr string, ...)
- func (d *BACnetDriver) GetMetrics() model.ChannelMetrics
- func (d *BACnetDriver) Health() drv.HealthStatus
- func (d *BACnetDriver) Init(config model.DriverConfig) error
- func (d *BACnetDriver) ReadPoints(ctx context.Context, points []model.Point) (map[string]model.Value, error)
- func (d *BACnetDriver) Scan(ctx context.Context, params map[string]any) (any, error)
- func (d *BACnetDriver) ScanObjects(ctx context.Context, config map[string]any) (any, error)
- func (d *BACnetDriver) SetBACnetAddressNotifier(notifier drv.BACnetAddressNotifier)
- func (d *BACnetDriver) SetDeviceConfig(config map[string]any) error
- func (d *BACnetDriver) SetSlaveID(slaveID uint8) error
- func (d *BACnetDriver) WritePoint(ctx context.Context, point model.Point, value any) error
- type Client
- type ClientBuilder
- type DeviceConfig
- type DeviceContext
- type ObjectResult
- type PointRuntime
- type PointScheduler
- type PointWriteRequest
- type ScanResult
- type SetBroadcastType
- type WhoIsOpts
Constants ¶
View Source
const ( DeviceStateOnline = 0 DeviceStateUnstable = 1 DeviceStateOffline = 2 DeviceStateIsolated = 3 )
View Source
const ArrayAll = 0xFFFFFFFF
ArrayAll is used when reading/writing to a property to read/write the entire array
Variables ¶
This section is empty.
Functions ¶
func NewBACnetDriver ¶
Types ¶
type BACnetDriver ¶
type BACnetDriver struct {
// contains filtered or unexported fields
}
func (*BACnetDriver) Disconnect ¶
func (d *BACnetDriver) Disconnect() error
func (*BACnetDriver) GetConnectionMetrics ¶
func (*BACnetDriver) GetMetrics ¶
func (d *BACnetDriver) GetMetrics() model.ChannelMetrics
GetMetrics 返回BACnet驱动的详细指标
func (*BACnetDriver) Health ¶
func (d *BACnetDriver) Health() drv.HealthStatus
func (*BACnetDriver) Init ¶
func (d *BACnetDriver) Init(config model.DriverConfig) error
func (*BACnetDriver) ReadPoints ¶
func (*BACnetDriver) Scan ¶
Scan performs a device discovery (WhoIs) and optionally reads device details
func (*BACnetDriver) ScanObjects ¶
ScanObjects implements ObjectScanner interface
func (*BACnetDriver) SetBACnetAddressNotifier ¶ added in v0.0.7
func (d *BACnetDriver) SetBACnetAddressNotifier(notifier drv.BACnetAddressNotifier)
func (*BACnetDriver) SetDeviceConfig ¶
func (d *BACnetDriver) SetDeviceConfig(config map[string]any) error
func (*BACnetDriver) SetSlaveID ¶
func (d *BACnetDriver) SetSlaveID(slaveID uint8) error
func (*BACnetDriver) WritePoint ¶
type Client ¶
type Client interface {
io.Closer
IsRunning() bool
ClientRun()
WhoIs(wh *WhoIsOpts) ([]btypes.Device, error)
WhatIsNetworkNumber() []*btypes.Address
IAm(dest btypes.Address, iam btypes.IAm) error
WhoIsRouterToNetwork() (resp *[]btypes.Address)
Objects(dev btypes.Device) (btypes.Device, error)
ReadProperty(dest btypes.Device, rp btypes.PropertyData) (btypes.PropertyData, error)
ReadMultiProperty(dev btypes.Device, rp btypes.MultiplePropertyData) (btypes.MultiplePropertyData, error)
ReadPropertyWithTimeout(dest btypes.Device, rp btypes.PropertyData, timeout time.Duration) (btypes.PropertyData, error)
ReadMultiPropertyWithTimeout(dev btypes.Device, rp btypes.MultiplePropertyData, timeout time.Duration) (btypes.MultiplePropertyData, error)
WriteProperty(dest btypes.Device, wp btypes.PropertyData) error
WriteMultiProperty(dev btypes.Device, wp btypes.MultiplePropertyData) error
}
func NewClient ¶
func NewClient(cb *ClientBuilder) (Client, error)
NewClient creates a new client with the given interface and
type ClientBuilder ¶
type DeviceConfig ¶
type DeviceContext ¶
type DeviceContext struct {
Device btypes.Device
Scheduler *PointScheduler
Config DeviceConfig
DeviceKey string
LastDiscovery time.Time
State int
ConsecutiveFailures int
IsolationUntil time.Time
IsolationCount int
LastValues map[string]model.Value
CacheMu sync.RWMutex
ReadMu sync.Mutex
// contains filtered or unexported fields
}
type ObjectResult ¶
type ObjectResult struct {
Type string `json:"type"`
Instance int `json:"instance"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Units string `json:"units,omitempty"`
PresentValue any `json:"present_value,omitempty"`
StatusFlags string `json:"status_flags,omitempty"`
Reliability string `json:"reliability,omitempty"`
DiffStatus string `json:"diff_status"` // new, existing, removed
}
type PointRuntime ¶
type PointRuntime struct {
Point model.Point
FailCount int
LastSuccess time.Time
State string // OK, SKIPPED
CooldownUntil time.Time
}
PointRuntime Runtime state of a point
type PointScheduler ¶
type PointScheduler struct {
// contains filtered or unexported fields
}
PointScheduler implements the scheduling logic for BACnet points
func NewPointScheduler ¶
func (*PointScheduler) Write ¶
func (s *PointScheduler) Write(ctx context.Context, writes []PointWriteRequest) error
type PointWriteRequest ¶
PointWriteRequest represents a request to write a value to a point
type ScanResult ¶
type ScanResult struct {
DeviceID int `json:"device_id"`
IP string `json:"ip"`
Port int `json:"port"`
Network uint16 `json:"network_number"`
VendorID uint32 `json:"vendor_id"`
VendorName string `json:"vendor_name"`
ModelName string `json:"model_name"`
ObjectName string `json:"object_name"`
MaxAPDU uint32 `json:"max_apdu"`
Segmentation uint32 `json:"segmentation"`
Status string `json:"status"`
DiffStatus string `json:"diff_status,omitempty"` // new, existing
}
type SetBroadcastType ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.