Friday, April 20, 2012

Vault-OS : Writing Daemons In PHP

Yes, it can be done : Link Here

My plan is: Before the MicroApache service is launched I will boot a central PHP Daemon that processes messages from all the incoming real-time sensors, switches and devices you have hooked up in your shelter.

This basic console line output daemon will do nothing but consolidate the incoming messages and act appropriately on them according to the preferences which have been configured in the central database. This daemon will launch any and all hardware services specified, customizable from within the web interface. Parallel Port, I2C, CANBus, ModBus and BACNet. They will all write to a shared memory space that any process can get discovery and state information from on these devices at any time. There will probably be two cached IPC blocks - one for manifests (makes all data on running processes available to web and other apps) and the second for messages themselves (current value of a thermistor, fuel level, etc.) that changes dynamically. Both of them as a series of block JSON packets.

Sounds complicated but with PHP it is not really that tough to implement. The question is : do I leave specific behaviour to PHP code for the user or attempt to build a primitive state engine editor like the one I hacked together in the previous version? If the former, it's pretty easy to get this system up and running. The latter, could be a chore.

UPDATE : Woo-Hoo! Got the CodeIgniter PHP Library running and tested the sample applications on my little PC/104 boxes with MicroApache! 6 Megabytes of code that gives a developer everything that the entire .NET library provides plus full MVC controllers for a website!! Also - ran very, very fast on 64 MB RAM!! Would probably run in less if you used a very slim version of Win-32!

No comments: