Developing Wireless PDA Applications in LabVIEW
Table of Contents
Overview
The growth of wireless communication in the past few years means you can stay connected to a network regardless of whether you are in your neighborhood coffee shop or across the country. No longer bound by the harnesses of wired networks, you can access and share information on a global scale. PDA devices and other mobile handheld devices make it easier than ever to develop remote applications that transmit and receive information from a remote site back to a host computer.
LabVIEW supports the Open System Interconnection (OSI) Model, so implementing wireless network communication in LabVIEW is very similar to implementing wired network communication. The 7-layer OSI model shown in Figure 1 separates the protocol details from user and networking communication. Wireless ethernet communication, also known as IEEE 802.11, is just a different layer of the OSI Model. The Bluetooth support in LabVIEW 7.1 increases the options for developing wireless applications using LabVIEW.

If the host and client computers contain support for wireless communication, you can use the LabVIEW Communication VIs and functions to create wireless applications. Remember to change the execution target in LabVIEW to a PDA device or emulator before you set up wireless communication.
Wireless TCP
Wireless TCP, like wired TCP, ensures reliable transmission across networks while delivering data in sequence without errors, loss, or duplication. The TCP Connection automatically retransmits the datagram, which contains the data and a header that indicates the source and destination addresses, until the TCP connection receives acknowledgment of the transmission.Use the LabVIEW TCP VIs and functions to interface with devices on a TCP network. Setting up a TCP connection is similar to setting up file I/O or instrument I/O communication. Communicating using TCP involves the following:
- Opening the connection.
- Reading and writing the data.
- Closing the connection.
TCP Client Example
Figure 2 shows a typical TCP client application that initiates a connection to a remote server.

Figure 2. TCP Client Communication Example
TCP Open Connection function--Opens a TCP network connection at address 192.168.0.1 using port 5020.
TCP Write function--Writes the data to the network connection you opened with the TCP Open Connection function.
TCP Read function--Reads a number of bytes from the TCP network connection.
TCP Close Connection function--Closes the TCP network connection.
TCP Server Example
Figure 3 shows a typical TCP server application that listens for remote connections and responds appropriately.

Figure 3. TCP Server Communication Example
TCP Listen VI--Creates a listener and waits for a TCP network connection at port 5020.
TCP Read function--Reads a number of bytes from the TCP network connection.
TCP Write function--Writes the data to the network connection.
TCP Close Connection function--Closes the TCP network connection.
Refer to the Using the LabVIEW PDA Module for Wireless TCP/IP Communication with Palm OS or Pocket PC 2003 Devices example program (linked below) for a wireless TCP example PDA application.
Bluetooth
Bluetooth applications allow wireless communication among devices within a 30-40 foot range.
Use the LabVIEW Bluetooth VIs and functions to communicate with devices that use the Bluetooth communication protocol. Setting up a Bluetooth client and server connection is similar to setting up a TCP client and server connection. The main programming differences between setting up TCP and Bluetooth communication is the following:
- You use a Bluetooth UUID to uniquely identify the service. The UUID must be in GUID format. An example of a UUID in GUID format is B62C4E8D-62CC-404b-BBBF-BF3E3BBB1374.
- You can use the Bluetooth RFCOMM Service Discovery VI, which uses the Service Discover Protocol (SDP), to broadcast the list of available services from a Bluetooth address. The SDP provides a way for the client application to perform a device discovery for other available Bluetooth devices and services. You also can open a direct connection, which is similar to opening a TCP connection which is illustrated below. There are advanced examples that ship with LabVIEW illustrating service discovery.
Other than using Bluetooth functions instead of TCP functions, the only difference between the TCP client application in Figure 2 and the Bluetooth client application in Figure 4 is that a Bluetooth UUID identifies the service to which the client is connecting.
Figure 4 shows a typical Bluetooth client application that initiates a connection to a remote Bluetooth server.
Bluetooth Open Connection function--Requests a connection to a Bluetooth server at address 00:0a:4f:00:0a:a6.
Bluetooth Write function--Writes data to a Bluetooth network connection.
Bluetooth Read function--Reads data from a Bluetooth network connection.
Bluetooth Close Connection function--Closes the Bluetooth network connection.
You also can use the Bluetooth RFCOMM Service Discovery VI to query for a valid channel number associated with a service on a remove Bluetooth device. The Bluetooth RFCOMM Service Discovery VI performs an SDP RFCOMM service discovery that results in a channel number you can use to connect to the corresponding service on a remote Bluetooth device.
Bluetooth Server Example
Other than using Bluetooth functions instead of TCP functions, the only difference between the TCP server application in Figure 3 and the Bluetooth server application in Figure 5 is that you must create a Bluetooth service identified with a Bluetooth UUID.
Figure 5 shows a typical Bluetooth server application that listens for remote connections and responds appropriately.
Bluetooth Create Listener function--Creates a service for a Bluetooth server and returns the Bluetooth channel the server can use to listen for incoming connections.
Bluetooth Wait on Listener function--Waits for the listener to accept a connection request.
Bluetooth Read function--Reads data from a Bluetooth network connection.
Bluetooth Write function--Writes data to a Bluetooth network connection.
PDA gen data VI--Contains the data to write to the Bluetooth network connection. This is a subVI that generates data--it is not a VI on the PDA palette.
Bluetooth Close Connection function--Closes the Bluetooth network connection.
You also can use UDP or IrDA protocols to set up a wireless connection. Refer to LabVIEW Help: Using LabVIEW with Wireless Devices (linked below) for more information about IrDA communication.
Related Links:
Developer Zone: Using the LabVIEW PDA Module for Wireless TCP/IP Communication with Palm OS or Pocket PC 2003 Devices
Product Catalog: LabVIEW PDA Module
Measurement Encyclopedia: OSI
External Link: IEEE 802.11 Standard
External Link: IEEE 802.11 The Working Group for Wireless LANs
External Link: The Official Bluetooth Wireless Info Web Site
LabVIEW Help: Using LabVIEW with Wireless Devices
Reader Comments | Submit a comment »
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).


