Documentation
¶
Overview ¶
Package bacnet 实现北向 BACnet Server,以从机模式对外暴露 EdgeX 点位数据。 BACnet Server 将南向设备的点位映射为 BACnet 标准对象(AnalogInput/BinaryInput等), 支持 Who-Is/I-Am 设备发现、ReadProperty/WriteProperty 属性读写和 COV 订阅通知。
Index ¶
- type BatchWriteResult
- type Server
- func (s *Server) BatchWrite(requests []WriteRequest) []BatchWriteResult
- func (s *Server) GetStats() Stats
- func (s *Server) GetWriteHistory(limit int) []WriteHistoryItem
- func (s *Server) IsRunning() bool
- func (s *Server) Start() error
- func (s *Server) Stop()
- func (s *Server) SyncAddressSpace() error
- func (s *Server) Update(v model.Value)
- func (s *Server) UpdateConfig(cfg model.BACnetServerConfig) error
- func (s *Server) WriteViaBACnet(channelID, deviceID, pointID string, value any) error
- type Stats
- type WriteHistoryItem
- type WriteRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchWriteResult ¶
type BatchWriteResult struct {
ChannelID string `json:"channel_id"`
DeviceID string `json:"device_id"`
PointID string `json:"point_id"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
}
BatchWriteResult 批量写入结果
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server 是 BACnet Server 的核心实现,将 EdgeX 南向设备和点位映射为 BACnet 对象。 遵循 OPC UA Server 的架构模式:Start/Stop 生命周期管理、Update 数据流、SyncAddressSpace 热更新。
func NewServer ¶
func NewServer(cfg model.BACnetServerConfig, sb model.SouthboundManager) *Server
NewServer 创建新的 BACnet Server
func (*Server) BatchWrite ¶
func (s *Server) BatchWrite(requests []WriteRequest) []BatchWriteResult
BatchWrite 批量写入
func (*Server) GetWriteHistory ¶
func (s *Server) GetWriteHistory(limit int) []WriteHistoryItem
GetWriteHistory 获取写入历史
func (*Server) SyncAddressSpace ¶
SyncAddressSpace 同步地址空间,不停 TCP 监听器(热更新)
func (*Server) UpdateConfig ¶
func (s *Server) UpdateConfig(cfg model.BACnetServerConfig) error
UpdateConfig 更新配置。端口/IP/DeviceID 等结构性变更需要重启,设备映射变更可热更新。
type Stats ¶
type Stats struct {
ObjectCount int `json:"object_count"` // BACnet 对象总数
PointCount int `json:"point_count"` // 已映射点位总数
WriteCount int64 `json:"write_count"` // 外部写入次数
UpdateCount int64 `json:"update_count"` // 南向数据更新次数
LastWriteTime time.Time `json:"last_write_time"` // 最近一次外部写入时间
StartTime time.Time `json:"start_time"` // 服务启动时间
}
Stats 统计信息
type WriteHistoryItem ¶
type WriteHistoryItem struct {
Time time.Time `json:"time"`
ChannelID string `json:"channel_id"`
DeviceID string `json:"device_id"`
PointID string `json:"point_id"`
Value any `json:"value"`
Success bool `json:"success"`
Error string `json:"error,omitempty"`
}
WriteHistoryItem 写入历史记录
Click to show internal directories.
Click to hide internal directories.