Skip to content

Commit cd0dba8

Browse files
core/services/ardupilot_manager/api/v1/routers: Add TlogCondition get/post endpoints
1 parent 2405f7d commit cd0dba8

File tree

1 file changed

+13
-0
lines changed
  • core/services/ardupilot_manager/api/v1/routers

1 file changed

+13
-0
lines changed

core/services/ardupilot_manager/api/v1/routers/index.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from fastapi_versioning import versioned_api_route
1919
from loguru import logger
2020

21+
from ardupilot_manager.mavlink_proxy.AbstractRouter import TLogCondition
2122
from autopilot_manager import AutoPilotManager
2223
from exceptions import InvalidFirmwareFile, NoDefaultFirmwareAvailable
2324
from typedefs import (
@@ -255,6 +256,18 @@ def preferred_router() -> Any:
255256
return autopilot.load_preferred_router()
256257

257258

259+
@index_router_v1.post("/tlog_condition", summary="Set the condition for when to write Tlog files.")
260+
def set_tlog_condition(condition: TLogCondition) -> Any:
261+
logger.debug("Setting Tlog condition")
262+
autopilot.set_tlog_condition(condition)
263+
logger.debug(f"Tlog write condition set to {condition}")
264+
265+
266+
@index_router_v1.get("/tlog_condition", summary="Retrieve Tlog file write condition")
267+
def tlog_condition() -> Any:
268+
return autopilot.get_tlog_condition()
269+
270+
258271
@index_router_v1.get("/available_routers", summary="Retrieve preferred router")
259272
@index_to_http_exception
260273
def available_routers() -> Any:

0 commit comments

Comments
 (0)