Our new official repo is on github
LCD Smartie version 5.6 is released!
Download it now: https://github.com/LCD-Smartie/LCDSmartie/releases

CGI for LCD Smartie - Run PHP, Ruby and others with Smartie

Announcements of new plugins or updates.

Moderators: _X7JAY7X_, caesar, IFR, mattcro, limbo

Post Reply
PvreHaavok
Posts: 12
Joined: March 22nd, 2011, 1:53 pm

CGI for LCD Smartie - Run PHP, Ruby and others with Smartie

Post by PvreHaavok »

Image

A few months ago I announced the "PHP for LCD Smartie" plugin but now I decided to make it more powerful by not limiting it just to PHP.

The result is "CGI for LCD Smartie", a plugin to make LCD Smartie even more powerful by adding a way to call scripts in any language, like PHP itself, Ruby, Python and even MS-DOS' Batch.

When it was "PHP for LCD Smartie", the code I made had a flaw that made LCD Smartie prone to hang or skip the screen if the called script took too long to respond. To solve it, I came with a client-server based solution: the plugin is a client that make requests to a server in a separate process. These requests are made by the command line (to execute the language interpreter with the right parameters), plus interval and timeout values (in milisseconds). The server receives the data and puts the request in a queue. The queue is processed every second but the command line of a request is executed and stored at every X value set by interval. At every Y value set by timeout the request is removed from the queue. If the server detects that a request is similar to another one already put on the queue, it will send back the result stored in cache and reset the timeout value, keeping the stored request alive to be executed in the next cycle. See, the hard work is done by the server and the client has just to connect and ask to the server what it wants, without hanging LCD Smartie.

CGI for LCD Smartie is:
- Made in VB6 - with plans to port it to C++
- Open-source
- Hosted at Github - https://github.com/MendelGusmao/CGI-for-LCD-Smartie

It’s under development for about 2 days and for now I don’t have any usable or testable. Feel free to make suggestions and to correct my poor english :lol: .

Cheers!
Last edited by PvreHaavok on October 2nd, 2012, 6:20 pm, edited 1 time in total.

PvreHaavok
Posts: 12
Joined: March 22nd, 2011, 1:53 pm

Re: CGI for LCD Smartie

Post by PvreHaavok »

After a few tests, it demonstrated high CPU usage due to use of timers. I think Visual Basic is not meant to build servers, so, if I can't manage to get the server working in a confortable way, I'll try to port the project to C++ using Visual Studio 2010 and Boost libraries. Hope the learning curve be smooth!

PvreHaavok
Posts: 12
Joined: March 22nd, 2011, 1:53 pm

Re: CGI for LCD Smartie

Post by PvreHaavok »

Guys, I just finished a functional alpha of CGI4LCD's Server. It is perfectly receiving the commands, parsing, managing a queue and running what is told it to run, without that CPU usage demonstrated in the version made in VB. I've experienced some difficulty in implementing an asyncronous server to receive the data from the plugin and a timer to run the commands but after spending some time digging the documentation for Boo, it sounded like a piece of cake :)

I'm having some compatibility problems... LCD Smartie doesn't recognize the DLL made using VC++ 2011. It's the same problem that forced us to create a file named "LCDSmartie.exe.config" but this time even this trick won't work now. Solving it, doing some QA job and updating the documentation would be sufficient to build a release for public tests.

I would be glad if you guys could say something about using CGI4LCD and your preferred programming language to process and display data in your LCD's. I wrote some glue code (I call it bootstrap) in Ruby, Perl, Python and Go to be used with the plugin, so I think CGI4LCD's use will be very ecletic.

Cheers

PvreHaavok
Posts: 12
Joined: March 22nd, 2011, 1:53 pm

Re: CGI for LCD Smartie

Post by PvreHaavok »

Hi folks,

I just finished an alpha version of CGI for LCD Smartie. Just download the folders "scripts" and "plugins" from the repository, copy them to LCD Smartie folder, point the configuration to your favorite language interpreter and run cgi4lcd.exe (avaliable in plugins folder). The syntax is the same used in the old php.dll -> $dll(cgi,1,<script name>,[<function name>[,<parameter1>;<parameter1>;<parameterN>]]). More information available in README.

*UPDATE* Now it works with LCD Smartie 5.4.2.92b too (tested with 5.4 & 5.4.2.92b).

Image

Best regards,

PvreHaavok
Posts: 12
Joined: March 22nd, 2011, 1:53 pm

Re: CGI for LCD Smartie

Post by PvreHaavok »

So far, it works with:

PHP
Perl
Python
Ruby
Lua
JavaScript

... and I have no more ideas of what languages to bundle with it. I think it's time to stop :lol:

Also, I just released the 0.2-alpha version. Now every command in the queue run in a new thread, without stopping the server. And if the server doesn't stop, LCD smartie does not freeze anymore.

Post Reply