Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extracted expected throughput using stats and best_rates lines #72

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions rateman/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,23 +153,35 @@ async def process_header(ap, path):

async def process_line(ap, line):
# FIXME: This is where the AP's raw data callbacks should be called

if (result := parse_txs(line)) is not None:
update_rate_stats_from_txs(ap, *result)
return None

elif fields := validate_line(ap, line.decode("utf-8").rstrip()):
sta = ap.get_sta(fields[3], radio=fields[0])
match fields[2]:
case "rxs":
sta = ap.get_sta(fields[3], radio=fields[0])
if sta and fields[1] != "7f":
sta.update_rssi(
int(fields[1], 16),
parse_s8(fields[4]),
[parse_s8(r) for r in fields[5:]],
)

case "sta":
await process_sta_info(ap, fields)

case "stats":
if sta:
rate = fields[4]
avg_tp = int(fields[6], 16) / 10
sta.kernel_stats.update({rate: avg_tp})

case "best_rates":
max_tp_rate = fields[4]
prashiddhath marked this conversation as resolved.
Show resolved Hide resolved
if max_tp_rate in sta.kernel_stats:
sta.expected_tp = sta.kernel_stats[max_tp_rate]

case "#error":
ap.handle_error(fields[3])

Expand Down
22 changes: 21 additions & 1 deletion rateman/station.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ def __init__(
self._rc_pause_on_disassoc = False
self._rc_paused = False
self._log = logger if logger else logging.getLogger()
self._kernel_stats = dict()
self._expected_throughput = None

@property
def loop(self):
Expand Down Expand Up @@ -147,7 +149,25 @@ def kernel_stats_update_freq(self) -> int:
the remote device.
"""
return self._kernel_update_freq


@property
def kernel_stats(self) -> dict:
"""
Return the estimated throughput of the rates reported in stats lines.
"""
return self._kernel_stats

@property
def expected_throughput(self) -> int:
"""
Return the current estimated throughput.
"""
return self._expected_throughput

@expected_throughput.setter
def expected_throughput(self, throughput: float):
self._supported_powers = throughput
prashiddhath marked this conversation as resolved.
Show resolved Hide resolved

async def set_kernel_stats_update_freq(self, freq: int) -> None:
"""
Set the frequency, at wich the kernel rate statistics for this station will be updated on
Expand Down