-
Notifications
You must be signed in to change notification settings - Fork 2
/
zda_interface.go
46 lines (36 loc) · 1.12 KB
/
zda_interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package zda
import (
"github.com/shimmeringbee/da"
"github.com/shimmeringbee/logwrap"
"github.com/shimmeringbee/zcl"
"github.com/shimmeringbee/zcl/communicator"
"github.com/shimmeringbee/zda/attribute"
"github.com/shimmeringbee/zda/implcaps"
"github.com/shimmeringbee/zigbee"
)
var _ implcaps.ZDAInterface = (*zdaInterface)(nil)
type zdaInterface struct {
gw *ZDA
c communicator.Communicator
}
func (z zdaInterface) NodeBinder() zigbee.NodeBinder {
return z.gw.provider
}
func (z zdaInterface) Logger() logwrap.Logger {
return z.gw.logger
}
func (z zdaInterface) ZCLRegister(f func(*zcl.CommandRegistry)) {
f(z.gw.zclCommandRegistry)
}
func (z zdaInterface) TransmissionLookup(d da.Device, id zigbee.ProfileID) (zigbee.IEEEAddress, zigbee.Endpoint, bool, uint8) {
return z.gw.transmissionLookup(d, id)
}
func (z zdaInterface) ZCLCommunicator() communicator.Communicator {
return z.c
}
func (z zdaInterface) NewAttributeMonitor() attribute.Monitor {
return attribute.NewMonitor(z.gw.zclCommunicator, z.gw.provider, z.gw.transmissionLookup, z.gw.logger)
}
func (z zdaInterface) SendEvent(a any) {
z.gw.sendEvent(a)
}