SlideShare una empresa de Scribd logo
1 de 25
Descargar para leer sin conexión
Android Bluetooth Introduction




               Erin Yueh
              2009/06/26




                   
Agenda
    ●   Android Bluetooth architecture
    ●   Related source code
    ●   Init Bluetooth 
    ●   Connect with other BT devices (dbus)
    ●   RFCOMM
    ●   OBEX (socket)


                               
Android architecture




                   
The diagram above offers a library-oriented
 
           view of the Bluetooth stack.
                          
     
Related source code
    ●   Bluez 3.36 (user space and kernel)
        ­ /mydroid/externel/bluez
        ­ /mydroid/kernel/drivers/bluetooth
        ­ /mydroid/kernel/net/bluetooth
    ●   Android app framework (java & c++)
        ­ /mydroid/frameworks/base/core/jni/android_bluetooth_*.cpp 
        ­ /mydroid/frameworks/base/core/java/android/bluetooth/*.java
        ­ /mydroid/frameworks/base/services/java/com/android/server/ (SystemServer)
    ●   Android UI application 
        ­ /mydroid/packages/apps/Phone/src/com/android/phone/ (Phone App)
        ­ /mydroid/packages/apps/Settings/src/com/android/settings/bluetooth/ (Settings App)

                                                  
Init Bluetooth 
    ●   /root/init.rc 

        mkdir /data/misc/hcid (store device info)
        service dbus /system/bin/dbus­daemon
        service hcid /system/bin/hcid (disabled)
        service hfag /system/bin/sdptool add ­­channel=10 HFAG (handsfree, disabled, one shot)
        service hsag /system/bin/sdptool add ­­channel=11 HSAG (headset, disabled, one shot)
    ●   /root/init.trout.rc

        service hciattach (disabled) 
    ●   system server

        decice BT power On or Off from settings value
        start related services




                                                      
ddms: dalvik debug monitor I.




                  
ddms: dalvik debug monitor II.




                   
Bluetooth headset




    Music player + Dialer 
                              
Connect with other BT devices




●
    Bluez: hcid daemon

●
    dbus-daemon: connections between hcid and system server

●
    D-Bus is a simple inter-process communication (IPC) system for software applications to communicate with one another.

●
    dbus-daemon is the D-Bus message bus daemon. D-Bus is first a library that provides one-to-one communication between
    any two applications; dbus-daemon is an application that uses this library to implement a message bus daemon. Multiple
    programs connect to the message bus daemon and can exchange messages with one another.

●
    debug utility: d-feet, dbus-monitor, dbus-send



                                                                  
BlueZ D­Bus Architecture 




                  
D­Feet: D­Bus viewer and debugger




                     
Dbus­send: send a message to a message 
bus




                    
Scan nearby BT devices in Android
    ●   Bluez utility: hcitool scan
    ●   DiscoverDevices: bluez/util/hcid/dbus­api.txt
        This method starts the device discovery procedure. This includes an inquiry 
        procedure and remote device name resolving. On start up this process will 
        generate a DiscoveryStarted signal and then return DeviceFound singals. If the 
        procedure has been finished an DiscoveryCompleted signal will be sent.
    ●   Source code: android_server_BluetoothDeviceService.cpp
        /* Compose the command */
        msg = dbus_message_new_method_call(BLUEZ_DBUS_BASE_IFC, nat­>adapter, 
        DBUS_CLASS_NAME, "DiscoverDevices");
        /* Send the command. */
        reply = dbus_connection_send_with_reply_and_block(nat­>conn, msg, ­1, &err);



                                                  
Signals




           
How to pair with a BT device? I. Register 
Passkey Agent




                       
II. Request PIN code




                        
RFCOMM (Radio Frequency 
Communication)
●
    The Bluetooth protocol RFCOMM is a simple set of 
    transport protocols.
●
    RFCOMM is sometimes called Serial Port Emulation. 
●
    The Bluetooth Serial Port Profile is based on this protocol.
●
    In the protocol stack, RFCOMM is bound to L2CAP
●
    RFCOMM provides a simple reliable data stream to the 
    user, similar to TCP. It is used directly by many telephony 
    related profiles as a carrier for AT commands




                                                                    
Send AT commands via bluetooth
    ●   Connect with Nokia N73 phone
    ●   > sdptool browse 00:18:C5:42:18:78
    ●   > sudo rfcomm connect 0 00:18:C5:42:18:78 2
    ●   minicom
    ●   > AT
    ●   > AT+CGMR
    ●   > AT+CGMI
                              
OBEX (Object EXchange)
    ●   a communications 
        protocol that 
        facilitates the 
        exchange of binary 
        objects between 
        devices.
    ●   in the protocol stack, 
        OBEX is bound to 
        RFCOMM
                                   
SOCKET 
    ●   UNIX socket 
        (AF_BLUETOOTH)
    ●   inter­process 
        communication 
    ●   like Internet socket
                                   recv()   send()
    ●   client­server



                                
Receive files via BT in Android
    ●   openobex + obexpushd  
    ●   Run an OBEX data server in Android
    ●   > obexpushd
    ●   listen RFCOMM connections
    ●   File permission




                             
Send files via BT in Android
    ●   Openobex + obexftp
    ●   Connect to a RFCOMM connection
    ●   > obex_test ­b BTADDR CHANNEL
    ●   > obexftp ­b BTADDR ­B CHANNEL ­­list




                              
Thank You!




         

Más contenido relacionado

La actualidad más candente

5G 기술과 활용 (5G technology and services) - 2019.05.11
5G 기술과 활용 (5G technology and services) - 2019.05.115G 기술과 활용 (5G technology and services) - 2019.05.11
5G 기술과 활용 (5G technology and services) - 2019.05.11Hakyong Kim
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesChris Simmonds
 
Bluetooth Basic Version
Bluetooth Basic VersionBluetooth Basic Version
Bluetooth Basic VersionAyesha Saeed
 
Linux Kernel and Driver Development Training
Linux Kernel and Driver Development TrainingLinux Kernel and Driver Development Training
Linux Kernel and Driver Development TrainingStephan Cadene
 
Bluetooth Presentation
Bluetooth PresentationBluetooth Presentation
Bluetooth Presentationguest664c3f
 
ABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting WalkthroughABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting WalkthroughBenjamin Zores
 
Bluetooth technology
Bluetooth technologyBluetooth technology
Bluetooth technologysai krish
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android DevelopmentAly Abdelkareem
 
Android - A brief introduction
Android - A brief introductionAndroid - A brief introduction
Android - A brief introductionRoshan Gautam
 
Introduction to Red Hat
Introduction to Red HatIntroduction to Red Hat
Introduction to Red HatAlbert Wong
 
Introduction to Android development - Presentation Report
Introduction to Android development - Presentation ReportIntroduction to Android development - Presentation Report
Introduction to Android development - Presentation ReportAtul Panjwani
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debuggingAshish Agrawal
 

La actualidad más candente (20)

Embedded Android : System Development - Part IV
Embedded Android : System Development - Part IVEmbedded Android : System Development - Part IV
Embedded Android : System Development - Part IV
 
Android Things : Building Embedded Devices
Android Things : Building Embedded DevicesAndroid Things : Building Embedded Devices
Android Things : Building Embedded Devices
 
Bluetooth ppt
Bluetooth pptBluetooth ppt
Bluetooth ppt
 
5G 기술과 활용 (5G technology and services) - 2019.05.11
5G 기술과 활용 (5G technology and services) - 2019.05.115G 기술과 활용 (5G technology and services) - 2019.05.11
5G 기술과 활용 (5G technology and services) - 2019.05.11
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot images
 
Bluetooth Basic Version
Bluetooth Basic VersionBluetooth Basic Version
Bluetooth Basic Version
 
Linux Kernel and Driver Development Training
Linux Kernel and Driver Development TrainingLinux Kernel and Driver Development Training
Linux Kernel and Driver Development Training
 
Bluetooth Presentation
Bluetooth PresentationBluetooth Presentation
Bluetooth Presentation
 
ABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting WalkthroughABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting Walkthrough
 
Bluetooth
BluetoothBluetooth
Bluetooth
 
Bluetooth technology
Bluetooth technologyBluetooth technology
Bluetooth technology
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Android - A brief introduction
Android - A brief introductionAndroid - A brief introduction
Android - A brief introduction
 
Introduction to Red Hat
Introduction to Red HatIntroduction to Red Hat
Introduction to Red Hat
 
Android presentation
Android presentationAndroid presentation
Android presentation
 
Android ppt
Android pptAndroid ppt
Android ppt
 
Introduction to Android development - Presentation Report
Introduction to Android development - Presentation ReportIntroduction to Android development - Presentation Report
Introduction to Android development - Presentation Report
 
Bluetooth
BluetoothBluetooth
Bluetooth
 
Wireless Usb
Wireless UsbWireless Usb
Wireless Usb
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debugging
 

Destacado

Bluetooth based-chatting-system-using-android-docx
Bluetooth based-chatting-system-using-android-docxBluetooth based-chatting-system-using-android-docx
Bluetooth based-chatting-system-using-android-docxshanofa sanu
 
My presentation on Android in my college
My presentation on Android in my collegeMy presentation on Android in my college
My presentation on Android in my collegeSneha Lata
 
A project report on chat application
A project report on chat applicationA project report on chat application
A project report on chat applicationKumar Gaurav
 
Android seminar-presentation
Android seminar-presentationAndroid seminar-presentation
Android seminar-presentationconnectshilpa
 
Bluetooth android application For interfacing with arduino
Bluetooth android application For interfacing with arduinoBluetooth android application For interfacing with arduino
Bluetooth android application For interfacing with arduinosumit chakraborty
 
Connect your Android to the real world with Bluetooth Low Energy
Connect your Android to the real world with Bluetooth Low EnergyConnect your Android to the real world with Bluetooth Low Energy
Connect your Android to the real world with Bluetooth Low EnergyGabor Paller
 
project
projectproject
projectdnraj
 
Android vs Others Operating System
Android vs Others Operating SystemAndroid vs Others Operating System
Android vs Others Operating SystemShemul Hossain
 
Android Development: The Basics
Android Development: The BasicsAndroid Development: The Basics
Android Development: The BasicsMike Desjardins
 
Bluetooth technology presentation
Bluetooth technology presentationBluetooth technology presentation
Bluetooth technology presentationKrishna Kumari
 

Destacado (20)

Android bluetooth
Android bluetoothAndroid bluetooth
Android bluetooth
 
Bluetooth Chat
Bluetooth ChatBluetooth Chat
Bluetooth Chat
 
Android ppt
Android ppt Android ppt
Android ppt
 
Bluetooth based-chatting-system-using-android-docx
Bluetooth based-chatting-system-using-android-docxBluetooth based-chatting-system-using-android-docx
Bluetooth based-chatting-system-using-android-docx
 
Android workShop
Android workShopAndroid workShop
Android workShop
 
My presentation on Android in my college
My presentation on Android in my collegeMy presentation on Android in my college
My presentation on Android in my college
 
A project report on chat application
A project report on chat applicationA project report on chat application
A project report on chat application
 
Android seminar-presentation
Android seminar-presentationAndroid seminar-presentation
Android seminar-presentation
 
Android ppt
Android pptAndroid ppt
Android ppt
 
Bluetooth android application For interfacing with arduino
Bluetooth android application For interfacing with arduinoBluetooth android application For interfacing with arduino
Bluetooth android application For interfacing with arduino
 
Connect your Android to the real world with Bluetooth Low Energy
Connect your Android to the real world with Bluetooth Low EnergyConnect your Android to the real world with Bluetooth Low Energy
Connect your Android to the real world with Bluetooth Low Energy
 
Power Management from Linux Kernel to Android
Power Management from Linux Kernel to AndroidPower Management from Linux Kernel to Android
Power Management from Linux Kernel to Android
 
Bluetooth
BluetoothBluetooth
Bluetooth
 
project
projectproject
project
 
Design and Concepts of Android Graphics
Design and Concepts of Android GraphicsDesign and Concepts of Android Graphics
Design and Concepts of Android Graphics
 
Software Design patterns on Android English
Software Design patterns on Android EnglishSoftware Design patterns on Android English
Software Design patterns on Android English
 
Android vs Others Operating System
Android vs Others Operating SystemAndroid vs Others Operating System
Android vs Others Operating System
 
Android Development: The Basics
Android Development: The BasicsAndroid Development: The Basics
Android Development: The Basics
 
PPT Companion to Android
PPT Companion to AndroidPPT Companion to Android
PPT Companion to Android
 
Bluetooth technology presentation
Bluetooth technology presentationBluetooth technology presentation
Bluetooth technology presentation
 

Similar a Android Bluetooth Introduction: Architecture, Code, and Profiles

Android debug bridge
Android debug bridgeAndroid debug bridge
Android debug bridgeWave Digitech
 
Controlpcviabluetoothenablemobile 091028150632-phpapp01
Controlpcviabluetoothenablemobile 091028150632-phpapp01Controlpcviabluetoothenablemobile 091028150632-phpapp01
Controlpcviabluetoothenablemobile 091028150632-phpapp01nagapriyanka
 
Control Pc Via Bluetooth Enable Mobile
Control Pc Via Bluetooth Enable MobileControl Pc Via Bluetooth Enable Mobile
Control Pc Via Bluetooth Enable MobileSamiul Hoque
 
Controlpcviabluetoothenablemobile 091028150632-phpapp01
Controlpcviabluetoothenablemobile 091028150632-phpapp01Controlpcviabluetoothenablemobile 091028150632-phpapp01
Controlpcviabluetoothenablemobile 091028150632-phpapp01ramaswamireddy challa
 
Manish Chasta - Securing Android Applications
Manish Chasta - Securing Android ApplicationsManish Chasta - Securing Android Applications
Manish Chasta - Securing Android ApplicationsPositive Hack Days
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Codemotion
 
DevFest 2022 - Cloud Workstation Introduction TaiChung
DevFest 2022 - Cloud Workstation Introduction TaiChungDevFest 2022 - Cloud Workstation Introduction TaiChung
DevFest 2022 - Cloud Workstation Introduction TaiChungKAI CHU CHUNG
 
Embedded Android
Embedded AndroidEmbedded Android
Embedded Android晓东 杜
 
IBCAST 2021: Observations and lessons learned from the APNIC Community Honeyn...
IBCAST 2021: Observations and lessons learned from the APNIC Community Honeyn...IBCAST 2021: Observations and lessons learned from the APNIC Community Honeyn...
IBCAST 2021: Observations and lessons learned from the APNIC Community Honeyn...APNIC
 
An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To Androidnatdefreitas
 
Interacting with your app through the command line
Interacting with your app through the command lineInteracting with your app through the command line
Interacting with your app through the command lineRoman Mazur
 
Android Workshop
Android WorkshopAndroid Workshop
Android WorkshopJunda Ong
 
Cloud Computing in Mobile
Cloud Computing in MobileCloud Computing in Mobile
Cloud Computing in MobileSVWB
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptxssuserb4d806
 
Cold front - bridging the web and the physical world
Cold front - bridging the web and the physical worldCold front - bridging the web and the physical world
Cold front - bridging the web and the physical worldKenneth Rohde Christiansen
 
[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt
[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt
[Webinar] QtSerialBus: Using Modbus and CAN bus with QtICS
 
Getting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitSulamita Garcia
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionBen Hall
 

Similar a Android Bluetooth Introduction: Architecture, Code, and Profiles (20)

Tutorial mikrotik step by step
Tutorial mikrotik step by stepTutorial mikrotik step by step
Tutorial mikrotik step by step
 
Android debug bridge
Android debug bridgeAndroid debug bridge
Android debug bridge
 
Controlpcviabluetoothenablemobile 091028150632-phpapp01
Controlpcviabluetoothenablemobile 091028150632-phpapp01Controlpcviabluetoothenablemobile 091028150632-phpapp01
Controlpcviabluetoothenablemobile 091028150632-phpapp01
 
Control Pc Via Bluetooth Enable Mobile
Control Pc Via Bluetooth Enable MobileControl Pc Via Bluetooth Enable Mobile
Control Pc Via Bluetooth Enable Mobile
 
Controlpcviabluetoothenablemobile 091028150632-phpapp01
Controlpcviabluetoothenablemobile 091028150632-phpapp01Controlpcviabluetoothenablemobile 091028150632-phpapp01
Controlpcviabluetoothenablemobile 091028150632-phpapp01
 
Manish Chasta - Securing Android Applications
Manish Chasta - Securing Android ApplicationsManish Chasta - Securing Android Applications
Manish Chasta - Securing Android Applications
 
Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!Lab Handson: Power your Creations with Intel Edison!
Lab Handson: Power your Creations with Intel Edison!
 
DevFest 2022 - Cloud Workstation Introduction TaiChung
DevFest 2022 - Cloud Workstation Introduction TaiChungDevFest 2022 - Cloud Workstation Introduction TaiChung
DevFest 2022 - Cloud Workstation Introduction TaiChung
 
Embedded Android
Embedded AndroidEmbedded Android
Embedded Android
 
IBCAST 2021: Observations and lessons learned from the APNIC Community Honeyn...
IBCAST 2021: Observations and lessons learned from the APNIC Community Honeyn...IBCAST 2021: Observations and lessons learned from the APNIC Community Honeyn...
IBCAST 2021: Observations and lessons learned from the APNIC Community Honeyn...
 
An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To Android
 
Interacting with your app through the command line
Interacting with your app through the command lineInteracting with your app through the command line
Interacting with your app through the command line
 
Android Workshop
Android WorkshopAndroid Workshop
Android Workshop
 
Cloud Computing in Mobile
Cloud Computing in MobileCloud Computing in Mobile
Cloud Computing in Mobile
 
Defcon 18-dunning-breaking-bluetooth
Defcon 18-dunning-breaking-bluetoothDefcon 18-dunning-breaking-bluetooth
Defcon 18-dunning-breaking-bluetooth
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptx
 
Cold front - bridging the web and the physical world
Cold front - bridging the web and the physical worldCold front - bridging the web and the physical world
Cold front - bridging the web and the physical world
 
[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt
[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt
[Webinar] QtSerialBus: Using Modbus and CAN bus with Qt
 
Getting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer KitGetting started with Intel IoT Developer Kit
Getting started with Intel IoT Developer Kit
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 

Último

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Último (20)

DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

Android Bluetooth Introduction: Architecture, Code, and Profiles

  • 1. Android Bluetooth Introduction Erin Yueh 2009/06/26    
  • 2. Agenda ● Android Bluetooth architecture ● Related source code ● Init Bluetooth  ● Connect with other BT devices (dbus) ● RFCOMM ● OBEX (socket)    
  • 4. The diagram above offers a library-oriented   view of the Bluetooth stack.  
  • 5.    
  • 6. Related source code ● Bluez 3.36 (user space and kernel) ­ /mydroid/externel/bluez ­ /mydroid/kernel/drivers/bluetooth ­ /mydroid/kernel/net/bluetooth ● Android app framework (java & c++) ­ /mydroid/frameworks/base/core/jni/android_bluetooth_*.cpp  ­ /mydroid/frameworks/base/core/java/android/bluetooth/*.java ­ /mydroid/frameworks/base/services/java/com/android/server/ (SystemServer) ● Android UI application  ­ /mydroid/packages/apps/Phone/src/com/android/phone/ (Phone App) ­ /mydroid/packages/apps/Settings/src/com/android/settings/bluetooth/ (Settings App)    
  • 7. Init Bluetooth  ● /root/init.rc  mkdir /data/misc/hcid (store device info) service dbus /system/bin/dbus­daemon service hcid /system/bin/hcid (disabled) service hfag /system/bin/sdptool add ­­channel=10 HFAG (handsfree, disabled, one shot) service hsag /system/bin/sdptool add ­­channel=11 HSAG (headset, disabled, one shot) ● /root/init.trout.rc service hciattach (disabled)  ● system server decice BT power On or Off from settings value start related services    
  • 10. Bluetooth headset Music player + Dialer     
  • 11. Connect with other BT devices ● Bluez: hcid daemon ● dbus-daemon: connections between hcid and system server ● D-Bus is a simple inter-process communication (IPC) system for software applications to communicate with one another. ● dbus-daemon is the D-Bus message bus daemon. D-Bus is first a library that provides one-to-one communication between any two applications; dbus-daemon is an application that uses this library to implement a message bus daemon. Multiple programs connect to the message bus daemon and can exchange messages with one another. ● debug utility: d-feet, dbus-monitor, dbus-send    
  • 15. Scan nearby BT devices in Android ● Bluez utility: hcitool scan ● DiscoverDevices: bluez/util/hcid/dbus­api.txt This method starts the device discovery procedure. This includes an inquiry  procedure and remote device name resolving. On start up this process will  generate a DiscoveryStarted signal and then return DeviceFound singals. If the  procedure has been finished an DiscoveryCompleted signal will be sent. ● Source code: android_server_BluetoothDeviceService.cpp /* Compose the command */ msg = dbus_message_new_method_call(BLUEZ_DBUS_BASE_IFC, nat­>adapter,  DBUS_CLASS_NAME, "DiscoverDevices"); /* Send the command. */ reply = dbus_connection_send_with_reply_and_block(nat­>conn, msg, ­1, &err);    
  • 19. RFCOMM (Radio Frequency  Communication) ● The Bluetooth protocol RFCOMM is a simple set of  transport protocols. ● RFCOMM is sometimes called Serial Port Emulation.  ● The Bluetooth Serial Port Profile is based on this protocol. ● In the protocol stack, RFCOMM is bound to L2CAP ● RFCOMM provides a simple reliable data stream to the  user, similar to TCP. It is used directly by many telephony  related profiles as a carrier for AT commands    
  • 20. Send AT commands via bluetooth ● Connect with Nokia N73 phone ● > sdptool browse 00:18:C5:42:18:78 ● > sudo rfcomm connect 0 00:18:C5:42:18:78 2 ● minicom ● > AT ● > AT+CGMR ● > AT+CGMI    
  • 21. OBEX (Object EXchange) ● a communications  protocol that  facilitates the  exchange of binary  objects between  devices. ● in the protocol stack,  OBEX is bound to  RFCOMM    
  • 22. SOCKET  ● UNIX socket  (AF_BLUETOOTH) ● inter­process  communication  ● like Internet socket recv() send() ● client­server    
  • 23. Receive files via BT in Android ● openobex + obexpushd   ● Run an OBEX data server in Android ● > obexpushd ● listen RFCOMM connections ● File permission    
  • 24. Send files via BT in Android ● Openobex + obexftp ● Connect to a RFCOMM connection ● > obex_test ­b BTADDR CHANNEL ● > obexftp ­b BTADDR ­B CHANNEL ­­list