English 中文(简体)
Designing Web Interface for Embedded System
原标题:

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.

最佳回答

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).

问题回答

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.

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.

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.

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.





相关问题
Designing Web Interface for Embedded System

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 ...

How bind socket to device in windows?

I have same network cards in computer. All cards has identical IP. I need to bind socket to specific card. In linux I can use flag SO_BINDTODEVICE. How I can do this in windows. P.S. This needed for ...

Choose between multiple devices in XCode

I ve 2 devices (iPhone + iPod) connected to my Mac and both are available as developper devices in XCode. How can I choose which one to use for testing purpose and switch from one to the other when I ...

Simulate a faulty block device with read errors?

I m looking for an easier way to test my application against faulty block devices that generate i/o read errors when certain blocks are read. Trying to use a physical hard drive with known bad blocks ...

Is there software or code to alter USB power output

I had a look at this and this but no one sounded particularly sure of their ideas and I m kind of after a different thing anyway. I want to hook my usb power cables (red and black) up to my phone so I ...

热门标签