BUY THIS BOOK
Add to Cart

Print Book $24.95


Add to Cart

PDF $19.99

Safari Books Online

What is this?

Add to UK Cart

Print Book £17.50

What is this?

Looking to Reprint or License this content?


Wireless Hacks
Wireless Hacks, Second Edition Tips & Tools for Building, Extending, and Securing Your Network

By Rob Flickenger, Roger Weeks
Book Price: $24.95 USD
£17.50 GBP
PDF Price: $19.99

Cover | Table of Contents


Table of Contents

Chapter 1: Bluetooth, Mobile Phones, and GPS
There is much talk in the communications industry of providing last-mile connectivity. Think of Bluetooth as providing connectivity for the last 10 feet. Bluetooth excels as a handy cable-replacement technology, helping to eliminate the need for cumbersome wires that you might find on headsets, remote controls, PDAs, and other small devices. Bluetooth aims to end the days of needing to carry a three-foot piece of cable with obscure connectors on either end everywhere you go, just to interface to your laptop. You can use Bluetooth-enabled devices to talk to a laptop or a desktop, or even have them talk to each other to exchange data almost effortlessly. This chapter presents hacks on getting Bluetooth working with a wide range of devices and then doing some very interesting tricks.
If you can provide connectivity for the last 10 feet, how do you find yourself on this blue-green sphere we call Earth? The global positioning system (GPS) has migrated from being a military-only technology to something that is built into cars, phones, and a number of other devices. In this chapter, you can learn how to do some very unusual things with GPS that the designers probably never intended.
Mobile phones are everywhere. For many people, they have become the sole telephone of choice, enabling them to abandon land lines altogether. When you combine a mobile phone and Bluetooth, even more hacks become possible.
Linux kernels from 2.6 onward have easy-to-use tools for Bluetooth.
Prior to the release of the 2.6 Linux kernel, getting Bluetooth support involved compiling your own kernel as well as the necessary utilities. There were also multiple Bluetooth stacks available, each with their own features, adapter support, and quirks. In 2.6, the BlueZ stack was crowned as the officially supported way to use Bluetooth in Linux, and that's the focus of this hack.
First, make sure you have a supported Bluetooth adapter. You used to be able to find a reasonably current list of BlueZ-supported hardware at
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Hacks 1–22: Introduction
There is much talk in the communications industry of providing last-mile connectivity. Think of Bluetooth as providing connectivity for the last 10 feet. Bluetooth excels as a handy cable-replacement technology, helping to eliminate the need for cumbersome wires that you might find on headsets, remote controls, PDAs, and other small devices. Bluetooth aims to end the days of needing to carry a three-foot piece of cable with obscure connectors on either end everywhere you go, just to interface to your laptop. You can use Bluetooth-enabled devices to talk to a laptop or a desktop, or even have them talk to each other to exchange data almost effortlessly. This chapter presents hacks on getting Bluetooth working with a wide range of devices and then doing some very interesting tricks.
If you can provide connectivity for the last 10 feet, how do you find yourself on this blue-green sphere we call Earth? The global positioning system (GPS) has migrated from being a military-only technology to something that is built into cars, phones, and a number of other devices. In this chapter, you can learn how to do some very unusual things with GPS that the designers probably never intended.
Mobile phones are everywhere. For many people, they have become the sole telephone of choice, enabling them to abandon land lines altogether. When you combine a mobile phone and Bluetooth, even more hacks become possible.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Set Up Bluetooth on Linux
Linux kernels from 2.6 onward have easy-to-use tools for Bluetooth.
Prior to the release of the 2.6 Linux kernel, getting Bluetooth support involved compiling your own kernel as well as the necessary utilities. There were also multiple Bluetooth stacks available, each with their own features, adapter support, and quirks. In 2.6, the BlueZ stack was crowned as the officially supported way to use Bluetooth in Linux, and that's the focus of this hack.
First, make sure you have a supported Bluetooth adapter. You used to be able to find a reasonably current list of BlueZ-supported hardware at http://www.holtmann.org/linux/bluetooth/devices.html. However, as of March 2005, this information has been removed because of threatened legal action from the Bluetooth SIG. What this basically means is that the association of companies who maintain the Bluetooth standard don't want anyone to advertise that their devices are compliant with Linux unless you pay the SIG a lot of money and fill out a bunch of paperwork. So, you're on your own here. Probably the best place to get advice is in the BlueZ Users mailing list, which can be found at http://www.bluez.org/lists.html.
Next, you'll need to make sure that your kernel has Bluetooth support enabled. All distributions shipping the 2.6 kernel have Bluetooth support. 2. 4 kernels shipped with both the Red Hat 9.0 and Debian Sarge distributions already include Bluetooth support. You can test your kernel for Bluetooth support by running modprobe rfcomm as root. If the modprobe fails, you'll need to install the packages that support Bluetooth.
Red Hat and Fedora users should install these packages using yum or rpm. This assumes you're using GNOME as your window manager:
	yum install bluez-utils gnome-bluetooth
Likewise, Debian and Ubuntu users should install using apt:
	apt-get install bluez-utils gnome-bluetooth
This next bit is for UART-based (that is, non-USB) devices only, so if you're using a USB Bluetooth adapter, you can skip ahead. Serial-style USB devices, which include serial dongles and PCMCIA cards, need to be explicitly
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Set Up Bluetooth on Windows XP
The Bluetooth wireless standard is a great way to get computers and gadgets talking to each other. Here's how to set it up on Windows XP.
Bluetooth wireless support is showing up in all sorts of devices these days, and the software is easy to use. Few consumers know about it or know how to use it, though. This hack will expose you to the basics of Bluetooth and how to set up some Bluetooth devices, and it will point you to some good sources of information about the ways you can use Bluetooth in your life.
Some people confuse Bluetooth with the 802.11x standards (Wi-Fi), since they are both wireless technologies. But Wi-Fi is intended primarily for Internet data and connecting computers, while Bluetooth is used to communicate between a wide variety of devices. Where WiFi needs to get into every corner of your world to be effective, Bluetooth is best at short ranges. In fact, the effective range of most Bluetooth communications is about 32 feet (10 meters).
Bluetooth can be used to connect all kinds of different devices—PCs, cell phones, cell phone headsets, PDAs, keyboards, portable game systems, audio headphones, GPS receivers, printers, digital cameras, barcode scanners, medical equipment, and even your car. Each device supports one or more profiles that dictate what types of devices it can communicate with and how that communication will take place. If two devices share a profile, they can communicate; otherwise, they will not even make the attempt.
My own initiation into Bluetooth was when I needed a new mouse for my laptop. I had avoided buying one of the infrared wireless mice because of the line-of-sight issues, but a Bluetooth mouse seemed like just the ticket. I purchased a Bluetooth wireless mouse and a Bluetooth dongle that plugs into my laptop's USB port. In addition to the dongle-type adapters, you can also get permanent Bluetooth cards that go into the PCI slot of your desktop computer. The installation procedure is mostly the same.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Connect Mac OS X with a Bluetooth Phone
No hotspots nearby? Use your Mac and a Bluetooth phone to get online almost anywhere.
If your mobile phone plan [Hack #17] gives you some flavor of cellular data access—GPRS, EDGE, 1xRTT, or any of their acronym cousins—you can use that access with a Bluetooth phone and your Mac to get online. The benefits are obvious: you don't need a wireless access point in range, you don't have to pay for access to a hotspot, and a mobile signal is available (almost) everywhere.
Mac OS X makes cellular data access simple. If you are setting up your Bluetooth phone with your Mac for the first time, follow along and you'll be using your cellular data minutes in, well, minutes!
Obviously, you're going to need a Mac with Bluetooth. Bluetooth has come standard with most PowerBooks for a couple years now or as an option on many other Mac models, including iBooks, PowerMacs, and iMacs. Third-party Bluetooth adapters are also available from vendors such as D-Link, for practically any Mac with a USB port.
Secondly, you'll need a Bluetooth-capable phone. Apple maintains a list of phones (http://www.apple.com/macosx/features/isync/devices.html) known to work with the iSync program that ships with Mac OS X 10.3 and later. There are also many Bluetooth phones not on this list that will happily pair with your Mac and which can be used to connect you to the Internet. Ross Barkman maintains a page (http://www.taniwha.org.uk) with updated modem scripts and information on Bluetooth mobile phones for use with Mac OS X.
Mac OS X gives you a handy Bluetooth icon in the menubar. Click here to get a drop-down menu like the one shown in Figure 1-6. Choose "Set up Bluetooth Device…" to get started.
Figure 1-6: Bluetooth menubar
Make sure your mobile phone is turned on, you have Bluetooth enabled, and your phone is discoverable. You'll be prompted in a new window on your Mac to select a device type. Choose Mobile Phone, and click Continue. Mac OS X will search using Bluetooth to locate your phone, as shown in Figure 1-7.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Connect Linux with a Bluetooth Phone
Use your Bluetooth phone as a modem when Wi-Fi isn't available.
No doubt the novelty of being able to scan for nearby Bluetooth devices from your Linux machine will wear off all too soon, and then you'll want to actually do things with your shiny new Bluetooth connection. Being able to use your cell phone as a modem from all those places you can't pull in a Wi-Fi signal would be pretty cool, wouldn't it?
Bluetooth supports a number of profiles, which define the way that Bluetooth devices can communicate with each other. In this case, we want to make use of the Dial-up Networking (DUN) profile, which relies on a protocol called RFCOMM to emulate a serial link between two devices. You can use RFCOMM to connect your Linux box to your phone, and then run pppd over the link to get access to the Internet. This should work using various mobile data protocols including CDPD, GPRS, EDGE, 1xRTT, and 1xEV-DO. More information on the various mobile data acronyms can be found in Appendix A.
Assuming you've got Bluetooth working [Hack #1] , you should be able to bring your phone within range of your computer and scan for it using hcitool. We'll presume that you've done this, and that hcitool reports a BD address for your phone of 00:11:22:33:44:55.
You can also use sdptool to verify that there's a device in range that supports the DUN profile:
	sdptool search DUN

	Inquiring …
	Searching for DUN on 00:11:22:33:44:55 …
	Service Name: Dial-up Networking
	Service RecHandle: 0x10001
	Service Class ID List:
	  "Dialup Networking" (0x1103)
	  "Generic Networking" (0x1201)
	Protocol Descriptor List:
	  "L2CAP" (0x0100)
	  "RFCOMM" (0x0003)
	    Channel: 1
Note this channel number, because you'll need it later. As you can see, hcitool and sdptool offer a lot of other useful Bluetooth diagnostic functions, which you can read more about on their respective manpages.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Connect Windows XP with a Bluetooth Phone
Don't worry about normal phone dial-up connections, hotspots, or WiFi. No matter where you are, the Internet is with you, as long as you have a Bluetooth-enabled phone.
Lots of phones these days include Bluetooth connections, and if you have one, Internet access for your Windows XP laptop is only a phone call away. All you'll need to do is fire up your laptop and phone, connect them to one another, and make the Internet connection. To do this, you'll of course need a laptop with Bluetooth capabilities as well.
If your laptop doesn't have Bluetooth capability, it's easy to add. You just need a USB Bluetooth adapter. Companies such as D-Link, Keyspan, Belkin, and many others sell them, often for around $30. Just plug the little device into your USB port, follow installation instructions, and you'll be set.
Don't expect broadband connection speeds when you do this—at least not yet. The exact connection speed you'll get varies according to the precise technology your cell phone uses and, of course, depending on the quality of your current cell phone connection. These days, though, expect 20 to 40kbps with a GSM/GPRS cell phone, 20 to 150kbps with EDGE, about 50 to 120kbps with CDMA 1xRTT, and from 300 to 500kbps with CDMA 1xEV-DO. If you don't know which technology your cell phone uses, check with your cell phone carrier, and they'll let you know.
The exact screens you'll see when you make the connection will vary somewhat from phone to phone, so for this hack I'll show you how to do it with the Sony Ericsson T68i Bluetooth-enabled phone. The steps with other Blue-tooth-enabled cell phones should be very similar.
First, turn on your cell phone and laptop, and make sure they're within range of one another. Then turn on the phone's Bluetooth radio. To do this on the Sony Ericsson T68i, press the joystick button and select Connect Bluetooth Options Operation Mode On.
Next, you'll have to make the phone discoverable so that your laptop can find it. On the Sony Ericsson T68i, press the joystick button and then select Connect
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Use Your Treo as a Modem
Use your Palm Treo to connect your laptop to the Internet. You can also use your Treo as a backup Internet connection for your desktop machine.
If you've signed up for your carrier's wireless data plan, you can get the entire Internet on your Treo. It may not seem like it at times, because the small screen can really constrain your web-browsing experience when compared to, say, your laptop or your desktop computer, but it's all there— every last byte. Better still, it is possible to feed the Internet connection of your Treo through to your laptop computer. This is called tethering, and it allows your tethered laptop to work with the Internet as if it were connected via a normal dial-up, cable, or DSL modem—except that you are connected through your Treo. Anywhere your Treo has enough signal strength to connect to its wireless data service, you can tether it to supply a laptop with Internet.
Setting up tethering is specific to the model of your Treo and your cellular service provider, as summed up in Table 1-2. You use either your Treo 650's Bluetooth connectivity to use the Treo as a wireless modem for your laptop or desktop, or you need a third-party Windows application called PdaNet, which allows you to connect your Treo (as a modem) to your laptop or desktop via the USB sync cable.
Tethering might be frowned upon by your carrier. Carriers will argue that tethering is abusing a network infrastructure that is set up in anticipation of the light bandwidth consumption of average smartphone users. Power users will argue that when paying $45 per month for "unlimited Internet," you are entitled to get that for which you've paid. So it's important that you become familiar with your service provider's policy on tethering if you plan to use it frequently—you may be surprised.
Table 1-2: Wireless providers
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Send SMS from a PowerBook
Stop fiddling around with your phone's keypad and use a PowerBook for text messaging.
Short Message Service (SMS) is better known as text messaging for mobile devices. It has proven to be surprisingly popular in many parts of the world (particularly Japan, the Philippines, and much of Europe), but for one reason or another has been less than enthusiastically received in the United States. Part of the barrier to entry for many people is the sometimes painful text entry interface on most mobile phones.
The demand for tiny phones has squeezed out virtually all hope of a usable integrated keyboard. While predictive text technologies such as T9 have helped make typing require fewer keystrokes, the interface is still far from intuitive. Many people find themselves obsessively hitting number keys in a feeble effort to express themselves, most times mistyping one or two letters along the way. And entering punctuation marks and symbols is so inconvenient that most people don't bother.
If you have a Bluetooth-enabled phone, there is a better way. Mac OS X provides some good integration with these devices and SMS.
A complete list of phones supported by Mac OS X is available at http://www.apple.com/macosx/features/isync/devices.html.
To get started, be sure that Bluetooth is enabled and that your phone is paired with your laptop. When you launch Address Book with Bluetooth enabled, you will notice an extra Bluetooth button at the top-left corner of the window, as shown in Figure 1-19. Click this button to enable Bluetooth integration in Address Book.
Figure 1-19: Bluetooth integration in Address Book
Having Bluetooth enabled turns on a number of useful features. In addition to being able to simply dial the number directly from an Address Book entry, you can also send an SMS message. Click the label to the left of the number you want to message (Figure 1-20) and select SMS Message. This opens a small textbox for you to type in your message. Lo and behold, you can use your standard keyboard to enter SMS messages!
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Remote Control Mac OS X with Bluetooth Phones and PDAs
Use your phone/PDA as a remote control for presentations or media players, and create new remote functions with AppleScript.
The Salling Clicker is one of the best applications available for Bluetooth. It turns a whole range of Bluetooth-capable mobile phones and PDAs into fullcolor, programmable remotes for Mac OS X. You can launch applications, control presentations in PowerPoint or Keynote, and use it as a general-purpose mouse. It plays media files in iTunes, DVD Player, and VideoLan Client and now supports the EyeTV and AlchemyTV digital video recorders (DVRs).
The software works with 21 models of Sony Ericsson phones, 12 Nokia phones, a couple models from Motorola, and it supports almost all PalmOS 4 or 5 devices with PalmSource Bluetooth. A complete list of supported devices is listed in the FAQ at http://homepage.mac.com/jonassalling/Shareware/Clicker/faq.html#supported_devices.
You can download the software directly from the author's web site at http://homepage.mac.com/jonassalling/Shareware/Clicker/. The application is shareware and costs $19.95. A trial version, limited to 30 clicks from your remote, is also available.
The download package comes with a basic installer, which will install itself as a new control panel and automatically launch. In order for you to use Salling Clicker, your phone or PDA must be paired with your Mac. If you haven't done this already, run the Bluetooth Setup Assistant, found in /Applications/Utilities.
After software installation, Salling Clicker appears as a new item in System Preferences. When you open the new preferences item, a small circular icon will also appear in the menu bar, as shown in Figure 1-22. Click Select Phone, and ensure that your phone is on and somewhere near your computer and that you have Bluetooth enabled on your Mac.
Figure 1-22: The Clicker's menu bar icon
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Remote Control Linux with a Bluetooth Phone
Never fear, Linux users! You too can control your machine with a Bluetooth phone.
Continuing with the remote control theme, here's an option for Linux users who would like to have functionality similar to Salling Clicker [Hack #8] or PuppetMaster [Hack #13] .
Bluemote is a software package written specifically to take advantage of the capabilities of a Sony Ericsson phone. We tested it using a T630, but several other models from the same manufacturer should also work. Many of the steps in this hack are similar to the next hack [Hack #10] . In fact, Bluemote was inspired by the bluexmms application, extending this control to the operating system.
In order to get Bluemote working, you'll need a working Bluetooth stack and utilities [Hack #1] and a Sony Ericsson phone that is paired with your computer [Hack #4] . Download the software itself from http://www.geocities.com/saravkrish/progs/bluemote. You will also need a copy of the scripts the author has developed for the package, found at http://www.geocities.com/saravkrish/progs/bluemote/scripts.tar.gz.
Uncompress the Bluemote package. In the newly created bluemote directory, there is a compiled bluemote binary file. The author states that the binary was compiled under Fedora Core 1, and we had no problem running it on later versions of Fedora Core or Ubuntu Linux. The source code is also provided, should you wish to compile it yourself. It's a good idea to copy bluemote to somewhere in your path, such as /usr/local/bin.
Next, uncompress the scripts package. Bluemote looks for the newly created scripts directory in your user home directory, so if it isn't there now, you should move it appropriately. To take advantage of the scripts for volume control, you will need to install the aumix software. Ubuntu and Debian users can install it with apt-get install aumix
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Control XMMS with Bluetooth
Use your Bluetooth phone to control your music remotely under Linux.
If you have a mobile Bluetooth device that you'd like to use to control the XMMS media player in Linux, you might be in luck. There are actually a couple of applications out there that use a WAP-like serial interface to Sony Ericsson's T-series phones (including the T68i and the T39m) to configure them for use as XMMS remote controls.
The first of the two is a standalone Ruby-based application called bluexmms, which is available from http://linuxbrit.co.uk/bluexmms. Make sure your phone is paired [Hack #4] with the Bluetooth interface on your computer. Install bluexmms, and then use rfcomm to bind an RFCOMM device to channel 2 on the T68i, which is the T68's generic telephony service.
Next, run bluexmms /dev/rfcomm1 on your device, substituting the name of the RFCOMM device you just created. You should now be able to go to Accessories XMMS Remote on your phone's menu, and voilà! You can now control XMMS directly from your phone.
A second, but similar approach, involves an XMMS plug-in called BTE (a.k.a.btexmms), which can be downloaded from http://www.lyola.com/bte. Build and install the plug-in, and create an RFCOMM device on channel 2, as just described. Then, go into the XMMS preferences menu and, under Effects General Plugins, enable and configure the BTE Control plug-in. Set the device to whatever RFCOMM device you created for this purpose, and save your changes. Now you should be able to access the remote control from Accessories XMMS Remote, as described previously.
If you don't have a Sony Ericsson T-series phone, you might try Bemused, which runs on SymbianOS devices, such as the Nokia 3650/7650 and the Sony Ericsson P800. Unlike the T68 apps just listed, which rely on the computer to establish a connection to the phone, Bemused instead uses a client that initiates the connection from your phone to a server running on your computer.
You can get the Bemused server and client from
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Liven Up Parties with a Participatory Slideshow
With a laptop, a Bluetooth adapter, and an LCD projector, you can make slideshows of other people's photographs.
Since time immemorial, slideshows have been a dreaded tool of oppression and tedium. Heretofore constrained to only the slides that the presenter wished to show, the slideshow's audience was doomed to mind-numbing boredom, if it turned out that the slides failed to entertain.
Thanks to the ubiquity of mobile phones with both cameras and Bluetooth, the institution of photographic slideshows can now be thrown open, willy-nilly, to the viewing public as both a read and write medium! Allowing people to contribute photos from their phones to a participatory slideshow can offer interesting and often quite entertaining results.
To set up a participatory slideshow, you'll need a laptop or a PC running Linux, a supported Bluetooth adapter, and an overhead projector. The concept of this hack can certainly be adapted to other operating systems, but the implementation shown here is specific to the Linux Bluetooth stack and to the X11 Window System used on most open source operating systems. The best Linux distros for this purpose are Debian or Ubuntu, because all of the pieces are already available through apt-get.
If you haven't got a Linux PC handy, Ubuntu (http://www.ubuntulinux.org/download) can be installed on an old leftover Pentium in about a half hour. If you use Ubuntu, you'll want to make sure you have the universe and multiverse repositories in your /etc/apt/sources.list. If you're using another version of Linux, you should be able to find the source code and possibly even binary packages for all the software you'll need somewhere on the Net.
Once you've selected a suitable computer, install the BlueZ Bluetooth stack [Hack #1] . Next, plug in your Bluetooth adapter, and make sure the kernel can see it by running dmesg and checking for a suitable notification towards the bottom of the output. (If your Bluetooth adapter is built-in,
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Send SMS from Linux
Tired of one letter typing on your phone keypad? Send complete SMS messages from Linux instead.
As shown in "Send SMS from a PowerBook" [Hack #7] and "Control Your Bluetooth Phone with FMA" [Hack #14] , it's relatively simple to set up your Bluetooth phone so that you can send Short Message Service (SMS) text messages using your computer. Fortunately, there's also a way to do this in Linux.
In order to make this work, you'll need to have your Bluetooth phone paired and configured as a dial-up networking device [Hack #4] . Once those tasks are done, your phone will be communicating with your Linux box using Bluetooth, and you will have a new serial device mapped to /dev/rfcomm0 that you can use.
What this means practically is that you can treat your Bluetooth phone as a modem, and send it standard AT commands, using any serial terminal program like gkermit, minicom, or screen.
To find out whether your phone lets you send SMS messages using AT commands, you'll need to connect to your phone with one of these programs, and execute the query AT+CSMS=0. Here is an example using the screen program:
	screen /dev/rfcomm0
	ATE1 #this won't be echoed to the screen, but it turns echo on
	OK
	AT+CSMS=0
	+CSMS: 1,1,1

	OK 
The output after the AT+CSMS=0 command is listed in three columns, which indicate whether the device is capable of receiving messages, sending messages, or sending broadcast messages. In this case, the phone is capable of all three.
If your cell phone supports this capability, you can work with text messages using AT commands. You can list your text messages with AT+CMGL=4 (the 4 indicates all messages: use 0 for unread, 1 for read, 2 for unsent, and 3 for sent messages) and read a message with AT+CMGR= MESSAGE_NUMBER:
	AT+CMGL=4 
	+CMGL: 1,1,,28 
	07919170389103F2040B91XXXXXXXXXXF100013011320211500A0AD3771D7E9A83DEEE10 
	+CMGL: 2,1,,25 
	07919170389103F2040B91XXXXXXXXXXF100013011329135610A06C8F79D9C0F01

	OK 
	AT+CMGR=1 
	+CMGR: 1,,28 
	07919170389103F2040B91XXXXXXXXXXF100013011320211500A0AD3771D7E9A83DEEE10

	OK
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Remote Control Windows with Bluetooth Phones and PDAs
Use your phone/PDA as a remote control for media, presentations, and other programs.
If you're a Windows user, you've probably skimmed "Remote Control Mac OS X with Bluetooth Phones and PDAs" [Hack #8] and thought, "Why can't I do that?" Well, you too can control your PC via Bluetooth, with a wide range of phones and PDAs.
Most PCs, aside from some newer laptops, do not come with built-in Bluetooth. To take advantage of the programs in this hack, you'll need a Bluetooth adapter. USB-based adapters are available for as little as $20. Some of these devices are low-power Class 2 devices, transmitting up to 10 feet, while other Class 1 devices have extendable antennas and claim to cover upwards of 300 feet. If you're planning on using the device with software for presentations, the longer-range models are probably what you want.
Windows requires drivers to operate with your Bluetooth device. Windows XPcomes with built-in Bluetooth driver support, and if your USB device is recognized when you insert it, we recommend that you use the Microsoft drivers [Hack #2] .
In our examples, we were not able to get our USB Bluetooth adapter to work with the third-party drivers that shipped with the unit. Uninstalling those drivers and allowing the Microsoft drivers to detect the device resolved the issues.
This hack uses PuppetMaster software, which is available from http://www.lim.com.au/PuppetMaster. If you are in doubt about the capabilities of your Bluetooth phone, check that site for more information on device support. While PuppetMaster supports a variety of phones and PDAs, we tested using a Sony Ericsson T630. Setup and capabilities in these programs vary from phone to phone, so be sure to check to see if your phone is supported.
In addition to a Bluetooth adapter, PuppetMaster requires Windows 2000 or XP and one of the following mobile devices with Bluetooth onboard:
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Control Your Bluetooth Phone with FMA
flOat's Mobile Agent lets you take complete control of your Bluetooth phone.
flOat's Mobile Agent (FMA) is a whole different program design than PuppetMaster [Hack #13] . While it does allow you to control your PC remotely from your Bluetooth phone, it also is a complete synchronization utility, allowing you to edit your phone contacts; store, sort, and send text (SMS) messages; and much more.
You can get the binary installer or the source code from http://fma.sourceforge.net. This is an open source package licensed under the GPL, so if you're a Windows programmer, you can hack away at the source code all you like.
FMA is designed around the capabilities of the Sony Ericsson T610/T630 phones. Many other phones have been tested, but there is no central list of known working phones. You will need to search for your phone by clicking the Tested Devices link on the FMA web site, which will take you to a SourceForge bug reports page.
The program is also somewhat different from PuppetMaster in that, in addition to Bluetooth, it also supports infrared and serial phone connections. For serial support, you can use Windows 98 or greater; infrared requires Windows 2000 or greater, and Bluetooth is supported on Windows XP only.
Bluetooth requirements are the same as for PuppetMaster. FMA supports both native (Microsoft) Bluetooth drivers and third-party drivers. Unlike PuppetMaster, we were required to pair our T630 phone with the test PC before FMA would communicate with the phone. FMA can talk to your phone in several ways. As shown in Figure 1-32, you can tell FMA which COM port has been mapped to the phone; you can specify the MAC address of your phone for the Native Bluetooth drivers; and you can also use infrared if your phone supports it.
While the FMA setup is similar to any other program you've installed in Windows, there are a couple sections that you should be familiar with prior to installation. The first is the selection of components, shown in Figure 1-33. If you opt to not install the Microsoft Components, FMA will not work correctly until it is reinstalled with the components.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Control Your Computer from Your Palm
Have you ever wanted to do something on your computer from across the room? How about from the other side of the world?
It can be useful to be able to access your desktop machine remotely. You could check server logs, restart failed services, or even post to your weblog. If you have a home network, you can set up all of your computers so that they are accessible remotely.
Virtual Network Computing (VNC) is an open source application that is designed to allow one machine to control another machine over a network. It was originally developed at Bell Labs. VNC is also useful for collaboration. Multiple viewers (clients) can connect to the same server. Each viewer has its own cursor. You can use these cursors to point to content on the remote machine. The viewers display the cursors for all of the other viewers as well. Each cursor is displayed differently from the others so you can tell them apart.
The server side comes in Windows, Mac, and Linux flavors. You can download these versions and get more information from the main VNC web site (http://www.realvnc.com). There are other versions of VNC available as well. For Windows and Linux machines, there is TightVNC (http://www.tightvnc.com). For Windows, there is also UltraVNC (http://www.ultravnc.com), which supports server-side scaling. For Macs, you will need OSXvnc (http://www.redstonesoftware.com/vnc.html). The built-in VNC on Macs doesn't work with PalmVNC.
You will also need an application to access the server. In typical computer-speak, this application would be called the client, but VNC uses the term viewer instead. The Palm viewer is called PalmVNC (http://palmvnc2.free.fr). You can also download UltraVNC for Windows with PalmVNC.
For a different kind of remote control experience, check out the Pebbles Project (http://www.pebbles.hcii.cmu.edu/), which makes a variety of remote control products for Palm devices. For example, their SlideShow Commander is a specialized application for remotely controlling PowerPoint Presentations. If you're on a Mac, check out Salling Clicker
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Control Your Home Theater from Your Palm
You know that stack of infrared (IR) remotes that's always spilling onto the floor? Your Palm can take the place of all of them.
You need software to convert your Palm into an infrared (IR) remote. Two choices are OmniRemote (http://www.pacificneotek.com) and NoviiRemote (http://www.novii.tv). You should look at the home theater devices that these two programs support and pick the one that is compatible with your gear.
If neither program covers all of your devices, then you have a couple of choices. If you have the remotes for your devices, and you are looking at simplifying down to just your PDA, then you can switch the applications into learning mode. Line up the remote and your Palm device on a flat surface with the IR end of the remote pointed at the IR port on your PDA and run through all of the important buttons on the remote. Save the buttons for each device under a unique name.
If you are missing some of the remotes, then you can try to find an IR code library on the Web. One good source is RemoteCentral (http://www.remotecentral.com), which has IR files under the Files tab on the home page. The files for the Philips Pronto can be used with OmniRemote by using a converter from the OmniRemote web site. If you can't find your specific device, then try to find a similar device by the same manufacturer.
Once you have all the codes for the devices you want to control, it is time to create button layouts. There are a variety of interesting button layouts on the Web. The web sites for the IR software have some button layouts, as does RemoteCentral. You can look at these for inspiration.
You should keep in mind what you want to do with each button layout that you create. For example, a common layout is watching DVDs. To do this, you may need to turn on the TV, DVD, and home theater systems. You could combine these actions into a macro, then have a single Power button that turns everything on. You might also need volume, play, pause, stop, fast forward, rewind, menu, and arrow keys. A button layout for watching TV might include a number pad, and channel-up and channel-down buttons.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Choose a Cellular Data Plan
If you're going to use your phone to connect to the Internet, make sure you've got the right data plan.
Your cellular phone can connect you to the Internet in a lot of ways, but it's going to cost you. Before you commit to a costly data plan, you need to consider what you'll do with the phone. Will you send and receive email on the phone? Do you plan to send a lot of camera phone pictures or video clips? How about posting to your weblog [Hack #18] ? And most important, will you use your phone to connect (tether) your laptop to the Internet [Hack #4] ?
It's possible for you to use your phone for a lot of what your computer can do, and yes, there are plenty of hotspots around for that data fix when you need it. But I think you'll give in and tether eventually—just wait until the first time you open up your laptop and find no WiFi signal while your phone is showing five bars!
We will use the word tether even when referring to wireless methods of using your handset, such as the Bluetooth connection.
Data plans come in two flavors: metered and unlimited. With a metered plan, you get anywhere between 1 and 20 MB per month as a base allotment, and if you go over, you pay by the kilobyte. There are two types of unlimited plans: handset plans and really, honest, we-mean-it unlimited plans that let you use your phone as a wireless modem for your laptop or PDA.
The phone typically relies on the wireless operator's data network to connect to the Internet. The underlying wireless network technology is known as the data bearer of the mobile data. Here's a quick overview of the data bearers available from today's wireless service plans.
GSM
The GSM network provides data access over the phone (data calls). It works in the same way as the dial-up modem on a PC. The benefit of this technology is that it is available everywhere you can get coverage. However, the drawbacks are the slow data rate (between 9.6 and 13.2 Kbps) and the dedicated phone call for the connection. Since the call must be connected for the entire data session, it counts against your airtime minutes. If you want to make a voice call, you must first disconnect the data call. GSM data is known as 2G (second generation).
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Blog from Your Mobile Phone
Use a mobile blogging service to post blog entries with pictures from your mobile phone.
Not long ago, bloggers could only update their blogs using a computer. Inspiration, however, does not always coincide with the presence of a bulky computer. At the turn of the century, some adventurous and creative bloggers started blogging from their mobile devices. The word moblog was thus coined, referring to blogging from a mobile device (mobile phones, PDAs, etc.).
If blogging without a computer is convenient, moblogging with a camera phone is exciting. In just a few clicks you can snap a quick shot and add a few punch lines, and minutes later the neatly formatted post on your personal blog can be shared with the entire world! Figure 1-53 shows a snapshot of O'Reilly editor Brian Jepson's moblog. You can see Brian's world through pictures taken from his phone camera and comments that captured his instantaneous thoughts. (The dry spell between November and March? That's when Brian used a phone without a camera for a few months before switching back to his Nokia 3650.)
There are two major approaches to moblogging, regardless of the myriad phone models and their different capabilities: SMS moblogging and email moblogging. This hack introduces and compares these two methods, with an emphasis on the latter.
Instead of email, you can also use MMS to post blog entries from your camera phone. The MMS message is sent to an email address, and hence, MMS moblogging is essentially the same as email moblogging.
SMS moblogging works on any handset that can send SMS, which is virtually every mobile phone nowadays. You write the blog entry on the mobile phone and send it via SMS to a service phone number provided by a moblog service. The moblog service interprets the received SMS message and posts it to your blog. You can be identified by the caller ID or an ID code embedded in the SMS message. A good example of such an SMS moblog service is Txtsolutions (
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Get Google Maps on Your Mobile Phone
Turn your Java-enabled cell phone into a portable mapping appliance.
If you have a GSM phone from the last three years or so, you (probably) have a powerful mobile mapping appliance in your pocket.
Mobile GMaps is a free program that lets you view Google Maps on your cell phone. It is limited to J2ME (Java 2 Mobile Edition) enabled phones, such as the Symbian Series 60 and Series 80 phones. The program is available at http://www.mgmaps.com. Read the instructions on the download page at http://www.mgmaps.com/download.php.
The easiest way to install the app is to use your phone's browser to go to http://wap.mgmaps.com. Then click on the Download link, and agree when it asks if you want to download and install the application.
When the program completes installation, you'll get a completed message and then be returned to the http://wap.mgmaps.com page. You can now exit from your phone's web browser. On my Nokia 3650 the program MGMaps installed into the Apps folder. Click on the application, and then select Start from the Options menu.
By default you will see a map of the United States fully zoomed out. You can navigate with the 2, 4, 6, and 8 keys. Zoom in with 5 or # and zoom out with 7 or *. Figure 1-56 shows Mobile GMaps on a Nokia 3650.
Figure 1-56: Mobile Gmaps on a Nokia 3650
Selecting Options gives you a menu of Satellite, Zoom, Location, Search, Settings, About, and Exit. Satellite flips you to Satellite imagery. Zoom brings up a menu that lets you zoom in, zoom out, or select a zoom level from 0–14. Locations are like waypoints on a GPS. You can set latitude, longitude, zoom level, and map or satellite view, and then return to that view from the Location menu. Search brings up a search screen that calls the Google search system.
There are a number of tricks and hints on the GMaps web site. Mobile GMaps was written by Cristian Streng. It is released under the Attribution/ NonCommercial/NoDerivs Creative Commons license. This means that you can use and distribute the program for free, but you can't make derivative works or use it for commercial purposes.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Share Your GPS
Caravanning with friends, but only one person has a GPS? Play nice and share.
Road trip caravans are more fun when the people in the two cars can communicate with each other. People have used CBs and Family Band Radio Service (FRS) radios for years just for this purpose. If you want to exchange data instead of voice over radio, you can set up a roving Wi-Fi network and then share a GPS between vehicles.
Connect a GPS to one computer and then set up a wireless network. Clients in other vehicles can connect to the GPS on the host machine. Normally, only one program at a time can access a serial port–connected GPS. This can quickly become a problem. You probably want to run gpsmap [Hack #22] to get maps, and then a program to log your position, and perhaps another program to let you create spatial annotations of your travels.
That is way too many connections for a single-user serial port! Fortunately, GPSd is available as a daemon that connects directly to the GPS and then acts as a server for position information. Once you have GPSd installed, all of your GPS aware applications can share a single GPS.
GPSd is available at http://gpsd.berlios.de/. It runs under Linux, FreeBSD, Mac OSX, and any POSIX compliant Unix variant. You can build and install GPSd in the standard way, as shown here, but do follow any current instructions from the web site (replace x.xx with the current version):
	$ tar xvfz gpsd-x.xx.tar.gz
	$ cd gpsd-x.xx
	$ ./configure
	$ make
	$ make install
Most GPS units have a serial port and can be configured to output the current position using a standard protocol called NMEA. GPSD expects your GPS to send NMEA formatted data, but can also accept data in different formats. Check the GPSd site for how to enable other formats if you have a GPS that does not output standard NMEA sentences.
Once it is installed you can run it with this command:
	              $ gpsd -p /dev/ttyS0 -s 4800
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Broadcast Your GPS Position
Entertain yourself and passing wardrivers by abusing the beacon frame (and MAC address).
Have you ever wanted a lightweight protocol that would allow you to broadcast your current position? Many times you can see a wireless network, but you can't connect to it. In the NoCat community network (http://nocat.net) we would often do sight surveys that showed lots of networks, but we could not associate with them. Perhaps the access point has a more powerful network card, or a better antenna, and is able to blast a signal out, but you are not able to get your signal back to the access point.
What to do? With a complete abuse of the 802.11 beacon frame you can share your position with anyone around you!
802.11 wireless networks in both Ad Hoc and Infrastructure mode [Appendix A] send periodic beacon frames. These are about 50 bytes long and contain information that a client needs in order to associate with a wireless network. The beacon frame includes the Service Set Identifier (SSID), which is the name of the network.
Wireless discovery programs such as NetStumbler [Hack #24] , iStumbler [Hack #27] , and Kismet [Hack #29] get all of their information from sniffing for these beacon frames. So what happens if we change the SSID on the access point? What happens if we change it whenever we get a new GPS fix?
For our purposes the SSID, at 32 bytes, provides enough room to encode the latitude and longitude of our current position to 5 digits of precision (about 1 meter). We can also separate the coordinates with readable delimiters and still have 11 characters for a unique station ID.
To run this hack, you need to have a DIY Linux access point [Hack #63] . Then, set up the GPSd daemon and connect a GPS [Hack #20] .
Once you have your access point and GPSd functional, use the Perl script in Example 1-2 to broadcast your current position by using the beacon frame.
Additional content appearing in this section has been removed.
Purchase this book now or read it online at Safari to get the whole thing!
Map Wi-Fi Networks with Kismet and GPSd
Use these two powerful Linux tools to map out the locations of Wi-Fi networks.
GPSd [Hack #20] is a great tool to get data from your GPS receiver. You can make it even more powerful by combining it with Kismet [Hack #29] , allowing you to physically map locations of wireless networks.
In order to make this work, you will need to have both GPSd and Kismet installed and functioning with your Linux system. Consult the hacks on both pieces of software if you have setup questions.
If you plan to do some network mapping with Kismet, keep the following in mind:
  • Put the computer somewhere safe and out of the way. Don't put it someplace where a sudden stop will send it into your lap or through a window.
  • Forget that the computer is there while you are driving. If you have to fiddle with it, pull over first. If you can have a friend ride with you who can operate the computer, all the better. Do not let the computer distract you while you are driving.
  • Make sure that the GPS gets a fix before you start driving. It's a lot harder for it to get a fix while you are in motion.
  • Put the GPS somewhere that it can easily pick up the satellite signals. Your best bet is to get a magnetized external antenna that can attach to your roof. Be sure that there are no loose wires sticking out of your window. Don't slam the wires in the door!
Above all, when you are driving a car, your first responsibility is to drive safely. Pay attention to the road and drive carefully.
To begin mapping networks with Kismet and GPSd, take the following steps:
  1. Load any modules needed for the serial port you're using for the GPS (optional):
    	                 $ sudo modprobe pl2303
    	                 $ dmesg | grep tty
    
    	ttyS00 at 0x03f8 (irq = 4) is a 16550A 
    	ttyS02 at 0x03e8 (irq = 4) is a 16550A 
    	usbserial.c:PL-2303converternowattachedtottyUSB0(orusb/tts/0for 
    	devfs)
    
Additional content appearing in this section has been removed.
<