J ”12: ‘ Alf: ‘ ‘4 ”mm: 53 011336-19") 1 n... c- .. . 5-335? x: .2" ‘ -:?‘s’zi: . -, . .. . ‘ ”3513“; a i‘r.i 9! r; ' 1:9“ 4 ' ‘ ‘ . ’ m..-» ihgéél‘ in, ~ . r .y. . 3%.“. v ' ‘ ‘ ”35; ,3‘ {$111 ‘ . _ ' 7‘ ‘ :2 ' a' "N :1 7 3.3.1.3 " ' 3 715.9: .. A“! ,. d. “3:4 k: “3.7;. .._ u, ., firm}: mun, 31...... my 1. z; :3 II ‘ r i. 3.! m;- 5415‘: ‘ try-€532 2,53; m x .u / a LIBRARY Michigan State University This is to certify that the thesis entitled BTAUDIO (BLUETOOTH AUDIO PROGRAM) AND QUITE TALK PROFILE presented by JUN CHEN has been accepted towards fulfillment of the requirements for the MS. degree in Computer Science and Eggineering MM ‘ Major Profess :Signature 49/1 I/az Date MSU is an Affirmative Action/Equal Opportunity Institution PLACE IN RETURN BOX to remove this checkout from your record. To AVOID FINES return on or before date due. MAY BE RECALLED with earlier due date if requested. DATE DUE DATE DUE DATE DUE 6/01 c:/ClFlC/DateDue.p65p 15 BTAUDIO (BLUETOOTH AUDIO PROGRAM) AND QUITE TALK PROFILE By Jun Chen A THESIS Submitted to Michigan State University in partial fulfillment of the requirements for the degree of MASTER OF SCIENCE Department of Computer Science and Engineering 2003 Abstract BTAudio (Bluetooth Audio Program) and Quite Talk Profile By Jun Chen In this thesis, we discuss the Bluetooth audio gateway design and implementation. We implement the audio gateway into a program named BTAudio. BTAudio is developed on the top of BlueZ (Official Linux Bluetooth protocol Stack) to fulfill its core functions. BTAudio also provides a graphical user interface written in GTK+. By running BTAudio, the computer can control a Bluetooth device, which is attached to it. Then the Bluetooth device can act as the audio gateway. The audio gateway has these main functions: build connection, receive or send audio data from or to headset and release connection. We also conducted some experiments on the Bluetooth devices by using BTAudio. From the experiments we arrived at some important results about Bluetooth technology. In the end, we propose a new Bluetooth profile: Quite Talk Profile. This profile describes how the Bluetooth devices can provide a mobile, full duplex, and hand-free way for up to three people to communicate. Acknowledgments It is not easy that I finish this thesis. Here I want to thank all the people who have helped me in this work. First, I am very grateful to my advisor: Dr. Lionel M. Ni. He helps me finish this very interesting thesis research and always gives me direction when I feel lost in my thesis research. I also acknowledge Dr. Abdol-H. Esfahanian and Dr. Matt W. Mutka. Their inspiring comments are very important to my thesis research. I also want to thank Yunhao Liu, Hongbo Zhou, Abhishek P. Patil, Pei Zheng and other colleagues in ELAN 8. Their advice helps me overcome many obstacles. At last many thanks to my family, especially my husband: yuan. He gives me great support in spirit. iii Table of Contents 1. INTRODUCTION 1 1.1 MOTIVATION ........................................................................................................ 1 1.2 OBJECTIVE ........................................................................................................... 2 1.3 ORGANIZATION .................................................................................................... 3 2. BLUETOOTH SPECIFICATION 3 2.1 OVERVIEW ........................................................................................................... 3 2.2 BLUETOOTH PROTOCOL STACK ............................................................................ 5 2.3 RADIO .................................................................................................................. 6 2.4 BASEBAND ........................................................................................................... 7 2.5 LINK CONTROLLER ............................................................................................ 10 2.6 LINK MANAGER ................................................................................................. 12 2.7 HOST CONTROLLER INTERFACE (HCI) ............................................................... 13 2.8 LOGICAL LINK CONTROL AND ADAPTATION PROTOCOL (L2CAP) .................... 15 2.9 RFCOMM ......................................................................................................... 15 2.10 SERVICE DISCOVERY PROTOCOL (SDP) ......................................................... 16 3. BLUETOOTH PROFILE 17 3.1 BLUETOOTH PROFILE RELATIONSHIPS ............................................................... 17 3.2 GENERIC ACCESS PROFILE (GAP) ...................................................................... 18 3.3 SERIAL PORT PROFILE (SPP) .............................................................................. 19 iv 4. BLUETOOTH AUDIO GATEWAY DESIGN - - 20 4.1 HEADSET PROFILE .............................................................................................. 20 4.1.] Roles in Headset Profile ............................................................................ 21 4.1.2 Headset Profile Stack ................................................................................ 21 4.1.3 Headset Profile Requirement .................................................................... 23 4.2 AUDIO DATA REQUIREMENTS ............................................................................ 24 4.3 FUNCTIONALITIES OF BLUETOOTH AUDIO GATEWAY ........................................ 30 4.3.1 Outgoing Audio Connection ...................................................................... 30 4.3.2 Incoming Audio Connection ...................................................................... 31 4.3.3 Audio Connection Release ........................................................................ 32 5. BLUETOOTH AUDIO GATEWAY INIPLENIENTATION: BTAUDIO ..... 34 5.1 SYSTEM REQUIREMENTS .................................................................................... 34 5.2 SUPPORTED HARDWARE ..................................................................................... 38 5.3 BTAUDIO CORE FUNCTIONS .............................................................................. 4O 5 .3 . I Overview .................................................................................................... 40 5.3.2 Check the Voice Setting ............................................................................. 44 5.3.3 Create RF C OMM Channel ....................................................................... 44 5.3.4 Create SCO Channel ................................................................................. 45 5.3.5 Transfer Data on the RF COMM and SC 0 Channel ................................. 46 5.4 BTAUDIO GUI ................................................................................................... 48 5.4.1 Introduction ............................................................................................... 48 5.4.2 Send out music file ..................................................................................... 50 5.4.3 Record voice from Headset ....................................................................... 52 6. BTAUDIO EXPERIMENTS AND RESULTS _ 54 6.1 BTAUDIO EXPERIMENTS .................................................................................... 54 6.2 RESULTS ............................................................................................................. 57 6.2.1 Relationship Between Quality of Transmission and Distance .................. 57 6.2.2 Transmission Rate in Diflerent Areas ....................................................... 58 6.2.3 Size of SCO Packets .................................................................................. 59 6.2.4 Put the Headset in Diflerent Containers ................................................... 61 6.2.5 Summary .................................................................................................... 61 7. NEW BLUETOOTH PROFILE: QUITE TALK PROFILE 62 7.1 OVERVIEW ......................................................................................................... 62 7.2 SYSTEM REQUIREMENTS .................................................................................... 63 7 .3 FUNCTIONALITIES OF QUITE TALK PROFILE ....................................................... 64 7.3.1 Audio Connection ...................................................................................... 64 7.3.2 Audio Data Transmission .......................................................................... 66 7.3.3 Audio Connection Release ........................................................................ 67 7 .4 FEATURE OF QUITE TALK PROFILE ..................................................................... 69 8. CONCLUSION AND FUTURE WORK 70 8. 1 CONCLUSION ...................................................................................................... 70 8.2 FUTURE WORK ................................................................................................... 71 BIBLIOGRAPHY 74 APPENDIX A. CONTENT OF HCIUSB.PATCH 75 APPENDIX B. RECOMPILE THE LINUX KERNEL - 76 vi APPENDIX C. INSTALL AND CONFIGURE BLUEZ 76 C. 1 INSTALL BLUEZ ................................................................................................. 76 C2 CHANGE THE MODULE CONFIGURATION FILE .................................................... 77 C3 CHANGE THE BLUEPIN FOR PAIRING .................................................................. 78 vii LIST OF TABLES Table l: Mandatory AT Commands in Headset Profile .................................................... 22 Table 2: Optional At Commands in Headset Profile ......................................................... 22 Table 3: Comparison of Audio Data ................................................................................. 30 Table 4: Voice Setting Value and Parameter Description ................................................. 41 Table 5: the Relationship Between the Quality of Music Heard and the Distance ........... 58 viii LIST OF FIGURES Figure 1: Bluetooth Specification Protocol Stack ............................................................... 5 Figure 2: 081 Reference Model and Bluetooth Protocol Stack .......................................... 6 Figure 3: Frequency Hopping Example .............................................................................. 8 Figure 4: Piconets with a Single Slave (a), Multiple Slaves (b) and a Scattemet (c) ......... 9 Figure 5: State Diagram of Bluetooth Link Controller [1] ................................................ 11 Figure 6: End-to-End Overview of Lower Software Layers to Transfer Data [1] ............ 14 Figure 7: SDP Client-Server Interaction Mechanism ....................................................... 16 Figure 8: Bluetooth Profile ................................................................................................ 17 Figure 9: Headset Protocol Model .................................................................................... 21 Figure 10: SLR Measurement Set—up ................................................................................ 25 Figure 11: RLR Measurement Set-up ............................................................................... 26 Figure 12: Bluetooth Audio System [9] ............................................................................ 28 Figure 13: Outgoing Audio Connection Establishment .................................................... 31 Figure 14: Incoming Audio Connection Establishment .................................................... 32 Figure 15: Audio Connection Release - AG Launched .................................................... 33 Figure 16: Audio Connection Release - HS Launched ..................................................... 33 Figure 17: BlueZ Overall Architecture ............................................................................. 35 Figure 18: Bluetooth Module Setting ................................................................................ 36 Figure 19: Commands to Load Modules and Get the Device UP ..................................... 37 Figure 20: Result of sdptool Inquiry Result ...................................................................... 38 Figure 21: The Headset and USB Dongle Used in Our System ........................................ 39 : Flow Diagram of BTAudio Bluetooth Part ..................................................... 43 : Procedure to Build RFCOMM Channel .......................................................... 45 : Procedure to Set Up the SCO Channel ............................................................ 46 : Sequence Diagram of the Data Transfer on the RFCOMM and SCO Channels .................................................................................................................................... 48 Figure 26: BTAudio User Interface .................................................................................. 49 Figure 27: Checking the Voice Setting ............................................................................. 51 Figure 28: User Interface after Sending Out Music .......................................................... 52 Figure 29: The Dialog to Give a Name to the Record File ............................................... 52 Figure 30: The Example to Record Voice from the Headset ............................................ 53 Figure 31: Map of Experiment Areas ................................................................................ 56 Figure 32: Average Transmission Rate When Headset in Different Areas ...................... 59 Figure 33: The Size of SCO Packet When Headset in Different Areas ............................ 60 Figure 34: Audio Connection in Quite Talk Profile .......................................................... 65 Figure 35: Audio Data Transmission in Quite Talk Profile .............................................. 67 Figure 36: Audio Connection Release .............................................................................. 69 Figure 37: Bluetooth Applications in Car ......................................................................... 72 Figure 38: Bluetooth Enabled Devices .............................................................................. 73 Figure 39: Content of hciusb.patch ................................................................................... 76 Figure 40: Install ALSA and Recompile the Linux Kernel .............................................. 76 Figure 41: One Example to Install BlueZ package ........................................................... 77 1. Introduction 1.1 Motivation As a new technology with a history of nine years, Bluetooth [1] wireless technology has rapidly gained a lot of consumer awareness and product penetration across a range of diverse industries. More and more manufacturers plan to launch products using Bluetooth technology. Bluetooth is the new technology using short-range frequency-hopping radio link between mobile computers, mobile phones, PDA, headset and other portable devices. Originally Bluetooth is brought out as a cable-replacement technology. After plugging a small, cheap radio chip into computers, printers, keyboards, etc, people are set free from the cable entanglement. The interest in Bluetooth is soaring because of its key features: robustness, low complexity, and low power. Later on people think about a lot of idea with using Bluetooth, such as building a dial-up networking on the laptop Via a cellular phone, sending files from a PDA to a laptop, sending music from a computer to a headset and so on. Some applications for Bluetooth are a carrier of audio data. In theory, up to three full- duplex audio channels can be provided in one Bluetooth chip. The audio quality provided by Bluetooth shall be same as that of a cellular telephone because Bluetooth uses the same audio data format as the GSM (Global System for Mobile Communication) system. Bluetooth manufacturers produce a very nice Bluetooth device: Bluetooth headset. It is lightweight, small and convenient to use. Normally it weighs less than an ounce. We can hang the headset on our ear to receive audio data. After a while, we will forget there is a headset on our ear. This Bluetooth device set people free from the wired headset. The common headset usage is to connect to cell telephone. But there is one important potential function of the headset: connecting headset to Bluetooth enabled computer or PDA. With this function, we can enjoy the music on the headset Without sitting close to the computer or PDA. We can hear music without carrying anything except the lightweight headset. How to accomplish this function is a big step in Bluetooth technology. 1.2 Objective In this thesis we plan to design and implement the Bluetooth audio gateway in a computer to accomplish this function. Because the headset is very passive, it only has the button as the input. Thus the major work has to be on the computer side. The major function of the audio gateway is to build connection, receive or send audio data from or to headset and release connection. After accomplishing the implementation, we want to perform some experiments on the Bluetooth devices to discover some properties of the Bluetooth technology. Furthermore, We want to propose a new Bluetooth profile. If we can transmit audio data between the headset and audio gateway, we can let the two headsets communicate with help of the audio gateway. Then we can provide a new short-range, mobile, full duplex and hand-free way for communication using Bluetooth technology. 1.3 Organization Chapter 2 covers Bluetooth specifications, which gives basic information about the Bluetooth technology. Chapter 3 talks about the Bluetooth profiles. Chapter 4 discusses the audio gateway design. Chapter 5 is mainly about how to implement the audio gateway into a program named BTAudio. Chapter 6 describes the experiments we conduct on the Bluetooth devices using BTAudio and gives the results. Chapter 7 proposes a new Bluetooth profile: Quite Talk Profile. Chapter 8 summarizes all the works carried out in this thesis research and lists the future work. 2. BLU ETOOTH SPECIFICATION 2.1 Overview Bluetooth is brought out as a replacement of the cable by Ericsson Mobile Communications in 1994. In 1998 Ericsson Mobile Communications, Intel Corp., IBM Corp., Toshiba Corp. and Nokia Mobile Phones formed the Bluetooth Special Interest Group (SIG). SIG is a group of companies that work together to promote and define the Bluetooth specification. Version 1.0 of the Bluetooth specifications came out in July 1999. The name of Bluetooth comes from a tenth—century Danish king who united Denmark and Norway. They chose this name because they expect Bluetooth to unify the telecommunications and computing industries. A critical feature of the Bluetooth specification is that it aims to allow devices from lots of different manufacturers to work with each other. For this Objective, Bluetooth does not only define the radio system; it also defines a software stack to enable applications to find the services that can be provided in other devices. The Bluetooth Specification is made up of two parts: core specification and profiles. We also call the first part as Bluetooth specification, which is mainly about the layers in the Bluetooth stack. The second part: Bluetooth profile gives details about how applications use the Bluetooth protocol stack. We will talk about Bluetooth specification in this chapter. The Bluetooth profiles will be covered in next chapter. 2.2 Bluetooth Protocol Stack Applications .LV Other Interfaces Service Discovery Protocol DUBLIIUIOO RFCOMM 1 Logical Link Control and Adaptation (L2CAP) l Host Controller Interface (HCI) 1 Link Manager (LM) 1 Link Controller I Baseband 1 Radio Figure 1: Bluetooth Specification Protocol Stack Figure 1 illustrates the Bluetooth specification protocol stack. It is made up of eight layers: radio, baseband, link controller, link manager, host controller interface, logical link control and adaptation, RFCOMM or service discovery protocol, and applications. The comparison of the Bluetooth protocol stack and 081 (Open System Interconnect) Standard reference model is displayed in Figure 2. Although there is no perfect mapping between them, it helps people to understand the Bluetooth protocol stack. The functionality of each layer in Bluetooth protocol stack will be explained later. Application layer Application Layer mum“ my“ RFCOMM/SDP Sessron layer L2CAP T layer Host Controller Interface linkManager Network Layer link Controller Data link layer Baseband Physrcal layer Radio (BI Referenc Model Bluetooth Protocol Stack Figure 2: 081 Reference Model and Bluetooth Protocol Stack 2.3 Radio Bluetooth Radio operates in the 2.4 GHz ISM (Industrial Scientific Medicine) band. In most of the countries around the world Bluetooth uses a frequency hop technology with 79 hops displaced by lMHz, starting at 2,400 MHz and stopping at 2,483.5 MHz. In some countries like France, the frequency range is 2,446.5- 2,483.5 MHz and Bluetooth uses a frequency hop technology with 23 hops. Each Bluetooth has an antenna to send out the radio signal. The Bluetooth equipment is classified into three power classes by the power levels at the antenna connector. Power Class 1 is the equipment with maximum output power of about IOOmW, which normally can communicate for a maximum of around 100 meters. Power Class 2 is the equipment with maximum output power Of about 2.5mW, which may cover a range of 30 meters. Power Class 3 is the one with maximum output power of about 1mW, which can communicate Within 10 meters area. 2.4 Baseband The baseband manages physical channels and links. It also handles packets, error correction, pages and inquiries to access the Bluetooth devices Within its area. The channel in baseband is represented by a pseudo-random hopping sequence hopping through the 79 or 23 channels. The Bluetooth device takes 1600 hops in one second. The channel is divided into 625 us time slots. Figure 3 shows one frequency- hopping example. At the first time slot it uses channel 78. It jumps to channel 77 in the second time slot. Frequency Frequency Hopping Function MHz Channel f (l) f (2) f (3) f (4) f (5) f (6) f (7) 2480 2479 2478 2403 n 2402 I‘ I I _ . Packet Multi¥slot packet Time Figure 3: Frequency Hopping Example Two or more Bluetooth devices can form a piconet by using the same frequency hopping sequence. In each piconet there is one master and one or more slave(s). The hopping sequence unique for the piconet is determined by the Bluetooth address (BD_ADDR) of the master. The phase in the hopping sequence is determined by the Bluetooth clock of the master. A scattemet is the multiple piconets with overlapping Bluetooth device, that is more than one device joins more than one piconet. But each piconet has a different master. One Bluetooth device cannot act as a master of two piconets. If one device acts as the master of two piconets, then the hopping sequence will be same for the two piconets. Then it will turn the scattemet into a piconet. Figure 4 shows the topology of a point—to-point link between Master and Slave. The example of two piconets are displayed in the diagram (3) and (b). In diagram (a) there is one master and one slave. In diagram (b) there is one master and two slaves. The diagram (c) gives one example of scattemet: the master of one piconet becomes a slave of another piconet. 0 Master Slave (a) (b) (c) Figure 4: Piconets with a Single Slave (a), Multiple Slaves (b) and a Scattemet (c) The baseband manages two types of links: Synchronous Connection-Oriented (SCO) link and Asynchronous Connection-Less (ACL) link. The ACL link is a point-to- multipoint link between the master and all the slaves in the piconet. The SCO link is a point-to-point link between a master and a single slave participating the piconet. The master maintains the SCO links by using reserved slots at regular intervals. When the slots are not reserved for the SCO link, the master can establish an ACL link on a per-slot basis to any slave, including the slave(s) already engaged in an SCO link. An ACL link exists between the master and slaves as soon as a connection has been established. The ACL link provides a packet-switched connection Where data is exchanged sporadically when data is available. The choice of which slave to send out to or receive from is up to the master on a slot-by-slot basis. A SCO link provides a circuit-switched connection between the master and a slave with reserved channel bandwidth and regular periodic exchange of data in the form of reserved slots. The SCO link is mainly used to transmit time-bounded information such as audio data. There are 13 different packet types defined for the baseband. Some are for both SCO and ACL links. Some are for ACL link only. Some are only for SCO link. Most ACL packets perform error checking and retransmission to assure data integrity. The SCO packets are never retransmitted. Baseband provides the following error correction and detection for the ACL packets: FEC (Forward Error Correction), CRC (Cyclic Redundancy Checksum) and ARQ (Automatic Repeat Request) scheme. In baseband, five logical channels are defined to transfer different types of information. LC (Link Control) channel and LM (Link Manager) channel are used at the link control level and link manager level. The user channels: UA (User Asynchronous Data), UI (User Isochronous Data), US (User Synchronous Data) channels are used to carry asynchronous, isochronous, and synchronous user information, respectively. 2.5 Link Controller The link controller layer performs higher-level Operation such as inquiry and paging and manages multiple links between different devices. For Bluetooth devices in link controller layer, there are two major states: STANDBY and CONNECTION and seven substates: page, page scan, inquiry, inquiry scan, master response, slave response and inquiry response. The substates are interim states that are for the devices to stay while they join a piconet. Either commands from the Bluetooth 10 link manager or internal signals in the link controller can make the devices move from one state to the other. Figure 5 illustrates the movement between these states. Figure 5: State Diagram of Bluetooth Link Controller [1] In order to establish new connection between unknown devices, the inquiry procedures and access procedures must be performed sequentially. If a device knows the destination device’s address, only access procedure is needed. The inquiry procedure enables a discovering unit to collect the Bluetooth device addresses and clock of all devices that respond to the inquiry message. A normal inquiry procedure is carried out in the below way: 1) The source device enters the inquiry state and broadcasts inquiry packets. 2) The destination device in inquiry scan state receives the inquiry packets. ll 3) The destination device will then enter inquiry response state and send an inquiry reply packet containing its address and clock to the source device. During the access procedure, important information: the channel access code and the channel hopping sequence are exchanged between each other. And their clocks are synchronized. Typically the access procedure occurs the following: 1) 2) 3) 4) 5) 6) 7) The source device enters page state to page another device. The destination device in the page scan state receives the page packets. The destination device enters slave response state and sends a reply to the source. The source device enters the master response state and sends packets contains important information such channel hopping sequence to the destination device. The destination device sends it’s second reply packet to the source. The destination and source devices then follow the source channel parameters. The connection state starts when a POLL packet sent by the source device to verify the destination device has switched to the source’s timing and channel frequency hopping sequence. 2.6 Link Manager The major task Of Link Manager is to translate the Host Controller Interface commands into operations at the baseband level. A Bluetooth Link Manager communicates with Link Manager on other Bluetooth device by using the Link Management Protocol messages. Link Manager provides the following functions: 12 attaching slaves to a piconet, configuring the link including controlling Master/Slave switches, setting up ACL and SCO links, and so on. 2.7 Host Controller Interface (HCI) The HCI provides a uniform interface method of accessing the hardware capabilities of Bluetooth devices. The HCI is made up of three parts: the HCI firmware driver, HCI transport layer and HCI driver. The HCI firmware carries out the HCI commands to the Bluetooth hardware by accessing baseband commands, link manager commands, hardware status registers, control registers and event registers. The HCI driver on the host transmits data, packets and commands with the HCI firmware on the Bluetooth hardware. The HCI transport layer exists between the HCI driver on the host system and the HCI firmware in the Bluetooth hardware to provide the ability to transfer data without intimate knowledge of the data. There are three HCI transport layers: USB (Universal Serial Bus), RS-232 (a serial interface with error correction) and UART (Universal Asynchronous Receiver Transmitter, a serial interface Without error correction). The Figure 6 illustrates the path of data exchange between two Bluetooth device enabled hosts. 13 “NRA'M‘VI'JEW'J _ l / 0:10.151]? 1 ./ firmware % Illllllllll Physical bus 7 firmware 1 1 [1 1'1 L n 1121111111 Dr M ’f'iia' ~Xiillliil but Yxil" E] Software Flrmware ‘ User Data A r 1 1- 1 - 1 1 T Other higer E; W' l '3 . Ire ess ' layer dnver 3;. 3; a“. v ,2, r". i i 1 Bluetooth hardware Bluetooth hardware N ' '-"-~- w- ' - ~' ' ... ""- 1 ’ "Ain‘tn'nwnwvnuu 1". -Baseband Controller . . Baseband Controller ii , I . n‘rnunnn'u-‘vn-u - 'W. 'I 7/ wrea 1 fillllllllll A g //Illlllllllrlllll/ ' Bluetooth host ' \nuuv me“ ha): Physical bus driver Im“ E Hardware Figure 6: End-to-End Overview of Lower Software Layers to Transfer Data [1] 2.8 Logical Link Control and Adaptation Protocol (L2CAP) L2CAP provides protocol multiplexing between different higher layer protocols such as service discovery protocol and RFCOMM. Protocol multiplexing allows higher layer protocols to share the lower layer links. L2CAP performs segmentation and reassembly operation to allow transfer of larger packets than lower layers can support. L2CAP allows higher-level protocols and applications to transmit and receive L2CAP data packets up to 64 kilobytes in length. L2CAP carries out group management and quality of service management for higher layer protocols 2.9 RFCOMM RFCOMM emulates the serial cable line settings and status of an RS-232 serial port. To build an RFCOMM connection, an L2CAP connection must be set up in advance. RFCOMM frames are sent in the payload field of the L2CAP packets. RFCOMM provides multiple concurrent connections by replying on L2CAP to perform multiplexing over single connections, and to provide connection to several devices. RFCOMM depends on the baseband to provide reliable in-sequence delivery of byte streams for it does not have any ability to correct errors. RFCOMM supports two types of devices. A type 1 device is the end of a communications path and supports an application over RFCOMM.A type 2 device is an intermediate device and has a physical RS-232 serial port over RFCOMM. 15 2.1 mt Oll 2.10 Service Discovery Protocol (SDP) SDP resides on the top of L2CAP levels. SDP employs a Client—Server interaction mechanism as Shown is Figure 7. This mechanism provides a way for client applications on one Bluetooth device to discover the existence of services offered by server application in another device as well as the attributes of those services. SDP requests ,1 SDP Client SDP Server ‘ I SDP responses I Client Server Applications Applications Figure 7: SDP Client-Server Interaction Mechanism The SDP server maintains a database of service records. Each service record describes he characteristics and contains information about a single service. A SDP client can get the information about a service record maintained by the SDP server by issuing an SDP request. If the client wants to use a service, it must open a separate connection to the service provider to utilize the service. Although SDP provides a mechanism for discovering services and their attributes, it does not provide a mechanism to use those services. 16 .81 3 l 3.1 The stun produc each ol h pm the lo Each Gene 3. BLUETOOTH PROFILE 3.1 Bluetooth Profile Relationships The purpose of a profile is to give a clear description of how a full specification of a standard system to implement a given function. If everyone implement the function into products as describe in the profile, then each product shall be able to interoperate with each other. Bluetooth profiles have the same functionality. They ensure interoperability by providing a well-defined set of higher layer procedures and uniform means of using the lower layers. Figure 8 shows how the Bluetooth profiles are built up in layers [5]. Each profile relies upon the layers below. For example, Headset Profile depends on Generic Access Profile and Serial Port Profile. Generic Access Profile Service Discovery TCS Binary based profiles Application Profile Serial Port Profile , , Generic ObJCCt Dial-up Networking Exchange Profile Profile File Transfer Profile Fax Profile Object Push Profile Headset Profile Synchronization Profile LAN Access Profile Figure 8: Bluetooth Profile 17 In this chapter we only briefly talked about Generic Access Profile (GAP) and Serial Port Profile. Headset profile will be covered in next chapter. For detailed information about other profiles, please look at the profile part of specification of the Bluetooth technology. 3.2 Generic Access Profile (GAP) The GAP forms a common basis for all other Bluetooth profiles. The objective of the GAP is to make sure that all devices can successfully establish a baseband link. To obtain this objective, the GAP defines the requirements of the features which must be implemented in all devices, general procedure to discover Bluetooth devices, procedures related to the use of security in different layers and common format requirement of device parameters on the user interface level. The GAP also provides link management facilities for connecting to Bluetooth devices [6]. In Generic Access Profile two devices sharing a link key is called bonded. The procedure to create a relationship based on a common link key is called bonding. Bonding creates a link especially for the purpose of creating and exchanging a common link key. During bonding, the link managers verify that they share a secret key, which is called authentication. After authentication, the link managers will create and exchange a link key. The authentication in link level and link key generation is collectively called pairing. The GAP defines modes of operation for Bluetooth devices and defines which one is compulsory and which one is optional. The four modes are the following: 18 l) Discoverability (Controls the use of the inquiry scan and whether other devices can discover a Bluetooth device when it is within their area of radio coverage.) 2) Connectivity (Controls the use of the inquiry scan and whether other devices can connect to a Bluetooth device when it is within their area of radio coverage.) 3) Pairability (Controls the use of the link manager’s pairing facilities, which are used to create link keys for use in encrypted links. 4) Security (Control when and how encryption is initialed in a link.) Three types of discoverability mode are the following: non-discoverable, limited discoverable and general discoverable. There are two connectivity modes: connectable and non-connectable. Two pairability modes are pairable and non-pairable. There are three security modes: non-secure, service level enforced security and link level enforced security. 3.3 Serial Port Profile (SPP) The SPP defines the necessary requirements of Bluetooth devices for building emulated serial cable connections using RFCOMM between two peer devices [7]. The requirements are expressed in terms of services offered to applications and by defining the features and procedures that are compulsory for interoperability between Bluetooth devices. The SPP is based on the GSM standard GSM 07.10. It allows multiplexing of several serial connections over one serial link. It supports two device types: a communication endpoint and an intermediate device. A computer is an example of the communication 19 endpoint. A modem is an example of the intermediate device, which forms part of a communication link. Support for security is mandatory in the SPP. But security does not have to be used. Either device can request bonding, which requires the use of a shared secret PIN. The PIN can be pre-configured, or can be entered via a user interface. If the devices do not know the common PIN, users will have to exchange the PIN by way other than Bluetooth. Then either side can request the baseband to be encrypted. The SPP describes how to set up virtual serial ports on two Bluetooth enabled devices and connect them with Bluetooth to emulate a serial cable between the two devices. The three-step application layer procedure is the following: 1) The source device establishes a link and sets up virtual serial connection. 2) The destination device then accepts the link and establishes virtual serial connection 3) Both of the devices register service record for application in local SDP database. 4.B|uetooth Audio Gateway Design 4.1 Headset Profile Bluetooth audio gateway is just one essential part of Bluetooth headset profile. Thus it should follow all the essential protocols and procedures defined in Headset profile. In this section we will give some general information about the Headset Profile. 20 4.1.1 Roles in Headset Profile There are two roles defined in headset profile: Audio Gateway (AG) and Headset (HS). AG acts as the gateway of the audio, both for input and output. Typical devices acting as AG are cellular phones, computer and PDA. HS is the device acting as the AG’s remote audio input and output device. 4.1.2 Headset Profile Stack Figure 9 illustrates the protocols and entities used in the headset profile. Headset control is responsible for handling headset specific control signaling. Application . Application (Audio port emulation) (Audio driver) Headset Control e Headset Control RFCOMM SDP s i RFCOMM SDP LMP L2CAP ‘— d LMP L2CAP Baseband t t Baseband Audio Gateway side Headset side Figure 9: Headset Protocol Model The headset control signaling is based on AT command. In the original definition, AT command is any instructions sent to a modem that begin with “AT”. It is widely used in GSM. The headset profile only uses a subset of AT commands and result codes from existing standards. The name and description of the AT commands which is mandatory in Bluetooth headset profile are shown in table 1. 21 Table 1: Mandatory AT Commands in Headset Profile AT Command Name Description RING The indication of the incoming call in V.250 [8] +CKPD The command to control keypad in GSM TS 07.07 [8]. For , the value of 200 indicates that the button of the headset is being pressed. In the headset profile, the and