27 lines
750 B
C#
27 lines
750 B
C#
namespace RobotNet10.RobotApp.Motion;
|
|
|
|
public static class MotionApiEndpoints
|
|
{
|
|
public static IEndpointRouteBuilder MapMotionApiEndpoints(this IEndpointRouteBuilder app)
|
|
{
|
|
app.MapGet("/api/motion/ps5/status", (PS5ControllerService svc) =>
|
|
{
|
|
return Results.Json(new { state = svc.State.ToString() });
|
|
});
|
|
|
|
app.MapPost("/api/motion/ps5/enable", async (PS5ControllerService svc) =>
|
|
{
|
|
svc.Enable();
|
|
return Results.Ok("PS5 controller enabled");
|
|
});
|
|
|
|
app.MapPost("/api/motion/ps5/disable", (PS5ControllerService svc) =>
|
|
{
|
|
svc.Disable();
|
|
return Results.Ok("PS5 controller disabled");
|
|
});
|
|
|
|
return app;
|
|
}
|
|
}
|