Monday, June 30, 2008

another web tool

Very busy lately back again at my blog. A few weeks ago I heard someone at work mentioning the existing of WT toolkit. A web toolkit written in C++ based on the set of boost libraries. More info can be found on following links:

http://www.webtoolkit.eu/wt/
http://www.emweb.be/

http://www.boost.org/

I thought it might be great to have that toolkit running on the NGW because of the rich interface components you can use on the client. Of course this demanded for the porting of all the C++ libraries to AVR32 which isn't an easy thing todo because the boost project uses the bjam make tool and wt the cmake. I'm still busy with it as we speak. The compilation for boost is done by making symbolik links to the avr32 tool chain to bypass the bjam stuff. I'm not sure if this is the right way to go. The cmake for wt is easier for cross compilation and went smoothly. Nevertheless there're still problems in finding (C++) library functions on the target after installing the libs in the LD export directory. I even had to remake the buildroot with wchar support. But this is also a good exercise to learn the possible linux library configurations. So I will continue this in parallel with my proof of concept. But the WT project has started me thinking on the possible other ways to build my browser interface like using JavaScript / Ajax and DOM. I will buy a few books on these concepts because they are all hot topics now a days. From O-Reilly:

- JavaScript: The Definitive Guide, 5th Edition (David Flanagan)
- Ajax: The Definitive Guide (Anthony Holdener)

Meanwhile I started with the proof of concept in building a shared object library for the I2C stuff.
I made a i2c_func.so library. Still not sure on the versioning stuff in respect with ldconfig. Will investigate and read more on that subject. What with multiple so versions and their symbolic links?

I already learned the 3 sorts of lib :

  1. Static library (extension .a) -> code becomes part of final exec
  2. Shared Object (extension .so) -> code stays in lib automatically loaded with exec startup (depends on LD conf where to find)
  3. Dynamic Link Lib ( extension .so) -> code stays in lib linking when needed at runtime (get func/sym with API)

I also played a bit around with tooling like NM , OBJDUMP , READELF , LDD , LDCONFIG to name a few. All very practical command line programs to investigate objects and libraries more in-depth. Cumming up are the summer months lets hope on good weather but if not I know what todo ;-)

Thursday, June 12, 2008

sending mail from the NGW

In the php continuation story I felt the need to add some mail functionality to the NGW. I did some research on lightweight smtp clients and MSMTP came out as perfect candidate to use on the NGW because of his simplicity. No heavy source tree just the basic thing rfc 821 implemented. Cross compilation went smoothly and it's just a single executable to install on the target. I expanded my PHP exercise with this functionality and it worked greatly. I used the popen() PHP function to call msmtp and fed the parameters by file as well as runtime strings both did the job without using a mail agent like mutt or nail. Page can be viewed if NGW is up and running:

http://guyvo.no-ip.biz/php3

I think most of my components are now present on the board and I will carry on with the general proof concept, which was still on the todo list. After that I can begin with my analyzes on the final domotic system. There 're still some other interesting concepts to investigate like inter process communication between the php session and the domotic deamon program but I will take care of these as the analyzes progress. To end this blog let me resume with a list of already installed NGW functionality:

Root FS on SDCARD with swap
OS linux 2.6.24 kernel
µLibc / dev
Busybox shell tools
Web server
Telnet
Ftp
Ssh
Nfs
Samba
Ntp
PHP 5
Smtp client
Extension I2C IO board 40 inputs/40 outputs / 8 dac
Ac97 sound architecture

Yet impressive isn't it ?

Thursday, June 5, 2008

Exploring PHP as a candidate for the front end UI

I focused my attention on learning PHP the past 2 weeks. I first struggled a bit around in finding the right tools to test and write PHP/HTML combination. Finally the package XAMPP came out as a great bundle of a web server, a PHP interpreter and a mysql database. Be ware this is not intended to install on the NGW but on the host PC to test written code first. This is a lot easier than always transfer the files to the target. I also installed the version 6.1 of “netbeans early access php” as the IDE. I started to read some e-book based on PHP version 4 to feed the basic skills. It went very smoothly and I saw a lot of good and simple program techniques rising up as I continued reading. The best thing in my opinion is without a doubt making some exercise to master the concepts. The way I prefer is cutting this concepts in to smaller pieces and study them separately first. So over night I dreamt of some small math application covering all my basic learned skills. It was in fact a simple multiplication test with 3 levels of difficulty. I tried to master reading/writing from/to files as I needed it for saving session data. Version 1 was born. An example can be viewed if NGW is running on:

http://guyvo.no-ip.biz/php1/

As this exercise got some final form I rapidly saw that there were a few shortcomings like an overloaded GUI and working with more than one client browser at the same time was not possible. So I continued studying cookies and sessions variables. I adapted version 1 very easily with these concepts. An example can be viewed if NGW is running on:

http://guyvo.no-ip.biz/php2/

Still some important concepts to learn and I plan to buy the book "PHP5 & MySQL" to always have a reference with me. But as I said before the chances are high to go for this solution as the front end domotic interface, and this can only be confirmed now. I get the feeling PHP is capable of doing the job. Using this as a final UI will give us more portability than ever before because HTML is vastly spread now and everyone has at least one browser and PHP (written in C) is easy to port to several popular cpu platforms. (AVR, ARM , MIPS ,....) But I will dedicate a complete topic on the portability of this project in one of my future blogs here.

PS

I can add one more computer languages to my list ;-)