bacnet

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 15 Imported by: 0

README

Documentation

BACnet Protocol Stack

A Go implementation of the BACnet/IP protocol stack for building automation and control systems.

Features

  • BACnet/IP Protocol: Full support for BACnet/IP communication
  • Device Discovery: Who-Is and I-Am services for network device discovery
  • Object Access: ReadProperty, ReadMultipleProperty, WriteProperty, WriteMultipleProperty
  • Network Management: What-Is-Network-Number, Who-Is-Router-To-Network
  • Transaction Management: TSM (Transaction State Machine) for confirmed services
  • Concurrency: Thread-safe design with connection pooling

Installation

go get github.com/anviod/bacnet

Quick Start

Basic Device Discovery

package main

import (
    "fmt"
    "log"
    
    "github.com/anviod/bacnet"
    "github.com/anviod/bacnet/btypes"
)

func main() {
    // Create a BACnet client
    client, err := bacnet.NewClient(&bacnet.ClientBuilder{
        Ip:         "192.168.1.100",
        SubnetCIDR: 24,
        Port:       47808, // Default BACnet port (0xBAC0)
    })
    if err != nil {
        log.Fatal(err)
    }
    defer client.Close()

    // Start the client message loop
    go client.ClientRun()

    // Discover all devices on the network
    devices, err := client.WhoIs(&bacnet.WhoIsOpts{
        Low:  0,
        High: 4194304, // Max BACnet device ID
    })
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf("Discovered %d devices\n", len(devices))
    for _, dev := range devices {
        fmt.Printf("Device ID: %d, IP: %s:%d\n", dev.DeviceID, dev.Ip, dev.Port)
    }
}

Data Collection Flow (采集流程)

The BACnet data collection process consists of six key steps:

Step 1: Client Initialization

Before any communication can occur, a BACnet client must be created with appropriate network configuration.

client, err := bacnet.NewClient(&bacnet.ClientBuilder{
    Ip:         "192.168.1.100",  // Local IP address
    SubnetCIDR: 24,                // Subnet mask (e.g., /24)
    Port:       47808,             // BACnet port (default: 47808)
})
if err != nil {
    log.Fatal(err)
}
defer client.Close()

Configuration Options:

  • Ip: Local IP address to bind to
  • Interface: Network interface name (alternative to Ip)
  • SubnetCIDR: Subnet CIDR notation (e.g., 24 for 255.255.255.0)
  • Port: BACnet UDP port (default: 47808 = 0xBAC0)
  • MaxPDU: Maximum PDU size (default: 1476)

Step 2: Start Message Loop

The client message loop must be started in a goroutine to handle incoming messages:

go client.ClientRun()

Important Notes:

  • Must be called before making any requests
  • Runs continuously until the client is closed
  • Handles message decoding and routing

Step 3: Device Discovery (WhoIs)

Discover BACnet devices on the network using the WhoIs service:

devices, err := client.WhoIs(&bacnet.WhoIsOpts{
    Low:  0,             // Device ID lower bound
    High: 4194304,       // Device ID upper bound (max)
})

Discovery Options:

  • Low: Lower bound of device ID range (0 to 4194304)
  • High: Upper bound of device ID range
  • GlobalBroadcast: Use global broadcast address (0xFFFF)
  • Destination: Specific target address for unicast discovery

Best Practices:

  • Use narrow ID ranges for targeted discovery to reduce network traffic
  • Avoid using full range (0-4194304) on large networks
  • Cache discovered devices to avoid repeated discovery

Step 4: Object Discovery

Retrieve all objects from a discovered device:

scannedDevice, err := client.Objects(devices[0])
if err != nil {
    log.Printf("Failed to scan objects: %v", err)
    return
}

// Access specific object types
aiObjects := scannedDevice.Objects[btypes.AnalogInput]
biObjects := scannedDevice.Objects[btypes.BinaryInput]
aoObjects := scannedDevice.Objects[btypes.AnalogOutput]
boObjects := scannedDevice.Objects[btypes.BinaryOutput]

Supported Object Types:

  • AnalogInput (0): Analog input points (e.g., temperature sensors)
  • AnalogOutput (1): Analog output points (e.g., valves, dampers)
  • AnalogValue (2): Analog value objects
  • BinaryInput (3): Binary input points (e.g., contact sensors)
  • BinaryOutput (4): Binary output points (e.g., relays)
  • BinaryValue (5): Binary value objects
  • Device (8): BACnet device objects
  • MultiStateInput (13): Multi-state input points
  • MultiStateOutput (14): Multi-state output points
  • TrendLog (20): Trend log objects

Step 5: Data Reading

Read property values from device objects.

Read Single Property
result, err := client.ReadProperty(device, btypes.PropertyData{
    Object: btypes.Object{
        ID: btypes.ObjectID{
            Type:     btypes.AnalogInput,
            Instance: 1,
        },
        Properties: []btypes.Property{
            {
                Type:       btypes.PropPresentValue,
                ArrayIndex: btypes.ArrayAll,
            },
        },
    },
})
Read Multiple Properties (Batch)

For better performance, use ReadMultiProperty to read multiple properties in one request:

result, err := client.ReadMultiProperty(device, btypes.MultiplePropertyData{
    Objects: []btypes.Object{
        {
            ID: btypes.ObjectID{Type: btypes.AnalogInput, Instance: 1},
            Properties: []btypes.Property{
                {Type: btypes.PropPresentValue},
                {Type: btypes.PropUnits},
                {Type: btypes.PropDescription},
            },
        },
        {
            ID: btypes.ObjectID{Type: btypes.AnalogInput, Instance: 2},
            Properties: []btypes.Property{
                {Type: btypes.PropPresentValue},
            },
        },
    },
})

Common Properties:

  • PropPresentValue (85): Current value of the object
  • PropUnits (117): Engineering units
  • PropDescription (28): Object description
  • PropObjectName (77): Object name
  • PropObjectType (79): Object type
  • PropObjectIdentifier (75): Object identifier
  • PropObjectList (76): List of objects in device

Step 6: Data Writing

Write values to device objects.

err := client.WriteProperty(device, btypes.PropertyData{
    Object: btypes.Object{
        ID: btypes.ObjectID{
            Type:     btypes.AnalogOutput,
            Instance: 1,
        },
        Properties: []btypes.Property{
            {
                Type:       btypes.PropPresentValue,
                ArrayIndex: btypes.ArrayAll,
                Data:       float64(25.5),
                Priority:   btypes.Normal,
            },
        },
    },
})

Write Priority Levels:

  • LifeSafety (3): Life safety operations
  • CriticalEquipment (2): Critical equipment control
  • Urgent (1): Urgent operations
  • Normal (0): Normal operations

Advanced Usage

Complete Integration Flow

func completeIntegration(client bacnet.Client) error {
    // Step 1: Discover devices
    devices, err := client.WhoIs(&bacnet.WhoIsOpts{
        Low:  0,
        High: 4194304,
    })
    if err != nil {
        return fmt.Errorf("whois failed: %v", err)
    }
    if len(devices) == 0 {
        return fmt.Errorf("no devices found")
    }

    device := devices[0]
    fmt.Printf("Found device: ID=%d, IP=%s:%d\n", device.DeviceID, device.Ip, device.Port)

    // Step 2: Scan objects
    scannedDevice, err := client.Objects(device)
    if err != nil {
        return fmt.Errorf("object scan failed: %v", err)
    }

    // Step 3: Find target point
    aiObjects := scannedDevice.Objects[btypes.AnalogInput]
    targetPoint, ok := aiObjects[1]
    if !ok {
        return fmt.Errorf("target point not found")
    }
    fmt.Printf("Found target point: %s\n", targetPoint.Name)

    // Step 4: Read present value
    result, err := client.ReadProperty(device, btypes.PropertyData{
        Object: btypes.Object{
            ID: btypes.ObjectID{
                Type:     btypes.AnalogInput,
                Instance: 1,
            },
            Properties: []btypes.Property{
                {Type: btypes.PropPresentValue},
            },
        },
    })
    if err != nil {
        return fmt.Errorf("read property failed: %v", err)
    }
    fmt.Printf("Present Value: %v\n", result.Object.Properties[0].Data)

    // Step 5: Write to AnalogValue
    writeErr := client.WriteProperty(device, btypes.PropertyData{
        Object: btypes.Object{
            ID: btypes.ObjectID{
                Type:     btypes.AnalogValue,
                Instance: 1,
            },
            Properties: []btypes.Property{
                {
                    Type:       btypes.PropPresentValue,
                    ArrayIndex: btypes.ArrayAll,
                    Data:       float64(25.5),
                    Priority:   btypes.Normal,
                },
            },
        },
    })
    if writeErr != nil {
        return fmt.Errorf("write property failed: %v", writeErr)
    }
    fmt.Println("Write successful")

    return nil
}

Read with Timeout

Use timeout variants for better control over request timing:

result, err := client.ReadPropertyWithTimeout(device, propertyData, 5*time.Second)

Error Handling Patterns

func safeReadProperty(client bacnet.Client, device btypes.Device, objID btypes.ObjectID) (interface{}, error) {
    result, err := client.ReadProperty(device, btypes.PropertyData{
        Object: btypes.Object{
            ID: objID,
            Properties: []btypes.Property{
                {Type: btypes.PropPresentValue},
            },
        },
    })
    
    if err != nil {
        // Handle specific error types
        if strings.Contains(err.Error(), "timeout") {
            return nil, fmt.Errorf("device %d did not respond", device.DeviceID)
        }
        if strings.Contains(err.Error(), "no such object") {
            return nil, fmt.Errorf("object %s not found", objID.Type)
        }
        return nil, err
    }
    
    if len(result.Object.Properties) == 0 {
        return nil, fmt.Errorf("no properties returned")
    }
    
    return result.Object.Properties[0].Data, nil
}

API Reference

Client Interface

type Client interface {
    io.Closer
    IsRunning() bool
    ClientRun()
    
    // Device Discovery
    WhoIs(wh *WhoIsOpts) ([]btypes.Device, error)
    IAm(dest btypes.Address, iam btypes.IAm) error
    
    // Network Management
    WhatIsNetworkNumber() []*btypes.Address
    WhoIsRouterToNetwork() (resp *[]btypes.Address)
    
    // Object Access
    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)
    WriteProperty(dest btypes.Device, wp btypes.PropertyData) error
    WriteMultiProperty(dev btypes.Device, wp btypes.MultiplePropertyData) error
    
    // Timeout variants
    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)
}

WhoIs Options

type WhoIsOpts struct {
    Low             int             // Device ID lower bound (0 to 4194304)
    High            int             // Device ID upper bound
    GlobalBroadcast bool            // Use global broadcast (0xFFFF)
    NetworkNumber   uint16          // Target network number
    Destination     *btypes.Address // Specific destination (optional)
}

Configuration

ClientBuilder Options

type ClientBuilder struct {
    DataLink   datalink.DataLink // Custom data link (optional)
    Interface  string            // Network interface name (e.g., "eth0")
    Ip         string            // IP address
    Port       int               // BACnet port (default: 47808)
    SubnetCIDR int               // Subnet CIDR (e.g., 24 for /24)
    MaxPDU     uint16            // Maximum PDU size (default: 1476)
}

Constants

// Protocol
const DefaultPort = 0xBAC0 // 47808
const MaxAPDU = 1476

// Network
const GlobalBroadcast = 0xFFFF
const DefaultHopCount = 255

// Priorities
const (
    LifeSafety        = 3
    CriticalEquipment = 2
    Urgent            = 1
    Normal            = 0
)

Best Practices & Recommendations

Network Considerations

  1. Port Binding:

    • Default BACnet port is 47808 (0xBAC0)
    • Use different ports for testing to avoid conflicts
    • Bind to 0.0.0.0 to listen on all interfaces
  2. IP Address Binding:

    • Avoid binding to the target device's IP address
    • For multi-subnet environments, configure subnet CIDR properly
  3. Broadcast Behavior:

    • WhoIs uses broadcast by default
    • Use Destination for unicast requests
    • Broadcast may not work across VLANs or subnets

Performance Optimization

  1. Batch Operations:

    • Use ReadMultiProperty for reading multiple properties
    • Reduce network round-trips
    • Limit batch size based on device's MaxAPDU setting
  2. Concurrency:

    • Client is thread-safe for concurrent operations
    • TSM limits concurrent confirmed transactions (default: 10)
    • Consider rate limiting for high-frequency operations
  3. Memory Management:

    • Use buffer pool for efficient memory usage
    • Release resources promptly with client.Close()

Error Handling

  1. Timeout Handling:

    • Use ReadPropertyWithTimeout for explicit timeout control
    • Confirmed services include retry logic with exponential backoff
    • Implement application-level retry for critical operations
  2. Common Errors:

    • timeout: Device did not respond within timeout
    • invalid argument: Invalid object type or property ID
    • no such object: Requested object does not exist
    • access denied: Insufficient permissions for write operations

Common Issues & Troubleshooting

Issue 1: No Devices Discovered

Possible Causes:

  • Incorrect IP address or subnet configuration
  • Firewall blocking BACnet port (47808)
  • Devices on different VLAN/subnet
  • Client not running (ClientRun() not called)

Solutions:

  • Verify network configuration
  • Check firewall rules
  • Use Wireshark to monitor BACnet traffic
  • Ensure ClientRun() is called before WhoIs()

Issue 2: ReadProperty Fails with Timeout

Possible Causes:

  • Device not responding
  • Incorrect device address
  • Network connectivity issues
  • Device busy or overloaded

Solutions:

  • Verify device is reachable via ping
  • Check device address (some devices use different ports for confirmed services)
  • Increase timeout value
  • Implement retry logic

Issue 3: WriteProperty Returns "Access Denied"

Possible Causes:

  • Insufficient permissions
  • Write protection enabled on device
  • Incorrect priority level

Solutions:

  • Check device configuration for write permissions
  • Verify priority level (use appropriate priority)
  • Contact device manufacturer for access rights

Issue 4: High Network Traffic

Possible Causes:

  • Frequent WhoIs requests with full ID range
  • Large batch operations exceeding MTU
  • Broadcast storms

Solutions:

  • Use targeted WhoIs with narrow ID ranges
  • Limit batch size to stay within MaxAPDU
  • Implement device discovery caching

Testing

# Run all tests
go test ./...

# Run specific test
go test -v ./network/...

# Run acceptance tests
go test -v -run Acceptance

# Run real device integration test
go test . -run TestRealDeviceAcceptanceFlow -count=1 -v

License

MIT License

References

Documentation

Overview

Package bacnet provides a Go implementation of the BACnet/IP protocol stack for building automation and control systems.

BACnet (Building Automation and Control Networks) is a data communication protocol for building automation and control systems. It is designed to facilitate communication between different devices and systems in buildings, such as HVAC, lighting, security, and fire safety systems.

This package implements the following BACnet services:

Confirmed Services: - ReadProperty (12) - ReadPropertyMultiple (14) - WriteProperty (15) - WritePropertyMultiple (16)

Unconfirmed Services: - IAm (0) - WhoIs (8)

Key Features: - Full BACnet/IP protocol support - Device discovery (WhoIs/IAm) - Object access (ReadProperty, WriteProperty) - Transaction management with TSM (Transaction State Machine) - Thread-safe design with connection pooling - Support for multiple network interfaces

Data Collection Flow: The typical data collection process involves the following steps:

  1. Client Initialization: Create a BACnet client with appropriate network configuration (IP address, subnet, port).
  1. Device Discovery: Use WhoIs service to discover all BACnet devices on the network. This sends a broadcast message to which all devices respond with their device ID and network address.
  1. Object Discovery: Once devices are discovered, use Objects() method to retrieve all objects from a specific device. This includes Analog Inputs, Binary Inputs, Analog Outputs, Binary Outputs, and other object types.
  1. Data Reading: Use ReadProperty() to read individual property values or ReadMultiProperty() to read multiple properties in a single request.
  1. Data Writing: Use WriteProperty() or WriteMultiProperty() to write values to device objects.

6. Cleanup: Always close the client when done to release resources.

Example Usage:

// Create client
client, err := bacnet.NewClient(&bacnet.ClientBuilder{
    Ip:         "192.168.1.100",
    SubnetCIDR: 24,
    Port:       47808,
})
if err != nil {
    log.Fatal(err)
}
defer client.Close()

// Start message loop
go client.ClientRun()

// Discover devices
devices, err := client.WhoIs(&bacnet.WhoIsOpts{
    Low:  0,
    High: 4194304,
})

// Read property from device
result, err := client.ReadProperty(device, btypes.PropertyData{
    Object: btypes.Object{
        ID: btypes.ObjectID{
            Type:     btypes.AnalogInput,
            Instance: 1,
        },
        Properties: []btypes.Property{
            {Type: btypes.PropPresentValue},
        },
    },
})

For more detailed information, see the README.md file.

中文说明: BACnet(楼宇自动化和控制网络)是用于楼宇自动化和控制系统的数据通信协议。 它旨在促进楼宇中不同设备和系统之间的通信,如暖通空调(HVAC)、照明、安全和消防系统。

数据采集流程: 典型的数据采集过程包括以下步骤:

1. 客户端初始化:使用适当的网络配置创建BACnet客户端(IP地址、子网、端口)。

  1. 设备发现:使用WhoIs服务发现网络上的所有BACnet设备。这会发送广播消息, 所有设备都会响应其设备ID和网络地址。
  1. 对象发现:发现设备后,使用Objects()方法从特定设备检索所有对象。 包括模拟输入、二进制输入、模拟输出、二进制输出等对象类型。
  1. 数据读取:使用ReadProperty()读取单个属性值,或使用ReadMultiProperty() 在单个请求中读取多个属性。

5. 数据写入:使用WriteProperty()或WriteMultiProperty()向设备对象写入值。

6. 清理:完成操作后始终关闭客户端以释放资源。

参考文档: - ANSI/ASHRAE Standard 135-2020 - http://www.bacnet.org/

Index

Constants

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

This section is empty.

Types

type Client

type Client interface {
	io.Closer
	// IsRunning returns true if the client message loop is running.
	// IsRunning 返回客户端消息循环是否正在运行。
	IsRunning() bool
	// ClientRun starts the client message loop. This should be called in a goroutine.
	// ClientRun 启动客户端消息循环,应在 goroutine 中调用。
	ClientRun()
	// WhoIs discovers BACnet devices on the network within the specified device ID range.
	// It sends a broadcast WhoIs request and collects IAm responses from devices.
	// Returns a list of discovered devices.
	// WhoIs 发现网络上指定设备ID范围内的BACnet设备。
	// 发送广播 WhoIs 请求并收集设备的 IAm 响应。
	// 返回发现的设备列表。
	WhoIs(wh *WhoIsOpts) ([]btypes.Device, error)
	// WhatIsNetworkNumber determines the network number of the local BACnet network.
	// Returns a list of addresses that responded to the What-Is-Network-Number request.
	// WhatIsNetworkNumber 确定本地BACnet网络的网络号。
	// 返回响应 What-Is-Network-Number 请求的地址列表。
	WhatIsNetworkNumber() []*btypes.Address
	// IAm sends an IAm response to the specified destination.
	// This is typically used to respond to WhoIs requests from other devices.
	// IAm 向指定目标发送 IAm 响应。
	// 通常用于响应其他设备的 WhoIs 请求。
	IAm(dest btypes.Address, iam btypes.IAm) error
	// WhoIsRouterToNetwork discovers routers on the BACnet network.
	// Returns a list of router addresses.
	// WhoIsRouterToNetwork 发现BACnet网络上的路由器。
	// 返回路由器地址列表。
	WhoIsRouterToNetwork() (resp *[]btypes.Address)
	// Objects retrieves all objects from a BACnet device.
	// This includes AnalogInput, AnalogOutput, BinaryInput, BinaryOutput, and other object types.
	// Returns a Device structure containing all discovered objects.
	// Objects 从BACnet设备检索所有对象。
	// 包括模拟输入、模拟输出、二进制输入、二进制输出等对象类型。
	// 返回包含所有发现对象的 Device 结构。
	Objects(dev btypes.Device) (btypes.Device, error)
	// ReadProperty reads a single property from a BACnet device object.
	// Returns the PropertyData containing the read property value.
	// ReadProperty 从BACnet设备对象读取单个属性。
	// 返回包含读取属性值的 PropertyData。
	ReadProperty(dest btypes.Device, rp btypes.PropertyData) (btypes.PropertyData, error)
	// ReadMultiProperty reads multiple properties from multiple objects in a single request.
	// This is more efficient than multiple ReadProperty calls.
	// Returns the MultiplePropertyData containing all read property values.
	// ReadMultiProperty 在单个请求中从多个对象读取多个属性。
	// 这比多次调用 ReadProperty 更高效。
	// 返回包含所有读取属性值的 MultiplePropertyData。
	ReadMultiProperty(dev btypes.Device, rp btypes.MultiplePropertyData) (btypes.MultiplePropertyData, error)
	// ReadPropertyWithTimeout reads a single property with a specified timeout.
	// This allows for more granular timeout control than the default timeout.
	// ReadPropertyWithTimeout 使用指定超时读取单个属性。
	// 允许比默认超时更精细的超时控制。
	ReadPropertyWithTimeout(dest btypes.Device, rp btypes.PropertyData, timeout time.Duration) (btypes.PropertyData, error)
	// ReadMultiPropertyWithTimeout reads multiple properties with a specified timeout.
	// ReadMultiPropertyWithTimeout 使用指定超时读取多个属性。
	ReadMultiPropertyWithTimeout(dev btypes.Device, rp btypes.MultiplePropertyData, timeout time.Duration) (btypes.MultiplePropertyData, error)
	// WriteProperty writes a single property to a BACnet device object.
	// Returns an error if the write operation fails.
	// WriteProperty 向BACnet设备对象写入单个属性。
	// 如果写入操作失败返回错误。
	WriteProperty(dest btypes.Device, wp btypes.PropertyData) error
	// WriteMultiProperty writes multiple properties to multiple objects in a single request.
	// This is more efficient than multiple WriteProperty calls.
	// WriteMultiProperty 在单个请求中向多个对象写入多个属性。
	// 这比多次调用 WriteProperty 更高效。
	WriteMultiProperty(dev btypes.Device, wp btypes.MultiplePropertyData) error
}

Client defines the interface for BACnet client operations. It provides methods for device discovery, object access, and network management. All methods are thread-safe and can be called concurrently from multiple goroutines.

中文说明:Client 定义了 BACnet 客户端操作的接口。 它提供设备发现、对象访问和网络管理的方法。 所有方法都是线程安全的,可以从多个 goroutine 并发调用。

func NewClient

func NewClient(cb *ClientBuilder) (Client, error)

NewClient creates a new BACnet client with the provided configuration. It validates the configuration, creates the data link layer, initializes the Transaction State Machine (TSM), and sets up the unconfirmed transaction manager (UTSM).

Parameters:

cb - ClientBuilder containing the client configuration

Returns:

A new Client instance and any error encountered during initialization.

中文说明:NewClient 使用提供的配置创建新的 BACnet 客户端。 它验证配置,创建数据链路层,初始化事务状态机(TSM), 并设置非确认事务管理器(UTSM)。

参数:

cb - 包含客户端配置的 ClientBuilder

返回:

新的 Client 实例和初始化期间遇到的任何错误。

type ClientBuilder

type ClientBuilder struct {
	DataLink   datalink.DataLink // Custom data link implementation (optional)
	Interface  string            // Network interface name (e.g., "eth0")
	Ip         string            // IP address to bind to
	Port       int               // BACnet port (default: 47808)
	SubnetCIDR int               // Subnet CIDR (e.g., 24 for /24)
	MaxPDU     uint16            // Maximum PDU size (default: 1476)
}

ClientBuilder is used to configure and create a new BACnet client. All fields are optional with sensible defaults.

中文说明:ClientBuilder 用于配置和创建新的 BACnet 客户端。 所有字段都是可选的,有合理的默认值。

type SetBroadcastType

type SetBroadcastType struct {
	Set     bool           // Whether to override the default behavior
	BacFunc btypes.BacFunc // The function type to set
}

SetBroadcastType is used to override the BVLC header function type. This allows forcing a specific broadcast/unicast behavior.

中文说明:SetBroadcastType 用于覆盖 BVLC 头部函数类型。 允许强制特定的广播/单播行为。

type WhoIsOpts

type WhoIsOpts struct {
	Low             int             `json:"low"`              // Lower bound of device ID range (0 to 4194304)
	High            int             `json:"high"`             // Upper bound of device ID range
	GlobalBroadcast bool            `json:"global_broadcast"` // Use global broadcast (0xFFFF)
	NetworkNumber   uint16          `json:"network_number"`   // Target network number
	Destination     *btypes.Address `json:"-"`                // Specific destination address (optional)
}

WhoIsOpts contains options for the WhoIs device discovery request.

中文说明:WhoIsOpts 包含 WhoIs 设备发现请求的选项。

Jump to

Keyboard shortcuts

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