CPET 565 Mobile Computing Systems

Lecture on

Bluetooth Communication and Android Bluetooth Classes

 

Topics of Discussion

1.      Bluetooth Communication Protocols and Data Frames, See the posted PPT Lecture Notes

2.      Android APIs Support for Bluetooth network stack, Point-to-point, and Multipoint features, http://developer.android.com/guide/topics/connectivity/bluetooth.html

3.      Android Bluetooth Packages (android.bluetooth) and related classes

 

2. Android Bluetooth, http://developer.android.com/guide/topics/connectivity/bluetooth.html

·         Scan for other Bluetooth devices

·         Query the local Bluetooth adapter for paired Bluetooth devices

·         Establish RFCOMM channels

·         Connect to other devices through service discovery

·         Transfer data to/from other devices

·         Manage multiple connections

 

3.       Android Classes for Supporting Communications

·         BluetoothAdapter  //Bluetooth radio, entry point for all Bluetooth interaction

·         BluetoothDevice    //  

·         BluetoothSocket

·         BluetoothServerSocket

·         BluetoothClass

·         BluetoothProfile

·         BluetoothHeadset

·         BluetoothA2dp   // Advanced Audio  Distribution Profile

·         BluetoothHealth

·         BluetoothHalthCallback

·         BluetoothHealthAppConfiguration

·         BluetoothProfile.ServiceListtner

 

BluetoothAdapter class, http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html

·         Perform fundamental Bluetooth tasks:

o   Initiate device discovery

o   Query a list of paired (bounded) devices

o   Instantiate a BluetoothDevice using a known MAC address

o   Create a BluetoothServerSocket to listen for connections requests from other devices

 

BluetoothDevice class, http://developer.android.com/reference/android/bluetooth/BluetoothDevice.html

·         Represents a remote Bluetooth device

·         This class allows you to connect with the respective device or query information: name, address, class, and bonding state

·         Uses BlutoothSocket class

 

BluetoothSocket class, http://developer.android.com/reference/android/bluetooth/BluetoothSocket.html

·         Similar to TCP socket

·         A connection point allows an application to exchange data with another Blutooth device via InputStream  and OutputStream

 

 

BluetoothServerSocket class, http://developer.android.com/reference/android/bluetooth/BluetoothServerSocket.html

·         Represents an open server socket that listens for incoming requests

·         Similar to TCP server socket

·         For two Bluetooth devices to talk to each other

o   One Bluetooth device must open a server socket with this class

o   Another Bluetooth device makes a connection to this device, the BluetoothServerSocket will return a connected BluetoothSocket when the connection is accepted

 

BlutoothClass, http://developer.android.com/reference/android/bluetooth/BluetoothClass.html

·         Describes the general characteristics and capabilities of a Bluetooth device

·         READ ONLY properties that define the device’s MAJOR and MINOR device classes and its services

·         Methods

o   public int describeContents()

o   public boolean equals(Object o)

o   public int geMajorDeviceClass()

o   public booleanhasService(int service)  // Audio

o   public int hashCode()

o   public String toString()

o   public void writeToParcel(Parcel out, int flags)

 

BluetoothProfile class, http://developer.android.com/reference/android/bluetooth/BluetoothProfile.html

·         A wireless interface specification for Bluetooth-based communications between devices

·         Working with Profile Examples: http://developer.android.com/guide/topics/connectivity/bluetooth.html#Profiles

o   Headset: hands-Free profile

o   A2DP (The Advanced Audio Distribution Profile)

o   Health Devices: Heart-rate monitors, blood meters, thermometers, scales, etc

§  Bluetooth Assignment Numbers for Device specialization codes, www.bluetooth.org

§  ISO/IEEE 11073-20601 Specifications as MDC_DEV_SPEC_PROFILE_* in the Nomenclature Code Annex

 

BluetoothHeadset, http://developer.android.com/reference/android/bluetooth/BluetoothHeadset.html

·         Contains public APIs for controlling the Bluetooth Headset Service

·         Includes both Headset and Handfree (v1.5) profiles

 

BluetoothA2dp class, http://developer.android.com/reference/android/bluetooth/BluetoothServerSocket.html

·         Provides public APIs to control Bluetooth A2DP profile

·         BluetoothA2dp is a proxy object for controlling the Bluetooth A2DP Service via IPC (Interprocess Communication)

 

BluetoothHealth class, http://developer.android.com/reference/android/bluetooth/BluetoothHealth.html

·         A health device proxy object for controlling the Bluetooth Service via IPC

 

BluetoothHalthCallback, http://developer.android.com/reference/android/bluetooth/BluetoothHealthCallback.html

·         An abstract class used to implement BluetoothHealth callbacks

·         For receiving Updates about changes in the application’s registration state and Bluetooth channel state

 

BluetoothHealthAppConfiguration, http://developer.android.com/reference/android/bluetooth/BluetoothHealthAppConfiguration.html

·         Used in conjunction with the BluetoothHealth class

·         Represents an application configuration that the Bluetooth Health third-part application registers to communicate with a remote Bluetooth health device

 

BluetoothProfile.ServiceListtner, http://developer.android.com/reference/android/bluetooth/BluetoothProfile.ServiceListener.html

·         An interface for notifying BluetoothProfile IPC clients when they have been connected or disconnected to the service

 

 

References

[ 1]  Android Bluetooth, http://developer.android.com/guide/topics/connectivity/bluetooth.html

[ 2]  Android BlutoothClass, http://developer.android.com/reference/android/bluetooth/BluetoothClass.html

[ 3]   Parcel class: container for a message, http://developer.android.com/reference/android/os/Parcel.html

[ 4]  BlutoothAdapter class, http://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html