Debugging Using VM Spy

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 the BlueLab Libraries

BlueLab offers a variety of libraries which provide functions to support basic C functions, BlueCore hardware, and Bluetooth applications see Figure 7.11 for a graphical overview . When linking, all object files are used, and then missing symbols are imported from the libraries. Each symbol is taken from the first library in command-line order which provides that routine.This means that the application's makefile must list libraries which override a routine before the libraries with default...

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...

Active Mode

In active mode, the device actively participates on the radio channel. The master schedules data transmissions as necessary and the slaves must listen to all active master-slave slots for packets that may be destined for them. This mode is a useful benchmark for comparison with the performance of the low power modes since it not only consumes the most power but also has the highest achievable data throughput due to the devices being able to use all available slots.The power consumption of...

W 1

WAP. See Wireless Application Protocol Waveform codec usage, reasons. See Bluetooth Wi-Fi access point, 32 device, 31 standard, 2 system, 31 Wired connection, wireless connection contrast , 3-11 Wire-free communications capabilities, 427 Wireless Application Protocol WAP , 175 Wireless technology, choice. See Personal information base Wire-only protocol, 202 World Wide Web WWW Web , 109 browsers, 226 browsing, 61 PDA usage, 26 sessions, 60 page, 168 servers, 226 Write system calls, 219...

Providing Channel Quality Driven Data Rate

The Bluetooth specification provides a variety of packet types single and multiple slot packets, each coming in medium- and high-rate types. Multislot packets pack more data into longer packets, and provide higher throughput in noise-free environments, but their throughput is worse than single slot packets in noisy environments because they take longer to retransmit. Medium rate packets have more error protection.This makes them tolerant to noise, but the space taken up by error protection...

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 ClientOnly 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 1

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...

Pib

The PDA sends an HCI_Inquiry command to its Bluetooth Host Controller the Host Controller responds with an HCI_Command_Status_Event, which acknowledges it has received the command.Then the Host Controller sends out a series of Inquiry packets ID packets containing the General Inquiry Access Code . Every device within range which is in discoverable mode should hear these packets and respond with an FHS Frequency Hopping Synchronization packet. These packets contain all the information the PDA...

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 Cfm

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...

The Service Discovery Protocol

So, how exactly do clients discover services in their local areas Services are discovered using the Service Discovery Protocol, a simple protocol that communicates between SDP clients and servers. It can be implemented over any reliable packet-based transport layer, though it's typically implemented over the Logical Link Control and Adaptation Protocol.The Service Discovery Protocol includes a set of Protocol Data Units PDUs that contain the basic requests and responses needed to implement the...

Debugging under BlueLab

The Memory tab at the bottom of the main debugger window will show all active memory regions including their start and extent. If any address has a blank value, it means that address isn't acceptable. To follow a pointer from the variable window, just right-click it. This moves the memory window to that location. If the application crashes, the debugger will stop just after the offending instruction.The call stack will show in the middle of the Context panel at the left of the main window. As...

Browsing for Services

If the service Class ID for a particular service is unknown, or if a client wants to browse the services on a device, the service discovery protocol provides a way to do this. To be browseable, a service must be explicitly marked as browseable with a BrowseGroupList attribute in its service record. If the service record doesn't have this attribute, it can't be browsed.The BrowseGroupList attribute contains the list of UUIDs that identifies the groups that a service belongs to. A well-known root...

Hold Mode 1

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...

Cm Pair Cfm

The shared link key is created using a PIN code which must be input separately at either end of the link. For devices without a user interface, the PIN code can be preprogrammed.These are called fixed PINs. Devices with fixed PINs have to be sold with a note to the user of the PIN code so that they can enter the same PIN in whichever device they want to pair with. The Connection Manager needs to get the PIN code from your application. To do this, it will send you a PIN request CM_PIN_CODE_REQ...

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...

Info Ogo

This makes it important that libraries are linked in the correct order. Each library should be listed before any others which appear after it in the list that follows. The scheduler relies on the message and timer libraries. Some applications require the scheduler, but may not need both of those libraries. In that case, the libraries can be replaced with their stub versions which take less code and data space. Obviously, if messages and timers are stubbed out, then messages or timers can't be...

Continuous Variable Slope Delta Modulation

Block Diagram Bluetooth Technology

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...

Case Study

One of the most popular profiles being pursued by many companies is the Headset profile. The audio gateway resides on a cellular phone and the actual headset rests in the human ear. Incoming calls can be answered by the headset, either automatically or by using manual intervention. How does the cell phone know that it is actually communicating with the correct headset Security procedures are used in ensuring this connection using the following strategy. The process of bonding the cell phone and...

Advertising a Basic Service Record for an RFCOMM or L2CAP Listener Socket

Let's begin by looking at what we need to do in order to create and advertise a basic service record for an RFCOMM or L2CAP listener socket.We'll assume that the application has already opened the Bluetooth Library and created a listener socket the socket's protocol is unimportant . A new application needs to declare a new service UUID, so we'll use a UUID generation tool to generate one, in this case 6 0x4 7 0XE8 0x11 0XD5 0x8 3 0xCE BtLibSdpUUIDType myServiceUUIDList myServiceUUID UInt8...

Letting Other Bluetooth Devices Discover Us

By default, the Ericsson Bluetooth Development Kit hardware doesn't respond to other device's inquiries. This is okay, because we don't really want other people trying to connect with us until we're ready. The following example shows how to enable both scan and inquiry responses enable page scan amp inquiry scan define PAGE_SCAN_ENABLE 0x01 define INQUIRY_SCAN_ENABLE 0x02 int wrscan PAGE_SCAN_ENABLE INQUIRY_SCAN_ENABLE ioctl bt_cfd, HCIWRITESCANENABLE, amp wrscan The HCIWRITESCANENABLE ioctl...

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...

Sending an HCI Inquiry

To find other neighboring devices use the HCIINQUIRY ioctl. This ioctl takes a parameter of type inquiry_results, which serves both as an in-param and an out-param.The btcommon.h header defines this structure. typedef struct inquiry_results u32 nbr_of_units u3 2 inq_time u8 bd_addr 0 The nbr_of_units field specifies the maximum number of responses, which the hardware should listen for before ending the Inquiry procedure. The valid range for this value is 0 through 255. But 0 means an unlimited...