mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2024-12-26 04:08:21 +01:00
allow shutdown or reboot jarvis
This commit is contained in:
parent
264e396a89
commit
3a5242e6e9
File diff suppressed because one or more lines are too long
@ -10,7 +10,7 @@
|
||||
"author": "",
|
||||
"email": ""
|
||||
},
|
||||
"version":"0.1.1-a",
|
||||
"version":"0.1.2-a",
|
||||
"category":"Other",
|
||||
"iconclass":"fa fa-android",
|
||||
"mimes":["none"],
|
||||
|
Binary file not shown.
@ -6,7 +6,9 @@ class JarvisService extends OS.application.BaseService
|
||||
|
||||
@nodes = [
|
||||
{text: __("Status"), id: 1},
|
||||
{text: __("Exit"), id: 2}
|
||||
{text: __("Exit service"), id: 2},
|
||||
{text: __("Shutdown"), id: 3},
|
||||
{text: __("Reboot"), id: 4}
|
||||
]
|
||||
@onchildselect = (e) => @action e
|
||||
|
||||
@ -58,6 +60,26 @@ class JarvisService extends OS.application.BaseService
|
||||
@_gui.launch "JarvisControl", []
|
||||
when 2
|
||||
@quit()
|
||||
when 3
|
||||
@execute("halt\n")
|
||||
when 4
|
||||
@execute("reboot\n")
|
||||
|
||||
execute: (cmd) ->
|
||||
return unless @tunnel
|
||||
sub = new Antunnel.Subscriber("jarvis_control")
|
||||
sub.onopen = () =>
|
||||
console.log("Subscribed to jarvis_control channel. Send the command")
|
||||
sub.send Antunnel.Msg.DATA, new TextEncoder("utf-8").encode(cmd)
|
||||
sub.close()
|
||||
|
||||
sub.onerror = (e) =>
|
||||
@error __("Error: {0}", new TextDecoder("utf-8").decode(e.data)), e
|
||||
#@sub = undefined
|
||||
|
||||
sub.onclose = () =>
|
||||
@notify __("Unsubscribed to the jarvis_control service")
|
||||
@tunnel.subscribe sub
|
||||
|
||||
awake: () ->
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
"author": "",
|
||||
"email": ""
|
||||
},
|
||||
"version":"0.1.1-a",
|
||||
"version":"0.1.2-a",
|
||||
"category":"Other",
|
||||
"iconclass":"fa fa-android",
|
||||
"mimes":["none"],
|
||||
|
@ -86,7 +86,7 @@
|
||||
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/JarvisControl/README.md",
|
||||
"category": "Other",
|
||||
"author": "",
|
||||
"version": "0.1.1-a",
|
||||
"version": "0.1.2-a",
|
||||
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/JarvisControl/build/release/JarvisControl.zip"
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user