forked from brutella/hc
/
handler.go
35 lines (29 loc) · 872 Bytes
/
handler.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
package netio
import (
"github.com/brutella/hc/util"
"io"
"net"
"net/url"
)
// A ContainerHandler abstracts request/response communication
type ContainerHandler interface {
Handle(util.Container) (util.Container, error)
}
// A PairVerifyHandler is a ContainerHandler which negotations a shared key.
type PairVerifyHandler interface {
ContainerHandler
SharedKey() [32]byte
}
// A AccessoriesHandler returns a list of accessories as json.
type AccessoriesHandler interface {
HandleGetAccessories(r io.Reader) (io.Reader, error)
}
// A CharacteristicsHandler handles get and update characteristic.
type CharacteristicsHandler interface {
HandleGetCharacteristics(url.Values) (io.Reader, error)
HandleUpdateCharacteristics(io.Reader, net.Conn) error
}
// IdentifyHandler calls Identify() on accessories.
type IdentifyHandler interface {
IdentifyAccessory()
}