Skip to content

Commit

Permalink
Added new ECP endpoint exit-app
Browse files Browse the repository at this point in the history
  • Loading branch information
lvcabral committed Dec 24, 2024
1 parent 8cb1ad3 commit 1923cde
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/cli/ecp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ function enableECP() {
ecp.get("/query/icon/:appID", sendAppIcon);
ecp.get("/query/registry/:appID", sendRegistry);
ecp.post("/launch/:appID", sendLaunchApp);
ecp.post("/exit-app/:appID", sendExitApp);
ecp.post("/keypress/:key", sendKeyPress);
ecp.post("/keydown/:key", sendKeyDown);
ecp.post("/keyup/:key", sendKeyUp);
Expand Down Expand Up @@ -106,6 +107,7 @@ function enableECP() {
.then(() => {
subscribeControl("ecp", (event: string) => {
if (event === "home" || event === "poweroff") {
// TODO: exiting with error `Dot` operator attempted with a non-object value
Atomics.store(sharedArray, DataType.DBG, DebugCommand.EXIT);
}
});
Expand Down Expand Up @@ -279,6 +281,11 @@ function sendLaunchApp(req: any, res: any) {
res?.end();
}

function sendExitApp(req: any, res: any) {
Atomics.store(sharedArray, DataType.DBG, DebugCommand.EXIT);
res?.end();
}

function sendKeyDown(req: any, res: any) {
sendKey(req.params.key, 0);
res?.end();
Expand Down

0 comments on commit 1923cde

Please sign in to comment.