Skip to content

Commit

Permalink
stations: expose Station.{Noise, RSSI}
Browse files Browse the repository at this point in the history
  • Loading branch information
mdlayher committed Sep 12, 2016
1 parent 25e00cc commit 74d0710
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion stations.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ type Station struct {
LastSeen time.Time
MAC net.HardwareAddr
RoamCount int
Noise int
RSSI int
SiteID string
Stats *StationStats
Uptime time.Duration
Expand Down Expand Up @@ -84,6 +86,8 @@ func (s *Station) UnmarshalJSON(b []byte) error {
IP: net.ParseIP(sta.IP),
LastSeen: time.Unix(int64(sta.LastSeen), 0),
MAC: mac,
Noise: sta.Noise,
RSSI: sta.RSSI,
RoamCount: sta.RoamCount,
SiteID: sta.SiteID,
Stats: &StationStats{
Expand Down Expand Up @@ -133,7 +137,7 @@ type station struct {
Radio string `json:"radio"`
RadioProto string `json:"radio_proto"`
RoamCount int `json:"roam_count"`
Rssi int `json:"rssi"`
RSSI int `json:"rssi"`
RxBytes int `json:"rx_bytes"`
RxBytesR int `json:"rx_bytes-r"`
RxPackets int `json:"rx_packets"`
Expand Down
4 changes: 4 additions & 0 deletions stations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ func TestStationUnmarshalJSON(t *testing.T) {
"hostname": "somehost",
"ip": "192.168.1.2",
"mac": "de:ad:be:ef:de:ad",
"noise": -110,
"roam_count": 1,
"rssi": 40,
"site_id": "somesite",
"rx_bytes": 80,
"rx_packets": 4,
Expand All @@ -134,7 +136,9 @@ func TestStationUnmarshalJSON(t *testing.T) {
IP: net.IPv4(192, 168, 1, 2),
LastSeen: zeroUNIX,
MAC: net.HardwareAddr{0xde, 0xad, 0xbe, 0xef, 0xde, 0xad},
Noise: -110,
RoamCount: 1,
RSSI: 40,
SiteID: "somesite",
Stats: &StationStats{
ReceiveBytes: 80,
Expand Down

0 comments on commit 74d0710

Please sign in to comment.