nfrared communication is one of the most common forms of communication for devices today. If you've ever used a TV remote control, you've experienced the convenience of using infrared communications. While infrared communications require line-of-sight between the sending and receiving devices, they are a quick and cheap way of communicating between devices.
Most Windows Mobile devices you buy today come with an infrared port, but latley it seems like Bluetooth has been taking the limelight because it has a wider operating radius and most importantly it does not require line-of-sight in order to work. Despite this limitation, infrared requires no pairing of devices, and certainly does not require the hassles of exchanging secret pin numbers. For this reason, it is quite suitable for applications that require fast exchanges of information. For example, site surveyors may use Windows Mobile devices for taking photos, and at the end of the day they can simply transfer the images to a PC using infrared.
This article shows you how you can use infrared to communicate between a Windows Mobile device and a PC.
|What You Need|
- The System.Net.IrDA library, available in the .NET Compact Framework
- The 32feet.NET library, available here.
- An infrared USB adapter
Infrared Programming on Windows Mobile and PC
Using infrared on Windows Mobile Pocket PCs is easy using the System.Net.IrDA library, available in the .NET Compact Framework. What about using infrared on the desktop PC? Unfortunately, the .NET Framework does not come with the System.Net.IrDA library, which means you cannot use infrared using the .NET Framework directly. To do so, you'll need the 32feet.NET library,written by fellow MVP, Peter Foot (http://www.peterfoot.net/). This library makes infrared programming available to managed developers. 32feet.NET is a project that aims to make wireless networking (via Bluetooth and IrDA) much more easily accessible from .NET code, whether it's on mobile devices or desktop computers. You can download the latest version of 32feet.NET (v2.0.60828) from here.
In this article, you'll build two applicationsone for the Windows Mobile 5.0 Pocket PC and one for the desktop. The Pocket PC application allows users to transfer images to the desktop using infrared.