Hack16.Turn your PDA into a Flashlight

Hack 16. Turn your PDA into a Flashlight

When darkness falls, you can engage the backlight on your Palm and light things up.

You can turn on your Palm's backlight to act as a basic flashlight. However, you will need to disable the power-off feature if you need to use the flashlight for more than a few minutes (either that or you will have to keep turning it back on). This works nicely on a Treo with the lighted keyboard, but it also works fine on a regular Palm device. There are a couple of simple programs that do this for you.

2.7.1. FB Hi-Light

FB Hi-Light displays a flashlight (bright white light) and has some digital sound effects. It is available from PalmGear (http://www.palmgear.com; search for the name of the application there).

2.7.2. TealInfo/Teal Light

The program TealInfo from TealPoint Software (http://www.tealpoint.com) allows you to create and use simple interactive databases and mini-applications. One of those programs (called Folios) is Teal Light which gives you a variety of choices for turning your PDA into a flashlight. You can choose from a set of different colors and different patterns, as you can see in Figure 2-25.

Figure 2-25. TealLight

As you can see, this is a very simple hackthe programs give you some neat options, though. Keep this idea in mind if you need a flashlight and all you have with you is your Palm device.

2.7.3. Hacking the Hack

You can also easily create your own flashlight program. Run the Palm OS Developer Suite [Hack #49]. Create a new project and select Simple as the project type from the wizard. Make the following changes to AppMain.c. Note that the code you should add to the wizard-generated code is shown in bold.

 #include "AppResources.h" // Remember the original auto-off time static UInt16 old_time = 0; static Err AppStart(void) { // 0 means to never automatically shut off old_time = SysSetAutoOffTime(0); FrmGotoForm(MainForm); return errNone; } static void AppStop(void) { // Close all the open forms. FrmCloseAllForms(); // Restore the original auto-off time SysSetAutoOffTime(old_time); } 

If you make these changes from within the Palm Developer Suite, the project will automatically be recompiled when you save the file. Fix any errors that occur in the compilationhopefully there will be nothing more than simple typos!

Now you are ready to download the program to your Palm device. Open up Palm Desktop and press the Install button. Browse to the location of your compiled programyou are looking for the .prc file. If your project was named Flashlight, then the file should be somewhere like: c:\Program Files\PalmSource\Palm OS Developer Suite\workspace\Flashlight\Debug\Flashlight.prc.

HotSync your Palm Device and try running the program. You should see something like Figure 2-26.

Figure 2-26. Homebrew Flashlight application

As you can see, creating a flashlight program isn't hard. The key is the SysSetAutoOffTime() function. That allows you to disable (and re-enable when you are finished) the auto shut-off feature. To get fancy looking displays, you can use the resource editor in the Palm OS Developer Suite to set a bitmap as the background for the main form. You can also remove the text or change it to something wittier.

Palm and Treo Hacks
Palm and Treo Hacks: Tips & Tools for Mastering Your Handheld
ISBN: 059610054X
EAN: 2147483647
Year: 2006
Pages: 115

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net