-
-
Notifications
You must be signed in to change notification settings - Fork 3
yss js functions mDoCmd
Class mDoCmd is a helper from oiyshTerminal family - Main class
Kind: global class
you can make a instace of it to use it to run cmd communication support. It can do command, update on stdout/in , callbacks,.... mqtt and otdm-nrf-yss are making a bridge from bash or otdmTool.py to mqtt. Then using function from this class you can interact with process or only make some bash work.
Check otdmTool.py site otdmDriverWebCmdSubProcess - documentation
To know if still running. true (running..)
Kind: instance property of mDoCmd
To identify current command communication topic
Kind: instance property of mDoCmd
To collect data stdout from cmd from shell
Kind: instance property of mDoCmd
Methode run to command from otdmTools and get result - call back on finish.
Kind: instance method of mDoCmd
Param | Type | Description |
---|---|---|
args | json |
json structure of arguments pass same way as you use otdmTools.py Argument is a key and value is value. |
callBack | object |
can be not set - then only dump to cl( ... ) will pass data , result as arguments |
Example
this.mDoCmd.otdmArgs({
"dfs": "/tmp/abc",
"act": "MKDIR"
},(data,res)=>{cl("ok");});
will console.log out "ok" on done. Example
this.mDoCmd.otdmArgs({
"dfs": "/tmp"
},(data,res)=>{cl(data);});
will console.log out list of files and directories
Methode to run command from bash layer and get live conection with stdin / stdout. It use pH
as a key in creating new mqtt topic to establish trafic. Running process. So you can intercact with thread.
Kind: instance method of mDoCmd
Param | Type | Description |
---|---|---|
cmd | array |
array example:["ls","/tmp"] structure of arguments pass same way as you use otdmTools.py Argument is a key and value is value. |
updateObj | string |
id of html element will update status of app stdout |
callBack | object |
can be not set - then only dump to cl( ... ). Will pass data, result arguments if callBack is set then pass (data ,result ) arguments |
Methode to run command from bash layer and get live conection with stdin / stdout. It use pH
as a key in creating new mqtt topic to establish trafic. Running process. So you can intercact with thread.
Kind: instance method of mDoCmd
Param | Type | Description |
---|---|---|
cmd | string |
example: "df -h |
updateObj | string |
id of html element will update status of app stdout |
cbFunc | object |
can be not set - then only dump to cl( ... ). Will pass data, result arguments if callBack is set then pass (data ,result ) arguments |
Methode to run command from bash layer and get live conection with stdin / stdout. It use pH
as a key in creating new mqtt topic to establish trafic. Running process. So you can intercact with thread. Plast it do exitCode check for you.
Kind: instance method of mDoCmd
Param | Type | Default | Description |
---|---|---|---|
cmd | string |
example: "df -h | |
updateObj | string |
id of html element will update status of app stdout | |
cbFuncOk | object |
calledback on OK exitCode:0 can be not set - then only dump to cl( ... ). Will pass data, result arguments if callBack is set then pass (data ,result ) arguments |
|
cbFuncErr | object |
calledback on Error exitCode:!0 can be not set - then only dump to cl( ... ). Will pass data, result arguments if callBack is set then pass (data ,result ) arguments |
|
rAsJson | bool |
true |
true:default if true return in json if false as it came |
Default callback methode for .otdmArgs
methode on DONE. Will only spit to console.log the result.
Kind: instance method of mDoCmd
Param | Type | Description |
---|---|---|
data | json/string |
json / string tipically if all is ok then get json. |
Methode to update worker live connection is it DONE. Put it in your site onMassageCallBack if you want to update status or run next one. If running not starting text.
Kind: instance method of mDoCmd
Param | Type | Description |
---|---|---|
r | json |
incomming msg from websocket server. it will look for owne topic with pH as key. if done will come sets end of cmdWork to false. |
Default callback methode for .doCmd
methode. Will only spit to console.log the result.
Kind: instance method of mDoCmd