:::: MENU ::::

Creating Your First Chumby Widget – Part Three: Testing Your Application on the Chumby

In parts one and two of this series, we learned how to build an app for the Chumby, and how to connect to the Chumby via SSH. In part three, we will all of this knowledge to use and finally get our application running on the Chumby device!

Though there are a few methods for testing your application on your Chumby, I find the fastest and thus most useful way to be to tell the Chumby to load your application using SSH. To do this we will first need to setup a simple web server on your local computer so that the Chumby can find your application files. Ready? Let’s go!

Setting up Your Web Server:
This may sound like a difficult task; however, there are two great programs (one for Windows, and one for Mac) that do all of the work for you.

If you’re a Mac:
There’s a program called MAMP (Mac Apach MySql PHP) which will install everything you need to run your own personal web server, and best of all, it’s FREE! All the information you need is on the MAMP website, so cruise on over there, follow the instructions for installing MAMP, then come back once you have everything up and running.

If you’re a PC:
There’s a program called WAMP (Windows Apach MySql PHP) which will install everything you need to run your own personal web server, and best of all, it’s FREE! All the information you need is on the WAMP website, so cruise on over there, follow the instructions for installing WAMP, then come back once you have everything up and running.

Getting Your Application Path:
Now that you have your web server setup, make sure that it is running.

A simple test for this is open a browser and go to http://localhost/ . If your web server is running, this page should return something (even if it is a blank index listing).

Once you have verified that your web server is up and running, create a new directory in your htdocs folders (aka your server root), give it a name (I will call mine “chumbyclock”). Now take your application files (in my case this will simply be chumbyClock.swf) and place them in your new directory. At this point, you should be able to open a browser and access your files via a url such as “http://localhost/myDirectory/myApplication.swf”. If you see your application running at that URL, then you are ready to move to the next step. If not, then you will need to resolve any issues with your webserver or paths before moving on.

Running Your Application on the Chumby:
The final step is to tell the Chumby to run your application by giving it the path to your application files on your web server. To do this, first SSH into your Chumby (if you are unfamiliar with how to do this, you can read my tutorial: Connecting to Your Chumby Device Over SSH). Once you have successfully connected to your Chumby, you will need to enter the following command into your SSH client to stop the control panel on your chumby:

Next you will tell the Chumby to load your application by entering the following command:

In my case the command looked like this:

chumbyflashplayer.x -i http://10.0.0.1/chumbyclock/chumbyClock.swf

After you hit enter, you should see your application running on the Chumby! You can now interact with it on the device and make sure everything works properly!

Getting Debug (trace) Output From Your Application:
If you followed the steps above, and have your application running on the Chumby, then you should already be getting trace output from your application to your SSH Client (terminal) window. If you want to test this, you can add a simple trace statement to your application, then run it on the Chumby using the steps above, and you should see the trace output in the terminal window.

Stopping Your Application and Incremental Testing:
After you’ve gotten your application running on the Chumby for the first time, the next obvious question is: “How do use this process to continuously test my app on the device as I am building it.” The answer is pretty simple. You set the publish setting for your Flash file to output your SWF to the directory you created in your htdocs folder above, then each time you publish your SWF, the files in that directory will be updated. From there it’s just a matter of entering the command to tell the Chumby to load up your application again. The nice thing about using the command line is that it stores your previous commands, so you should simply be able to hit the “up” arrow on your keyboard while in the terminal window (SSH client) and it should populate the command for you. Then just hit enter, and you should see your newly updated app running on the Chumby!

If you’re wondering how to stop your application on the Chumby, you can hit ctrl+c to “kill” the app.

Wrap up:
I know this process may have seemed a bit daunting for those of you who are not familiar with using the command line, or running a web server, but I congratulate you for making it this far! Now that you have gotten your first application running on the Chumby, it should all be a breeze from here!

Related Posts:




2 Comments

So, what do you think ?