Skip to content

Commit

Permalink
Merge ant stats keys and values in JSON API #382
Browse files Browse the repository at this point in the history
  • Loading branch information
svpcom committed Nov 17, 2024
1 parent 1efdc29 commit ff37a53
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions wfb_ng/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ def send_stats(self, data):
if data['type'] == 'rx':
ka = ('ant', 'freq', 'mcs', 'bw')
va = ('pkt_recv', 'rssi_min', 'rssi_avg', 'rssi_max', 'snr_min', 'snr_avg', 'snr_max')
data['rx_ant_stats'] = list((dict(zip(ka, (ant_id,) + k)), dict(zip(va, v)))
data['rx_ant_stats'] = list(dict(zip(ka + va, (ant_id,) + k + v))
for (k, ant_id), v in data.pop('rx_ant_stats').items())
elif data['type'] == 'tx':
ka = 'ant'
ka = ('ant',)
va = ('pkt_sent', 'pkt_drop', 'lat_min', 'lat_avg', 'lat_max')
data['tx_ant_stats'] = list(({ka : k}, dict(zip(va, v)))
data['tx_ant_stats'] = list(dict(zip(ka + va, (k,) + v))
for k, v in data.pop('latency').items())

msg = json.dumps(data)
Expand Down

0 comments on commit ff37a53

Please sign in to comment.