Complete the following steps to develop a Bluetooth client application.
1. Request a connection to Bluetooth server – Use the Bluetooth Open Connection function to connect to a service on a Bluetooth server. Set the channel number to zero and specify a Bluetooth uuid to identify which service to connect to. The Bluetooth Open Connection function performs an SDP query to make a connection to the first service found with matching uuid. Internally, the result of an SDP query is an RFCOMM channel number to connect to. The SDP query is a tool to "translate" uuid to a channel number.
If you know the channel number associated with the service in advance, use the channel number instead of zero. Specifying a nonzero channel number bypasses the internal SDP query operation thus reducing the amount of time it takes to connect to the service. If the channel number is nonzero, LabVIEW ignores the uuid input parameter.
Note: You can use the Bluetooth RFCOMM Service Discovery VI to search for a valid channel number associated with a service on a remote Bluetooth device. This VI performs an SDP RFCOMM service discovery resulting in a channel number you can use to connect to the corresponding service on the remote Bluetooth device.
2. Read and Write data – Use Bluetooth Read and Bluetooth Write functions to exchange data with the server.
3. Close connection – Use Bluetooth Close Connection function to close connection to the server.
The block diagram of a typical Bluetooth client application looks similar to Figure 2.
Figure 2. Bluetooth Client Application
Refer to the following VIs for examples of creating a simple Bluetooth server and client applications:
- Simple Bluetooth Server VI: labview\examples\comm\Bluetooth.llb
- Simple Bluetooth Client VI: labview\examples\comm\Bluetooth.llb
- Simple Bluetooth Server (Palm OS) VI: labview\examples\PDA\pdacomm\PDABluetooth.llb
- Simple Bluetooth Client (Palm OS) VI: labview\examples\PDA\pdacomm\PDABluetooth.llb
- Simple Bluetooth Server (Pocket PC) VI: labview\examples\PDA\pdacomm\PDABluetooth.llb
- Simple Bluetooth Client (Pocket PC) VI: labview\examples\PDA\pdacomm\PDABluetooth.llb