feat: add airtime data retrieval functionality with API endpoint

This commit is contained in:
Lloyd
2026-04-11 20:42:04 +01:00
parent 178eaf5b4b
commit 110d7c2aec
3 changed files with 52 additions and 0 deletions
+16
View File
@@ -1343,6 +1343,22 @@ class APIEndpoints:
logger.error(f"Error getting filtered packets: {e}")
return self._error(e)
@cherrypy.expose
@cherrypy.tools.json_out()
def airtime_data(self, start_timestamp=None, end_timestamp=None, limit=50000):
"""Lightweight endpoint returning only columns needed for airtime charting."""
try:
start_ts = float(start_timestamp) if start_timestamp is not None else None
end_ts = float(end_timestamp) if end_timestamp is not None else None
limit_int = min(int(limit), 50000)
packets = self._get_storage().get_airtime_data(
start_timestamp=start_ts, end_timestamp=end_ts, limit=limit_int,
)
return self._success(packets, count=len(packets))
except Exception as e:
logger.error(f"Error getting airtime data: {e}")
return self._error(e)
@cherrypy.expose
@cherrypy.tools.json_out()
def packet_by_hash(self, packet_hash=None):