Bluetooth API Learning Secondary _____bluetooth Introduction

Source: Internet
Author: User

The English original address is: http://www.androidcommunitydocs.com/guide/topics/connectivity/bluetooth.html

The Android platform includes support for the Bluetooth protocol stack, which allows one device to wirelessly exchange data with another device. Application framework layer (one of the four layers of Android system architecture, from top to bottom, the application layer, application framework layer, System Runtime layer, Linux kernel layer) support the Bluetooth API to use Bluetooth functionality. These APIs enable point-to-and multi-point wireless capabilities that allow devices to connect wirelessly to other devices.

Using the Bluetooth API, applications can implement functionality

    • Scan other Bluetooth devices
    • Get a paired Bluetooth device from your local Bluetooth adapter
    • Establish Rfcomm Channel
    • Connect to other devices by starting device discovery
    • Data transfer between devices
    • Manage multi-point connections

Basis:

This document describes how to use the Bluetooth API of Android to complete the four main steps of Bluetooth communication, including Bluetooth settings, finding paired or available Bluetooth devices in the region, connecting devices, and transferring data between devices.

All of these APIs are in the Android.bluetooth package, and the following is an overview of the classes that you need to use when creating a Bluetooth connection:

Bluetoothadapter: Represents the local Bluetooth adapter. Bluetoothadapter is the gateway to all Bluetooth interactions. With this, you can find other Bluetooth devices, get a list of paired devices, instantiate a Bluetoothdevice object with a known MAC address, and create a Bluetoothserversocket object to listen to communication with other devices.

Bluetoothdevice: Represents a remote device. With this, you can request a connection to a remote device via Bluetoothsocket, or ask for information about the device, such as the device name, address, class name, pairing status.

Bluetoothsocket: Represents the interface of a Bluetooth socket (similar to a TCP socket). This is a connection point that allows applications to exchange data with another Bluetooth device through InputStream and OutputStream.

Bluetoothserversocket: Represents a service-side socket (similar to TCP ServerSocket) that is opened to listen for incoming requests. The connection between the two devices requires a device to turn on the server socket (bluetoothserversocket). When a remote Bluetooth device initiates a connection request to this device, Bluetoothserversocket returns a connected Bluetoothsocket if the connection is accepted.

Bluetoothclass: Describes the basic features and functions of a Bluetooth device. This is a read-only set of properties that defines the primary and secondary classes of the device and its services. However, it does not describe all of the Bluetooth settings and devices supported by the service, but can be judged as the device type.

Bluetoothprofile: The interface that represents the Bluetooth configuration. A Bluetooth configuration is a wireless interface description for a Bluetooth-based device communication. A hands-free configuration is one example.

Bluetoothheadset: Provides support for Bluetooth headsets on your phone. This includes Bluetooth headsets and hands-free protocols.

BLUETOOTHA2DP: Defines how to transfer high-quality audio streaming to another device over a Bluetooth connection. A2DP is the abbreviation for Advanced Audio distribution profiles.

Bluetoothhealth: Represents a proxy class that provides Bluetooth service control for medical devices.

Bluetoothhealthcallback: This is an abstract class used to implement the Bluetoothhealth callback. You must inherit the class and implement a callback method to receive the application's registration status and Bluetooth channel status.

Bluehealthappconfiguration: Represents the application configuration of a third-party app registration in order to communicate with a remote Bluetooth medical device.

Bluetoothprofile.servicelistener: The interface responsible for notifying the client when the Bluetooth IPC client disconnects/connects to the server.

Bluetooth permissions:

so far, do not translate, because the discovery of these APIs have been translated well, so do not repeat the translation, the following is the Chinese introduction about Bluetooth:

http://wikidroid.sinaapp.com/index.php?title=%E8%93%9D%E7%89%99&diff=1356&oldid=1249

Bluetooth API Learning Secondary _____bluetooth Introduction

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.