VAULT DWELLERS SERVED

Friday, February 22, 2013

VOS : More Experiments With Mongoose

I got up early this morning and tinkered with my hybrid Mongoose-VaultOS code a little more. I was able to get a simple Lua script to run as a daemon reading the CANBUS values at startup off the USB adapter.

It was working so well I sort of questioned the idea of using my much-lauded mailslots altogether. My primary reason for pursuing mailslots as an IPC has been the notion I would open source the code and let people write their own custom daemons for Vault-OS as they preferred for whatever hardware they wanted to support.

Once you have a Lua script running in a multithreaded scripted environment, the whole idea of mailslots (a box that receives messages from another separate process running on the same machine) starts to seem somewhat redundant. It is great for systems like PVBROWSER but in the code I have running now you have to wonder if people would much prefer the flexibility of writing their own Lua scripts instead of other processes.

It is funny how I worked on this for months in my own code (and provided ample evidence in screenshots I had this system running) and with only a couple of hours adapting Mongoose I have a far superior system operating now. Technically with Lua scripting it could be far more modular, as simple as looking in a file directory to see what scripts are there with certain naming conventions.

All I can say is that my extensive work on my own code enabled me to recognize that it was crap compared to what I have now. It also enabled me to further understand the basic principles involved in what I am trying to create and how to best implement it. Mongoose with SQLite and Lua is absolutely a winner. It is way better than what I was constructing using WebIO and mailslots.

6 comments:

Contrapundit said...

Ok, sounds interesting, but are you going to sell it? And what does it accomplish? And what can it do for me?

Texas Arcane said...

It is going to be a cross-platform ultimate embedded device controller which can manage and control anything in your shelter or retreat with cheap, easily replaced hardware. It will have modules to manage inventory, medical and personnel in combination with hydroponics, environmental systems and security.

It will produce an interface as HTML which can be browsed by cheap thin client devices from anywhere else in your retreat/shelter and can function in multiple roles as a front end keypad for unlocking a door or a water purification console to manage your water supply.

All this, compiled on any platform and in less than 500K minimal installation that will fit on a floppy disk if need be. Ideally the system will be bundled completely with a small OS (Linux/Win Lite/FreeDOS) on a USB stick for plug-n-play installation anywhere you need it to go.

Laugh if you want but I have had a good proof of concept running in the year prior and it was the right idea, wrong paradigm. I think Mongoose is a much, much better integrated platform than what I had previously.

Texas Arcane said...

I don't plan to make money on the app, which I intend to open source/give away free.

I intend to make money on the book that will accompany it to tell you how to install it, modify it, administrate it for all the different functions it is supposed to handle. A chapter telling you how to build a hydroponics station with cheap components and hook it up, a chapter on water/fuel management with sensors and wiring, etc.

samhuih said...

The book idea for revenue is excellent. People are willing to play around with something free but when they really get interested they're going to need more info. Buy the book!
For long range planning purposes here's what you might want to link to eventually.

zoneminder

http://www.zoneminder.com/
zoneminder controls CCTV cameras, can be linked to the internet, can be linked to phones with wi-fi and also (ta-da) linked to X-10 equipment. Link all these together with your controller system and you have the TOTAL solution.
I bought a 8 channell DVR card to test this with. Haven't got around to putting together a new computer to use it yet. One thing I didn't realize when I bought it was how bad the resolution is. I think you need 720 x 480 resolution in order to see facial features. The card above is only 352x288.
I have some "very" small amount of programming experience. A class in FORTRAN, two classes in assembly and a little C and Lua. One thing I've never understood is how you get from the program to output to the screen in a browser. I've looked at Mozillas explanation and it becomes so complex it's ridiculous and for some reason always requires JAVA. I know libraries can be wrapped in SWIG (Simplified Wrapper and Interface Generator). Also that Lua can call libraries. I can't understand why you can't just send a HTML file to Mozilla libraries directly. If Lua can call libraries why not just directly write to the mozilla library? There's nowhere where they make it plain how to actually get the file to the library to display it.
When I look at the definition for Wrapper_function
http://en.wikipedia.org/wiki/Wrapper_function

the examples make sense but people seem to assume everything is wrapped. I have no idea why such enormous complexity is added on. I do understand that a library can only take data formatted in a certain way. Why not just send it or ask for only the data it asks for? Sorry about the rant but this miffs me to no end. Would you happen to know some links that I could read about this to make sense of it? I'm not asking for a tutorial just a point in the right direction.

Texas Arcane said...

These Lua Server Pages that are embedded in Mongoose consist of the web server sending you into a Lua script with a handle to the buffer that writes outgoing HTML to be returned to the calling process. In it's simplest form, you "print" out the HTML you want to return as a series of lines of text.

By simply including a global handle to variables inside the server, you can operate on a database or pull the real time sensor values out of the server where they are being stored by other scripts. Then you can attach these values to a little javascript slider bar to display and modify the values, like increase/decrease temperature, etc.

The only tough part is interfacing the Lua scripts to the hardware for reading and writing the values and I know of a very simple way this can be done in Lua as a fairly cross platform mechanism. You have serial, usb and other calls in the Lua script in addition to calls to runtime loaded .DLLs. This works fairly well on supporting structures from Linux (.so) to Windows (.dll) to DOS (Causeway .dll) so it is very cross-platform.

Contrapundit said...

Tex, I'm not laughing, I think your program sounds great. And having it free often gets a lot of attention, and then you have the book. You could also have other shelter / survival related stuff to sell. If I ever go for a shelter I'm going to see if I can get your program and book.

www.000webhost.com