Skip to content

Commit

Permalink
added rest endpoints api\screenoff and api\screenon
Browse files Browse the repository at this point in the history
  • Loading branch information
mhwlng committed Dec 27, 2022
1 parent 717ca29 commit 839888f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ You won't have this problem, if you define just one Kiosk URL.

There is also a (GET) rest api endpoint (http://x.x.x.x:5000/api/status) that returns a JSON object, containing system status data.

There are also (POST) rest api endpoints (http://x.x.x.x:5000/api/shutdown and http://x.x.x.x:5000/api/reboot) NOTE that there is no authentication!
There are also (POST) rest api endpoints (http://x.x.x.x:5000/api/shutdown , http://x.x.x.x:5000/api/reboot , http://x.x.x.x:5000/api/screenoff and http://x.x.x.x:5000/api/screenon) NOTE that there is no authentication!

![touch screen](https://i.imgur.com/Wzp5kqm.png)

Expand Down
20 changes: 20 additions & 0 deletions kiosk-server/Api/ApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,25 @@ public IActionResult Reboot()

return Ok();
}


[Route("api/screenon")]
[HttpPost]
public IActionResult ScreenOn()
{
System.Diagnostics.Process.Start(new ProcessStartInfo() { FileName = "sudo", Arguments = "vcgencmd display_power 1" });

return Ok();
}

[Route("api/screenoff")]

[HttpPost]
public IActionResult ScreenOff()
{
System.Diagnostics.Process.Start(new ProcessStartInfo() { FileName = "sudo", Arguments = "vcgencmd display_power 0" });

return Ok();
}
}
}
6 changes: 3 additions & 3 deletions kiosk-server/kiosk-server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
<PreBuildEvent>
</PreBuildEvent>
<ApplicationIcon>wwwroot\favicon.ico</ApplicationIcon>
<Version>0.0.1.0</Version>
<Version>0.0.1.1</Version>
<Copyright>Copyright © 2022</Copyright>
<Company />
<Authors />
<AssemblyVersion>0.0.1.0</AssemblyVersion>
<FileVersion>0.0.1.0</FileVersion>
<AssemblyVersion>0.0.1.1</AssemblyVersion>
<FileVersion>0.0.1.1</FileVersion>
</PropertyGroup>

<Target Name="PiCopy" AfterTargets="AfterPublish">
Expand Down

0 comments on commit 839888f

Please sign in to comment.