-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
62 lines (49 loc) · 1.02 KB
/
types.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
package main
type Channel interface {
Number() int
Frequency() float32
Power() float32
Modulation() int
SNR() float32
BER() float32
}
type ChannelData struct {
channel int `json:"channel"`
frequency float32 `json:"frequency"`
power float32 `json:"power"`
snr float32 `json:"snr"`
ber float32 `json:"ber"`
modulation int `json:"modulation"`
}
func (c *ChannelData) Number() int {
return c.channel
}
func (c *ChannelData) Frequency() float32 {
return c.frequency
}
func (c *ChannelData) Power() float32 {
return c.power
}
func (c *ChannelData) Modulation() int {
return c.modulation
}
func (c *ChannelData) SNR() float32 {
return c.snr
}
func (c *ChannelData) BER() float32 {
return c.ber
}
type Channels []Channel
func (c Channels) Len() int {
return len(c)
}
func (c Channels) Less(i, j int) bool {
return c[i].Number() < c[j].Number()
}
func (c Channels) Swap(i, j int) {
c[i], c[j] = c[j], c[i]
}
type SignalsData struct {
ForwardSignals Channels
ReturnSignals Channels
}