Reprinted A Piece Of http://blog.csdn.net/dyufei Article I, Android Bluetooth status quo
(1) The core Bluetooth version supported by android2.2 is Bluetooth 2.0 + EDR.
(2) Android Bluetooth uses the bluez protocol stack, but only implements profiles such as handset/handfree and a2dp/avrcp.
(Some Common profiles (such as hid, dun, SPP, OPP, FTP, and PAN) are not implemented in the current version of android2.2. You need to implement profile in Android ).
(3) The current version (android2.2) only supports communication between the bound devices (bonded devices), but does not support ad-hoc network communication.
(4) The current version (android2.2) emulator (simulators and simulators) does not support Bluetooth debugging. It can only be debugged using log and bluez tools.
(5) Bluetooth is supported only in Versions later than android2.0 API level5.
(6) The Bluetooth communication API of Android is the RFCOMM package of bluez.
Rfcommsocket provides Bluetooth communication only after API level7
Rfcommsocket uses Java iputstream and outputstream objects
Ii. Android Bluetooth Architecture
1. Database-Oriented Architecture View
2. process-oriented architecture View
Linuxkernel layer:
Bluez protocol stack, UART driver, H4 protocol, HCI, L2CAP, SCO, RFCOMM
Library layer:
Libbluedroid. So
Framework layer:
Headset/handsfree and a2dp/avrcp profile are implemented. However, handset/handfree is developed directly on RFCOMM socket of bluez without using audio plugin of bluez, a2dp/avrcp is developed based on bluez's audio plugin, greatly reducing the implementation difficulty.
Iii. Introduction to bluez
(See http://www.bluez.org /):
Bluez is an Open Bluetooth protocol stack for Linux OS. It mainly includes IBM's bluedrekar, Nokia's affix, axis's openbt, and the official protocol stack bluez.
Bluetooth protocol stack bluez is divided into two parts: kernel code, user-state programs and tool sets.
Kernel code: It is composed of the bluez Core Protocol and driver. The Bluetooth protocol is implemented in the kernel source code/NET/Bluetooth. Including HCI, L2CAP, hid, RFCOMM, SCO, SDP, and bnep. The driver program is placed in/driver/Bluetooth and contains the driver of Linux kernel for Bluetooth devices of various interfaces. For example, USB interface and serial port.
User-state programs and toolsets: including application interfaces and bluez toolsets. Bluez provides function libraries and application interfaces for programmers to develop Bluetooth applications. Bluez utils is the main tool set for initializing and controlling Bluetooth devices.
Iv. Several terms:
HFP (hands-free profile) headset mode:
Allows a bluetooth device to control the phone number, such as answering, hanging up, rejecting, And dialing the voice. The rejection and dialing depend on whether the Bluetooth headset and phone number are supported.
HPS (handset profile) headset Mode
Used to support use between Bluetooth headsets and mobile phones
Hid () Man-Machine Interface Device Configuration File
The hid configuration file defines the protocols, programs, and functions used by bluetooth hid (such as keyboards, pointing devices, game devices, and remote monitoring devices ).
Dial-Up Network configuration file (Dun)
Dun provides standards for using Bluetooth wireless technology to access the Internet and other dial-up services. The most common case is to dial up on a mobile phone and connect to the internet wirelessly from a laptop.
Personal LAN configuration file (PAN)
Pan describes how two or more Bluetooth devices form an instant network and how to use the same mechanism to connect to a remote network through a network access point. Configuration File roles include network access points, group instant networks, and LAN users.
SDP (Service Discovery Protocol) Service Discovery Protocol
It provides the service that the application finds available in the Bluetooth environment and determines the features of those available services.
Gap (Generic Access Profile) Universal Access Application
Generally, the access application specification defines how a bluetooth device discovers and establishes secure (or insecure) connections with other devices. It handles some common business (such as inquiry, naming, and search) and some security issues (such as guarantees ), it also processes connection-related services (such as link establishment, channel establishment, and connection establishment ). Gap specifies some general running tasks. Therefore, it is mandatory and serves as the basis for all other Bluetooth Application specifications.
Supplement the bf10 information of the bluetooth module. Android can connect to IOT platform through the SPP protocol and form a transparent serial port for data transmission.
Download materials:Click to download bluetooth module development materials