语言

Menu
Sites
Language
How to execute bash / shell command from HTML5 App ?

Team.,

I created set of menus in HTML5 app. In that most of them are highly interact with hardware.

Example, I need to launch a camera from my app. Am able to launch my camera from terminal using bash file (cam.sh).

Same bash/shell file , i need to execute from my app on button click.

How can i achive this ? Experts please suggest me.

Prior Thanks.,
GK

 

响应

5 回复
Marco Buettner

Why u need a bash? You can use appControl, read the documentation of Tizen ;) Or look some threads below your post to find a solution :)

Ganesh Kumar R

Hi! Marco.,

Am aware of appControl , I am able to invoke the default tizen music player. I could able achive using below code.

var appControl = new tizen.ApplicationControl('http://tizen.org/appcontrol/operation/view','tizen.musicplayer',0,'audio/*');
    tizen.application.launchAppControl(
    appControl,
    appname,
    function() {console.log("launch application control succeed"); },
    function(e) {console.log("launch application control failed. reason: " + e.message); },
    null );

But, my need is to invoke my own native hardware app, As I said we integrated gstremer & camera driver which is my vendor specific.

Those controls are able to start from sdb terminal. Now, those controls I need to starts from HTML5 app ? 

Either, Possible to get runtime sdb control in html5 app ? Below is the method we do in Android.

Process process = Runtime.getRuntime().exec("your command");
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream()));

Can you suggest me a better way to achive my requirment ?

Marco Buettner

No you can not start a sdb control via HTML5 app... You can use MessagePort to communicate with your hardware app

Ganesh Kumar R

Hi! Scion.,

Thanks for your suggestion. But, Am in urgency to communicate with sdb shell from html app.

Can you please brief me or share me some sample on  "MessagePort to communicate with your hardware app".

 

Lakshmi Grandhi

Hi,

Hybrid Application is a sample message port example, where web application communicates with native app using Message Port.