6

OS : Linux.

I'm trying to find possible ways to implement web interface for my embedded system. Currently there is a shell (text based) and a small set of commands are implemented to query the device.

I'm new to web development, my questions are:

  1. What web server must I use? (I got apache up on my development setup and tried using CGI to fetch some pages, but seems like this not the right choice for embedded systems)

  2. Assuming I'm using CGI, what strategy can be used for passing data between CGI and the Main App? I intended to create a thread in the MainApp to handle the query from CGI script. This thread would call interfaces in the MainApp, retrive the data and pass it to CGI.

YakovL
  • 7,557
  • 12
  • 62
  • 102
Sandeep Prabhu
  • 103
  • 1
  • 5

5 Answers5

9

We use Lighttpd on our embedded systems, it's small and very easy to integrate. There are also specialized webservers with features especially geared to embedding, like AppWeb, which in my opinion is also a very nice product.

For the communication between the main application and the CGI's you can use sockets, or System V message queues if those are available on your embedded platform. The advantage of SYSV message queues is that they're very easy to use and manage, and messages in the queues survive restarts of the applications, but they also have some quirks (like you can't select() on them).

Luke Girvin
  • 13,221
  • 9
  • 64
  • 84
fvu
  • 32,488
  • 6
  • 61
  • 79
4

As web server another choice is thttpd. I use it successfully in an industrial product.

For the communication between CGI and main application sockets is the right choice.

gsempe
  • 5,371
  • 2
  • 25
  • 29
0

There is no web server you must use, but there are some better choices for embedded than apache. Apache is designed for embedded and is bigger and slower.

I would not recommend CGI. It is slow to run and slow to develop. I can speak for Appweb for which I'm one of the developers. Appweb has two good web frameworks:

  • Ejscript which is a server-side Javascript framework for Appweb
  • ESP which is an MVC C-Language web farmework

ESP is extremely fast and provides easy binding of controllers to URLs. Ejscript is bigger and has a more extensive class library. Both are designed for embedded. Both are much better than CGI and execute 20+ times faster than CGI.

SenseDeep
  • 3,026
  • 3
  • 17
  • 19
  • You are on the borderline answering this question, but you seem to be purposefully leaving out in this post that you are a dev on the Appweb project. You really need to read the [FAQ on Self-Promotion](http://www.stackoverflow.com/faq#promotion) before posting any further answers. – Andrew Barber Nov 29 '12 at 00:46
  • Andrew, thanks for the tip. I'm learning the rules and trying to better frame my answers. I'll add disclosure about being a dev on the project. – SenseDeep Nov 29 '12 at 01:18
0

I am working in LuCI, which is a light CGI for embedded device. Actually it is for openwrt which is a open source project of wireless router.

The server is uhttpd , light and powerful.

The CGI script is Lua whose interpreter is no more than 10k, delicate, right? And it is developed by C and can communicate with C, powerful.

So this is my suggest.

4t8dds
  • 565
  • 7
  • 19
0

We use JUCI with openwrt. It is written in javascript that runs on the client browser and communicates with web server over json rest api. The backend can be implemented in any language but we use reusable components written in C that plug into system bus (ubus). This means that relevant services expose their functionality through ubus which can both be used through cli and through rest api. It's actually pretty nice.

user2826084
  • 517
  • 5
  • 11