How Bluetooth and Bluetooth headsets work

Source: Internet
Author: User

Headset Principle Bluetooth technology picture 11features of Bluetooth technology1.1Bluetooth Protocol Architecture The whole Bluetooth protocol architecture can be divided into three parts: the underlying hardware module, the intermediate protocol layer and the high-end application layer. The Link Management layer (LMP), the baseband layer (BBP), and the Bluetooth radio channel form the underlying module of the Bluetooth. The BBP layer is responsible for the transmission of frequency hopping and Bluetooth data and information frames. The LMP layer is responsible for the establishment and removal of connections as well as the security and control of the links, which provide different access to the upper-level software modules, but the message and data transfer between the two module interfaces must be explained by the Bluetooth host controller interface. In other words, the intermediate protocol layer includes the logical link control and adaptation Protocol (L2CAP), the Service Discovery Protocol (SDP), the Serial Port Emulation Protocol (RFCOMM), and the Telephony Control Protocol specification (TCS). L2cap Complete data Disassembly, service quality control, protocol multiplexing and group extraction, is the basis of other upper layer protocol implementation, so it is also the core part of Bluetooth protocol stack. SDP provides a mechanism for upper-level applications to discover the services and their characteristics that are available on the network. At the top of the Bluetooth protocol stack is the high-end application layer, which corresponds to the cross section of the various application models and is part of the section.  13 profiles are currently defined. 1.2Bluetooth Low-level module Bluetooth low-level module is the core of Bluetooth technology, is the part of any Bluetooth device must be included. Bluetooth works in the ISM band at 2.4GHZ. Bluetooth-terminated devices offer up to 720kbit/the data exchange rate of S.  Bluetooth supports circuit switching and packet switching, respectively defining two types of links, namely connection-oriented synchronous link (SCO) and non-connected asynchronous link (ACL). To enable Bluetooth devices to be connected in a very low power state, Bluetooth provides three energy-saving states, namely, Stop (Park) state, hold state, and breathing (Sniff) state.  These modes of operation are in ascending order according to the energy-saving efficiency: Sniff mode, hold mode, park mode. Bluetooth uses three kinds of error correction schemes:1/3 forward Error correction (FEC), 2/3 forward error correction, and automatic re-send (ARQ). The goal of forward error correction is to reduce the likelihood of re-sending, but it also adds additional overhead. However, in a reasonable error-free environment, redundant bids reduce the output, so the grouping definition itself is also flexible, so it is possible to define whether FEC is used in the software. In general, the Bluetooth system uses a forward error correction scheme to ensure communication quality when the channel noise is relatively large: for SCO links, 1/3 forward error correction is used; for ACL links, use 2/3 forward error correction. In a non-numbered automatic request re-send scenario, the data transmitted by a timeslot must be acknowledged at the next timeslot.  Only after the data has passed the header error detection and cyclic redundancy check (CRC) in the receiving end, the acknowledgement message is sent back to the originator, otherwise an error message is returned. The mobility and openness of the Bluetooth system make the security issue more important. Although the FM technology used in Bluetooth system has provided some security, but the Bluetooth system still needs the link layer and the Application Layer Security management. In the link layer, the Bluetooth system provides authentication, encryption, and key management functions. Each user has a personal identification number (PIN), which is translated into a 128bit link key (link key) for single-way authentication. Once the authentication is complete, the link will be encrypted with a different length of password (Encryphon Key) (this password is increased by shit, the maximum length is 128bit) Link Layer Security provides a number of authentication schemes and a flexible encryption scheme (that is, the length of the password that is allowed to negotiate). This mechanism is extremely important when devices from different countries communicate with each other, as some countries specify the maximum password length. The Bluetooth system chooses the minimum maximum allowable password length for each device in the Pico network. For example, the United States allows 128bit password length, while Spain only allows 48bit, so when the two countries ' devices are interoperable, 48bit will be chosen to encrypt. Bluetooth systems also support special security mechanisms in different applications of high-level protocol stacks. For example, when two computers are exchanging commercial card information, one computer can only access the business of another computer, and not have access to other business.  Bluetooth security relies on a pin to establish a trust relationship between devices, and once the relationship is established, the pins can be stored on the device for faster connection in the future. 1.3The software module L2cap is part of the data link layer and is located above the baseband protocol. L2CAP provides connection-oriented and non-connected data services to the upper layer, including the ability to reuse protocols, split and reassemble groupings (segmentation and reaassembly), and extract (group abstraction).  L2cap allows high-level protocols and applications to send and receive data groupings up to 64K bytes. SDP provides a way for applications to discover available protocols and determine the characteristics of these available protocols. The service discovery under the Bluetooth environment is very different from the service discovery in the traditional network environment, in the Bluetooth environment, the mobile RF environment changes very much, so the parameters of the business are constantly changing. The SDP will emphasize the unique characteristics of the Bluetooth environment. Bluetooth usage based on customer/The server mechanism defines a method for discovering services based on the Bluetooth service type and attributes, and also provides a way to browse the service. Rfcomm is an RF communication protocol that simulates a serial cable interface protocol and conforms to the ETSI0710 serial port emulation protocol. With Rfcomm, Bluetooth can be implemented in wireless environments for high-level protocols such as PPP, TCP/support for IP, WAP, etc.  In addition, the RFCOMM can support the AT command set, which enables wireless connectivity between the mobile phone and the fax machine and the modem. Bluetooth support for voice is an important sign of its difference from WLAN. The Bluetooth phone control specification is an ITU-based-T recommends Q.931 's use of bit-oriented laundry, which defines call control signaling for establishing voice and data calls between Bluetooth devices and the mobility management process for processing Bluetooth TCS devices. 2. Voice Gateway (audio Gate) Windows Embedded CE supports Headset profile and the hands-free profile by providing the Audio Gateway (AG) service that links Bluetooth devices by using the WinsockInterfaceTo the Bluetooth Protocol Stack. This service provides the functionality toInterfaceWith TAPI to control a cellular phone and route audio to the Bluetooth chip.  The AG service is an implemented as a DLL, Btagsvc.dll that resides in Services.exe and can being controlled by external modules Through IOCTLs provided by Services.exe.The AG Service supports audio routing by using the audio driver message, Wodm_bt_ Sco_audio_control, that's routes audio to the Bluetooth chip. Thus, Microsoft has provided a voice gateway service to support Bluetooth headsets, so what we want to do is to enable the Voice Gateway Service (AG).3How does the Bluetooth headset work? Here's how the Bluetooth headset works: Bluetooth transmission over audio streams can be done in two ways:1) is transmitted via the PCM interface.2) by simulating the UART to transmit the following separately to tell:1) via the PCM interface to the audio player (Eg:media player) to open the audio file, the audio driver is called, and after decoding, the output from the PCM to the host side of the Bluetooth module PCM input, and then after the Bluetooth module processing, Sent by the RF wireless module to the client side Bluetooth device. Client-side Bluetooth device through the Wireless receiver module, filtering, voltage regulation, after processing by the micro-processing chip, directly from the speaker play. 2) by simulating the UART to transmit by setting the registry "hkey_local_machine\services\btagsvc" IsEnabled =1makes the Voice Gateway (AG) service automatically loaded when the system boots. First, establish a host-side Bluetooth device with a client-side Bluetooth device ACL link (for a non-connected asynchronous link) through manual configuration, and then call Ioctl_ag_open_audio in Applicaiton or AUDIO driver. Re-establish the host-side Bluetooth device with the client-side Bluetooth device SCO link (connection-oriented synchronization link), then AG automatically sends Waveoutmessage ((hwaveout) I, Wodm_bt_sco_audio_control,0, TRUE); Thus, the audio to the Bluetooth chip between the channel, that is, the realization of the stream to the Bluetooth module transmission. The audio stream is then packaged via the RF module via the host-side Bluetooth module. After the client Bluetooth headset receives the wireless audio packet, the filter, the voltage regulator, after processing by the micro-processing chip, transmits to the audio codec chip by the PCM, finally, plays by the speaker. The following segment code is to establish the host side Bluetooth device with the client side Bluetooth device SCO link handle h= CreateFile (L "BAG0:", 0,0,null,open_existing,0, NULL); if(Invalid_handle_value = =h) {wprintf (L"Error calling CreateFile on Audio gateway.\r\n"); return0; }if(onaudio==1) {wprintf (L"Opening Bluetooth audio...\n"); BOOL Fstatus= DeviceIoControl (h,ioctl_ag_open_audio,null,0,null,0, Null,null); if(FALSE = =fstatus) {wprintf (L"Operation failed:%d.\n", GetLastError ()); }                Else{wprintf (L"Operation Successful.\n");                } closehandle (h); return0; }            Else if(onaudio==0) {wprintf (L"Closing Bluetooth audio...\n"); BOOL Fstatus= DeviceIoControl (h,ioctl_ag_close_audio,null,0,null,0, Null,null); if(FALSE = =fstatus) {wprintf (L"Operation failed:%d.\n", GetLastError ()); }                Else{wprintf (L"Operation Successful.\n");                } closehandle (h); return0; } Headset and Hands-free Profiles Architecture Diagram Headset and Hands-free profiles frame composition

How Bluetooth and Bluetooth headsets work

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.