简体   繁体   中英

Making existing C++ project to work in Firefox OS

I have an existing c++/java project that works on linux, windows and android and I want to make it work on firefox OS (B2G) too. I have built binaries(daemon and client) of my project for FFOS and tested them on command line using adb shell. The problem is how to access that daemon through user application using javascript.

Since FFOS uses HTML/JS/CSS for applications, one suggestion is to convert the whole project into javascript using 'emscripten' tool. But given the size and complexity of my project, this doesn't seem to work (lots of errors, missing header files etc). It uses some low-level functionality like creating a UDP packet, sending out multicast packets and listening-on and connecting-to a tcp/udp port; these features are lacking in javascript API (am i wrong?).

Another suggestion was to use Web IDL (requires modification of FFOS gecko engine) but I am not sure how it can help me in my scenario.

Any ideas/tips/suggestions would be appreciated. Thanks.

There is no way to install binaries on Firefox OS with a non-rooted device. Packaged apps only support HTML/JS/CSS: https://developer.mozilla.org/en-US/Marketplace/Publishing/Packaged_apps

WebIDL will not help here, since you also can't modify Gecko or any of the underlying binaries already installed. This would only be applicable if you were forking the OS and wanted to add new Web APIs.

emscripten might be a good option - there is an active Google Group, you may be able to find help for your compile errors there: https://groups.google.com/forum/#!forum/emscripten-discuss

Would it be appropriate to put your native code behind a remote web service? This has some downsides like making sure it is secure and making your app require a server connection (perhaps with caching for offline purposes), but if you already run a web service and especially if your app already requires a connection then it's not a huge difference.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM