Skip to content

Commit

Permalink
devices: rename 802.11n and 802.11ac radios to 2.4GHz and 5GHz for ac…
Browse files Browse the repository at this point in the history
…curacy
  • Loading branch information
mdlayher committed Mar 2, 2016
1 parent 45904d8 commit c9d38d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ const (
radioNA = "na"
radioNG = "ng"

radio80211ac = "802.11ac"
radio80211n = "802.11n"
radio5GHz = "5GHz"
radio24GHz = "2.4GHz"
)

// UnmarshalJSON unmarshals the raw JSON representation of a Device.
Expand Down Expand Up @@ -144,19 +144,19 @@ func (d *Device) UnmarshalJSON(b []byte) error {
Name: rt.Name,
}

// 802.11ac and 802.11n station counts appear in different keys for
// 5GHz and 2.4GHz station counts appear in different keys for
// different radio types, so we check the radio type first to determine
// where the correct radio statistics are
switch rt.Radio {
case radioNA:
r.Radio = radio80211ac
r.Radio = radio5GHz
r.Stats = &RadioStationsStats{
NumberStations: dev.NaNumSta,
NumberUserStations: dev.NaUserNumSta,
NumberGuestStations: dev.NaGuestNumSta,
}
case radioNG:
r.Radio = radio80211n
r.Radio = radio24GHz
r.Stats = &RadioStationsStats{
NumberStations: dev.NgNumSta,
NumberUserStations: dev.NgUserNumSta,
Expand Down
4 changes: 2 additions & 2 deletions devices_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func TestDeviceUnmarshalJSON(t *testing.T) {
MaxTXPower: 10,
MinTXPower: 1,
Name: "wlan0",
Radio: radio80211n,
Radio: radio24GHz,
Stats: &RadioStationsStats{
NumberStations: 3,
NumberUserStations: 2,
Expand All @@ -206,7 +206,7 @@ func TestDeviceUnmarshalJSON(t *testing.T) {
MaxTXPower: 10,
MinTXPower: 1,
Name: "wlan1",
Radio: radio80211ac,
Radio: radio5GHz,
Stats: &RadioStationsStats{
NumberStations: 3,
NumberUserStations: 2,
Expand Down

0 comments on commit c9d38d2

Please sign in to comment.