-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinterface.go
142 lines (119 loc) · 2.19 KB
/
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
package zcl
import (
"net"
)
type Transport interface {
Send(Packet) error
SetPermitJoin(time uint8) error
NWKAddr() (uint16, error)
IEEEAddr() (Zuid, error)
}
type InArg interface {
MarshalZcl() ([]byte, error)
}
type OutArg interface {
UnmarshalZcl([]byte) ([]byte, error)
}
type Val interface {
InArg
OutArg
}
type ScaledArg interface {
Scaled() float64
}
type EnumArg interface {
SingleOptions() []Option
}
type BitmapArg interface {
MultiOptions() []Option
}
type Command interface {
General
Arguments() []ArgDesc
Cluster() ClusterID
Required() bool
MnfCode() uint16
}
type General interface {
Val
Values() []Val
ID() CommandID
Name() string
String() string
Direction() Direction
Handle(frame ReceivedZclFrame, handler interface{}) (response General, found bool, err error)
}
type ZdoCommand interface {
Val
Arguments() []ArgDesc
Cluster() ClusterID
Values() []Val
ID() ZdoCmdID
Name() string
String() string
Handle(frame ReceivedZdpFrame, handler interface{}) (response ZdoCommand, found bool, err error)
}
type ZclHandler interface {
HandleZcl(ReceivedZclFrame) (response ZclFrame, err error)
}
type ZdpHandler interface {
HandleZdp(ReceivedZdpFrame) (response ZdpFrame, err error)
}
type Handler interface {
ZclHandler
ZdpHandler
}
type receivedCommon interface {
SrcAddr() Address
LQI() uint8
RSSI() int8
}
type zdpCommon interface {
SeqNo() uint8
Command() ZdoCmdID
Payload() []byte
}
type zclCommon interface {
SeqNo() uint8
CommandType() CommandType
Direction() Direction
Manufacturer() uint16
DisableDefaultResponse() bool
Command() CommandID
Payload() []byte
}
type Packet interface {
SrcEP() uint8
DstEP() uint8
DstAddr() Address
Profile() ProfileID
Cluster() ClusterID
Data() []byte
}
type ReceivedPacket interface {
Packet
receivedCommon
}
type ZdpFrame interface {
Packet
zdpCommon
}
type ReceivedZdpFrame interface {
ZdpFrame
receivedCommon
Response(cmd ZdoCommand) (ZdpFrame, error)
}
type ZclFrame interface {
Packet
zclCommon
}
type ReceivedZclFrame interface {
ZclFrame
receivedCommon
Response(srcEp uint8, cmd General) (ZclFrame, error)
}
type Address interface {
Mode() AddressMode
NWK() uint16
IEEE() net.HardwareAddr
}