-
Notifications
You must be signed in to change notification settings - Fork 0
/
modem.go
65 lines (55 loc) · 1.56 KB
/
modem.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
package modemscrape
import "time"
type Modem interface {
GetStats() ([]UpstreamChannel, []DownstreamChannel, []UpstreamOFDMChannel, []DownstreamOFDMChannel, error)
}
// LoggableModem should be implemented for modems that can retrieve logs in a syslog-like format as defined in this
// package.
type LoggableModem interface {
// GetLogs should return all logs created since the last run of this function for an implementing modem.
GetLogs() ([]Log, error)
}
type Output interface {
PutStats([]UpstreamChannel, []DownstreamChannel, []UpstreamOFDMChannel, []DownstreamOFDMChannel) error
}
type LogOutput interface {
PutLogs([]Log) error
}
type UpstreamChannel struct {
Locked bool
Modulation string
BondedChannelID int
Frequency int64
Power float64
}
type DownstreamChannel struct {
Locked bool // if this isn't set, many other values may also not be set
Modulation string
BondedChannelID int
Frequency int64
Power float64
SNR float64
CorrectableWords int64
UncorrectableWords int64
}
type UpstreamOFDMChannel struct {
Locked bool
BondedChannelID int
Frequency int64
Power float64
}
type DownstreamOFDMChannel struct {
Locked bool
BondedChannelID int
Frequency int64
Power float64
SNR float64
CorrectableWords int64
UncorrectableWords int64
}
type Log struct {
SeverityCode int // should match syslog, which is netgear - 1
Severity string
Timestamp time.Time
Message string
}