SlideShare una empresa de Scribd logo
1 de 18
Nanik Tolaram
nanikjava@yahoo.com
naniktolaram.com
ANDROIDANDROID
BLUETOOTHBLUETOOTH
STACKSTACK

topic 2

topic 3

topic 4
Thank YouThank You
!!
• Android Platform Engineer@ BlocksGlobal.comAndroid Platform Engineer@ BlocksGlobal.com
• ScreenerOS –ScreenerOS – www.screener.digitalwww.screener.digital &&
LumenHealth – www.lumenhealth.coLumenHealth – www.lumenhealth.co
• Android writer for magazine.odroid.comAndroid writer for magazine.odroid.com
• AOSP Contributor - now and then :)AOSP Contributor - now and then :)
About MeAbout Me
The StackThe Stack
BluetootBluetoot
hh• Bluetooth Classic vs Bluetooth Low EnergyBluetooth Classic vs Bluetooth Low Energy
• Single Mode vs Dual ModeSingle Mode vs Dual Mode
• Different way of programmingDifferent way of programming
• Android devices are Dual Mode devicesAndroid devices are Dual Mode devices
Classic vsClassic vs
BLEBLE
Classic BLE
Streaming Data (headset,
speaker, etc)
Low data transfer
Up to 7 slaves Large no of slaves
Standard profiles (SPP, DUN,
PAN)
Profiles based on Generic Attribute Profile
(GATT)
Weak connection setup Strong connection setup
Wider coverage Shorter coverage
Power hungry Low power
Bluetooth LowBluetooth Low
EnergyEnergy• Master Slave RoleMaster Slave Role
• Low Latency Connection - 3msLow Latency Connection - 3ms
Generic Access ProfileGeneric Access Profile
• PRE ConnectionPRE Connection
• Determines connection, advertising and howDetermines connection, advertising and how
devices interactsdevices interacts
• Define roles –Define roles – PeripheralsPeripherals andand CentralCentral
• DefineDefine payload for Advertising Data and Scanpayload for Advertising Data and Scan
ResponseResponse
• Advertising ProcessAdvertising Process
Generic AttributeGeneric Attribute
ProfileProfile• POST ConnectionPOST Connection
• Define way for data transfer between devicesDefine way for data transfer between devices

Profiles → collection of
Services

Services → distinguished by
UUID

Characteristics → encapsulates
a single data point
Bluetooth ProfilesBluetooth Profiles
Source https://www.facebook.com/raytaccorporation/photos/a.557851494377619.1073741829.169782503184522/576294762533292/?type=3
BluetoothBluetooth
StackStack
App1
Android Bluetooth Framework
Bluetooth Stack
(Bluedroid / BlueZ)
Linux Kernel + FirmwareLinux Kernel + Firmware
Bluetooth Hardware
App2 App3 App4
Bluetooth SystemBluetooth System
FilesFiles• bluetooth.default.sobluetooth.default.so
(external/bluetooth/bluedroid)(external/bluetooth/bluedroid)
• libbluetooth_jni.so (packages/app/Bluetooth/jni)libbluetooth_jni.so (packages/app/Bluetooth/jni)
• libbt-utils.so (external/bluetooth/bluedroid)libbt-utils.so (external/bluetooth/bluedroid)
• libbt-vendor.so (hardware/<vendor>)libbt-vendor.so (hardware/<vendor>)
• libbt-hci.so (external/bluedroid/main)libbt-hci.so (external/bluedroid/main)
SwitchingSwitching
OnOn
libhardware.solibhardware.so
bluetooth.default.sobluetooth.default.so
Linux KernelLinux Kernel
libbluetooth_jni.solibbluetooth_jni.so
Bluetooth.apkBluetooth.apk
Bluez vsBluez vs
BluedroidBluedroid• Community drivenCommunity driven
• Initiate by community vs vendorInitiate by community vs vendor
• Bluez very strong in Linux worldBluez very strong in Linux world
• Bluedroid strong in Android worldBluedroid strong in Android world
ClassicClassic
ProgrammingProgramming• Using BluetoothSocketUsing BluetoothSocket
• Pairing process using PINPairing process using PIN
• Blocking call when connectingBlocking call when connecting
• Thread management (important !)Thread management (important !)
• Managed state connectionManaged state connection
BLEBLE
ProgrammingProgramming• Android 4.3+ (API 18)Android 4.3+ (API 18)
• Setting Up Bluetooth AdapterSetting Up Bluetooth Adapter
• Scanning for BLE devicesScanning for BLE devices
• Connecting to GATTConnecting to GATT
• Reading AttributesReading Attributes
• Receive NotificationReceive Notification
DemDem
oo
ThankThank
YouYou

Más contenido relacionado

Más de Nanik Tolaram

Más de Nanik Tolaram (14)

ODROID Magazine December 2014
 ODROID Magazine December 2014 ODROID Magazine December 2014
ODROID Magazine December 2014
 
Peeking into Android Source
Peeking into Android SourcePeeking into Android Source
Peeking into Android Source
 
ODROID Magazine September 2014
ODROID Magazine September 2014ODROID Magazine September 2014
ODROID Magazine September 2014
 
Building Android Devices
Building Android DevicesBuilding Android Devices
Building Android Devices
 
ODROID Magazine August 2014
ODROID Magazine August 2014ODROID Magazine August 2014
ODROID Magazine August 2014
 
Android Wear Presentation
Android Wear PresentationAndroid Wear Presentation
Android Wear Presentation
 
ODROID Magazine June 2014
ODROID Magazine June 2014ODROID Magazine June 2014
ODROID Magazine June 2014
 
ODROID Magazine May 2014
ODROID Magazine May 2014ODROID Magazine May 2014
ODROID Magazine May 2014
 
Odroid Magazine March 2014
Odroid Magazine March 2014Odroid Magazine March 2014
Odroid Magazine March 2014
 
ODROID Magazine April 2014
ODROID Magazine April 2014ODROID Magazine April 2014
ODROID Magazine April 2014
 
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting Process
 
Learning AOSP - Building AOSP for Nexus 7
Learning AOSP - Building AOSP for Nexus 7Learning AOSP - Building AOSP for Nexus 7
Learning AOSP - Building AOSP for Nexus 7
 
Learning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device DriverLearning AOSP - Android Linux Device Driver
Learning AOSP - Android Linux Device Driver
 

Último

Último (20)

Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 

Android Bluetooth Stack