Using Service Discovery

Once the audio gateway application has found a device that belongs to the audio headset class of devices, it needs to find out how to connect to the headset service. To do this, it uses Service Discovery Protocol (SDP) and performs a service search for the headset service. The pseudo-code that follows illustrates the steps an audio gateway would go through when using service discovery on a headset. display Discovering Services message to the user For (each device with audio as major class of...

Figure 83 Piconets and Scatternets

In single connection applications, where applications participate only in one-to-one connections or as a slave in one-to-many connections, ACL establishment is very simple.To receive an inbound ACL connection, the application should simply wait for the Management Callback to receive a btLibManagementEventACLConnectInbound event.This event will contain the address of the remote device, if the application wishes to reject the connection, it can call BtLibLinkDisconnect() in the callback.To create...

Using Bluetooth Technology with Exchange Manager

If you're interested in using Bluetooth technology to transfer records, or if having a constant data flow is not important to your application (as in a turn-based game), the Bluetooth Exchange Library might be the perfect tool for you to use. The Exchange Library allows applications to send data blocks without having to worry too much about the underlying transport. Unlike sockets and virtual serial drivers, the Exchange Manager is a concept unique to Palm OS. Gavin Peacock, the engineer at...

Irycompletecfm

An inquiry gets you back information like a Bluetooth Device Address and the Class of Device, but if you are displaying information on devices to a user, you might want to know a bit more about them.You have the option of asking the Connection Manager to automatically go and get the user-friendly name of each device that responds to your device.This will take some time, as it involves setting up a connection to each device you haven't seen before. Setting up connections will also take up power...

Creating L2CAP and Rfcomm Connections

The L2CAP and RFCOMM protocol layers are exposed in the Bluetooth API through a sockets-based interface. The SDP interface uses the sockets-based API as well, but that will be discussed further in the following section. The application creates a socket by calling BtLibSocketCreate(), which allocates a socket structure and associates it with a protocol. BtLibSocketCreate() also takes a callback function pointer as an argument this callback is associated with the socket and will receive all of...

Using ACL Links for High Quality Audio

So far, we have looked at voice links that use the HV packet types transmitted in reserved bandwidth provided by SCO links.The SCO links support the same sort of voice quality you would expect from a cellular phone.This is great for applications such as mobile phone headsets, but not acceptable for applications that require higher audio bit rates. Obviously, with a maximum bit rate of 64 Kbps, a Bluetooth SCO link can't serve audio CD quality sound 1411.2 Kbps . For any high bit rate audio...

Running an Application on Blue Core

To run a final application on the Casira, you must merge the application with a full Bluetooth stack. The Casira development kit arrives preloaded with a firmware image which allows the Casira to run the lower layers of the Bluetooth stack. Figure 7.6 shows how an application image differs from the default Casira image. The application image has extra protocol stack layers Logical Link Control and Adaptation Protocol L2CAP , RFCOMM and Service Discovery Protocol SDP .These are the protocol...

Building a Sample Application

To test the installation, it is a good idea to compile a sample application. Starting Cygwin, go to the relevant directory and run make. cd cygdrive c BlueLab2 0 apps hello make The main compiler xap-local-xap-gcc is derived from the GNU C compiler. This compiles the C code and produces an object file hello.o.The linker then works with the assembler xap2asm to analyze the object file, link in libraries and produce the application files hello.app, hello.dbg, hello.sym, and hello.xap. See Figure...

The Role of the Security Manager

The Host, on the other hand, is responsible for at least setting up the environment required to start security and in some instances, initiates security itself. A Security Manager module is tasked with many diverse responsibilities, which include providing an application interface to Query the user for an authorization response Respond to the Link Manager with PIN information or a link key supporting authentication Figure 4.2 A Commercial Bluetooth Implementation Showing Interfaces to the...

Debugging Using VM

Debug output from the application can be viewed using the VM Spy utility.To begin using VM Spy, complete the following steps 1. Make sure the debugger isn't running, and nothing else is using the PC serial port. 2. Ensure the Casira serial cable is connected to the PC. 3. Make sure the Casira is configured to use BCSP. 6. Select the COM port and baud rate that match the Casira configuration. Figure 7.7 shows the VM Spy window this figure also shows the VM data window which is explained in the...

Contributors

David Kammer has been involved with the handheld industry since 1997. David is currently the Technical Lead for Bluetooth technologies at Palm Inc., and is one of the authors of the original Bluetooth specification. Before working on Bluetooth, David worked on IR technology, and on the Palm VII. In addition to his work at Palm, he also consults for several companies, including In2M and Microsoft, in the field of wireless communications and PalmOS programming. David has spoken at a number of...

Running an Application under the Debugger

The debugger allows you to set breakpoints as well as single-step your code, and has many of the functions you find in a typical modern debugging environment. Code executes on the PC, but if you need to use functions from the BlueCore chip, such as the Radio or PIO, these are handled by the attached Casira. Start off appdebug.jar by double-clicking the appdebug.jar icon in the C BlueLab20 bin directory.You should see the debugger window as shown in Figure 7.4. Select File Open project, and load...

Java C and SDP

The Bluetooth Service Discovery Protocol doesn't prescribe an API for programmers to use. Although both the SDP transactions and data representation imply the structure of an API, Bluetooth stack implementations vary widely in the APIs and programming abstractions they provide. Some stacks represent SDP transactions asynchronously, through a function call for making a request and a separate callback for replies. Others provide one synchronous function that blocks the caller while waiting for a...

Using Power Control

We must also consider the respective power class of our Bluetooth devices.To enable all classes of device to communicate in a piconet without damage to the RF front ends of the lower power devices, a method of controlling the output power of Class 1 100mW devices is required. Transmit power control is mandatory for Bluetooth devices using power levels at or above 4 dBm. Below this level i.e., all Class 2 and 3 modules , it is optional.To implement a power control link, the remote device must...

Pulse Code Modulation

Telecommunication Modulation Bluetooth

Pulse Code Modulation systems are commonly used in public and private telephone networks. In PCM systems, a waveform Codec takes samples of an analog- speech waveform and encodes them as modulated pulses, represented by logic 1 high and logic 0 low .The sampling rate, or number of samples per second, is several times the maximum frequency of the analog waveform human-voice in cycles per second, usually at a rate of 8000 samples per second. Why Bluetooth Technology Uses Waveform Codecs In...

Creating a VDRV Client Only Application

Let's move on to looking at a real VDRV client-only application. Such an application might be useful when you know that the Palm device will always be playing a client-based role, and therefore never need to accept a connection. Let's imagine that we are creating an application for controlling home appliances, using the entirely imaginary Bluetooth Based Blender Remote Control Profile B3RCP for short . Since, as we all know, B3RCP is based on the serial port profile, it is appropriate to use...

Sniff Mode

This low power mode achieves power savings by reducing the number of slots in which a master can start a data transmission and correspondingly reducing the slots in which the slaves must listen.The time interval,Tsniff, between the slots when a master can start transmitting is negotiated between the master and slave when sniff mode is entered.When the slave listens on the channel it does so for Nsniff attempt slots and can then power down until the end of the current sniff interval.The time of...

Using Bluetooth Protocols to Implement a PIB

So far, we have seen that Bluetooth wireless technology can fulfill the communication requirements of a PIB. In this section, we will look at some of the details of how the communications protocol stack could work. This section briefly explains the hierarchy of different protocols needed to exchange data, and how those protocols are derived from many different specifications. It also provides an overview of Bluetooth packet layering. After this overview, we will go on to explain the details of...

Cm Connect

The use parameter configures authentication and encryption. The addr parameter gives the Bluetooth Device address of the device you want to connect to. The target parameter provides the UUID of the service your application wants to use this information will be used for an SDP search.The timeout parameter gives a delay to wait before abandoning the connection attempt. The park parameter configures the park parameters to use on the connection.The sniff parameter configures the sniff parameters to...

Hold Mode

This is the simplest of the Bluetooth low power modes.The master and slave negotiate the duration that the slave device will be in hold mode for. Once a connection is in hold mode, it does not support data packets on that connection and can either power save or participate in another piconet. It is important to note that the hold period is negotiated each time hold mode is entered. Figure 3.1 shows what the interaction between two devices using hold mode might look like. A further important...

Identifying Barriers to Adoption

With new technology, there are often barriers that prevent adoption of systems. These barriers can mean the difference between the success or failure of an application in the market place. In the case of a medical system, cost, safety, user confidence and usability are all potential barriers to adoption. Issues of cost and safety were considered in our earlier discussions, but in this section, we'll look at user confidence and usability. For user confidence, one of the biggest challenges for...

CSR Library

The CSR library provides facilities specific to the BlueCore chip and the Virtual Machine. All of these routines are provided in libcsr.a.You can either include the corresponding header files lt event.h gt , selectively or use lt csr.h gt which will include all of them. Event Enable and poll for application events. Vm Reads the millisecond timer VmWait suspends the VM execution until an event occurs this library also supports sending and receiving BlueStack primitives. Ps Accesses the on-chip...

Continuous Variable Slope Delta Modulation

Adaptive Delta Modulation

Continuous Variable Slope Delta Modulation was first proposed by Greefkes and Riemes in 1970. CVSD requires a 1-bit sample length compared to the 8 bits used in PCM, so more samples can be sent in the same bandwidth. As a result, CVSD is more tolerant of communications errors. Because of its error tolerance, CVSD performs well in noisy channels, and for this reason, it has been widely used in military communications systems.The ability to tolerate errors is also what makes CVSD attractive for...

Writing Your Own Minimal Application

Admittedly, btd.c has grown to become rather large and complicated.You're probably wondering,What's the bare minimum I need to establish a connec-tion The following source will give you a starting point.This program does essentially the same thing as btd, and makes the same assumptions. But it boils down btd.c into the absolute minimum amount of code needed to establish an RFCOMM connection. include lt linux bluetooth btcommon.h gt include lt linux bluetooth l2cap.h gt include lt linux...

Connecting to a Service

Now we can finally get to the whole point of the application and connect to an audio service. The first step is to set up an ACL link this could be a link leftover from the service discovery phase, or if that link was disconnected, it could be a new link set up by repeating the paging process. This connection is used to create an L2CAP link using the PSM value for RFCOMM. Next, an RFCOMM channel is set up to control the headset.The Channel ID for the headset was provided to the Audio Gateway in...

Getting Started

Csr Casira

BlueLab builds code for CSR's BlueCore chips. So, in addition to BlueLab, you will need a Casira development system.The development tools run on a Win32 PC therefore, you will need administrator rights on the PC to install the tools. The BlueCore module is supplied on a carrier board which slots into a blue plastic carrier in the center of the Casira see Figure 7.2 .The circuitry on this board is what would be used in most end-user products. The rest of the Casira development kit provides extra...

Bonding

Kinit is used to encode the unit key Ka , which is then sent across the airwaves to the other Bluetooth unit for storage. At this point, devices can both exchange unit keys and create a combination key Kab which is calculated from both unit keys, or they can agree to just use one device's unit key. A combination key is more secure, but some devices cannot create such a key, so they must use their own unit key as the semi-permanent link key. This semi-permanent link key is created for future...