Complete the following steps to develop a Bluetooth client application using the LabVIEW Bluetooth VIs.
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 Simple Bluetooth.lvproj in the labview\examples\Data Communication\Protocols\Bluetooth\Simple Bluetooth directory for an example of using the Bluetooth Create Listener function.