forked from barnybug/go-cast
-
Notifications
You must be signed in to change notification settings - Fork 1
/
chromecast.go
39 lines (31 loc) · 815 Bytes
/
chromecast.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
package chromecast
import (
"context"
)
type Scanner interface {
// Scan scans for chromecast and pushes them onto the results channel (eventually multiple times)
// It must close the results channel before returning when the ctx is done
Scan(ctx context.Context, results chan<- *Device) error
}
type Envelope struct {
Source, Destination, Namespace string
}
type Serializer interface {
Receive() (Envelope, []byte, error)
Send(Envelope, []byte) error
}
type IdentifiablePayload interface {
SetRequestID(uint32)
}
type PayloadWithID struct {
Type string `json:"type"`
RequestID *uint32 `json:"requestId,omitempty"`
}
func (p *PayloadWithID) SetRequestID(id uint32) {
p.RequestID = &id
}
type AmpController interface {
Mute(muted bool) error
SetVolume(level float64) error
Quit() error
}