message

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeviceIdentifier

type DeviceIdentifier struct {
	IEEEAddr [8]byte
	NwkAddr  uint16
}

DeviceIdentifier identifies the source of a message.

type EventBus

type EventBus interface {
	Publish(ctx context.Context, event interface{}) error
}

EventBus interface for event publishing.

type Listener

type Listener struct {
	// contains filtered or unexported fields
}

Listener continuously listens for incoming Zigbee messages. It parses messages and updates the state manager accordingly.

func NewListener

func NewListener(adapter ZNPClient, manager *state.Manager, eventBus EventBus, timeout time.Duration, logger *slog.Logger) *Listener

NewListener creates a new message listener.

func (*Listener) Start

func (l *Listener) Start(ctx context.Context) error

Start begins listening for incoming messages. This blocks until the context is canceled.

type ParsedMessage

type ParsedMessage struct {
	Source      *DeviceIdentifier
	ClusterID   uint16
	Endpoint    uint8
	CommandID   uint8
	TransSeqNum uint8
	Attributes  []adapter.ReportedAttribute
	Error       error
}

ParsedMessage represents a parsed ZCL message from a device.

type Parser

type Parser struct {
}

Parser parses ZCL messages and extracts device state updates.

func NewParser

func NewParser() *Parser

NewParser creates a new message parser.

func (*Parser) Parse

func (p *Parser) Parse(msg *znp.IncomingMessage) *ParsedMessage

Parse parses an incoming ZCL message and returns the parsed result.

type ZNPClient

type ZNPClient interface {
	WaitForIncomingMsg(ctx context.Context, srcAddr uint16, clusterID uint16, timeout time.Duration) (*znp.IncomingMessage, error)
}

ZNPClient interface for ZNP operations. Extracted to allow mocking in tests.

Jump to

Keyboard shortcuts

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