SlideShare a Scribd company logo
2
Most read
13
Most read
14
Most read
Android Open Accessory Protocol
Turn Your Linux machine as ADK
By
Rajesh Sola,
CDAC ACTS,Pune
`
OSI Days 2014,
Nimhans Convention
Centre, Bengaluru
Outline
● Need for AOA Protocol/ADK
● Introduction,History
● Available ADK hardware
● Initializing Android device
● Using driver skeleton
● Communication – ADK Side
● Sample Apps
● Developing your own apps
● Communication – Android Side
Need for AOA Protocol/ADK Host
● Peripheral support of typical android gadget
● Adding more peripherals like temperature
sensor,CANBus support,SPI,I2C,PWM etc?
● With/wthout rooting of android device
● Scope of Android USB Host capabilities
● USB device capabilities of android gadget
● Alternatives for USB – Bluetooth,WiFi etc.
● Designing rich UI for your hardware control.
● Lets talk about the solution for all...
ADK Host
● In this protocol android gadget is kept in device mode
and external hardware will be chosen in host mode
● Any hardware with USB host capabilities and capable
of supplying a power of 5V@500mA to the android
device can be chosen for this purpose,which is called
as Android Accessory Development Kit(ADK) or
Accessory Host
● Simple USB communication with two bulk end
points
History
● AOA v1.0
– Supported from Android 3.1(API Level 12) onwards
– With add on library from Android 2.3.4(API level 10)
– Announced in Google I/O 2011
– Demonstrated through Custom shield for Arduino
Mega board
● AOA v2.0
– Supported from Android 4.1(API Level 16) onwards
– Comes with additional features like audio,hid
support and bluetooth connectivity
– Announced in Google I/O 2012
– Demonstrated through Arduino Due based custom
board
Available Hardware for ADK
● Arduino Mega
● Arduino Due
● AOA kit from Embedded Artists
● FTDI Vinculum II
● Microchip PIC24F ADK
● Sparkfun IOIO
● BeagleBone powered with TI Starterware
Any Linux machine with USB Host support
Not limited to this hardware,any
board with USB Host support can
be designed as ADK with suitable
USB Host APIs. The only advantage
with this listing is availability of some
sample code and certain tested apps.
Initialization
Step1:-
● Send Control request 51(0x33) to get the protocol
version
● Returns 1 for AOA 1.0, 2 for AOA 2.0
bmRequestType TYPE_VENDOR|
DIR_DEVICE_TO_HOST
bRequest 51
wValue 0
wIndex 0
Data Address of two byte buffer
wLength 2
Initialization
Step2:-
● Send identity strings through control request 52
● Essentially one should send manufacturer, model,
version to communicate ADK with an app
● Rest all are optional
bmRequestTyp
e
TYPE_VENDOR|
DIR_HOST_TO_DEVICE
bRequest 52
wValue 0
wIndex String id
Data Address of string
wLength Length of the string
String IDs
Manufacturer 0
Model 1
Description 2
Version 3
Url 4
Serial id 5
Initialization
Step3:-
● Start in accessory mode through control request
53(0x35)
● Launch an app matched by essential identity strings
or start without app just for audio/hid support.
bmRequestType TYPE_VENDOR|
DIR_HOST_TO_DEVICE
bRequest 53
wValue 0
wIndex 0
Data NULL
wLength 0
Audio Support
● Send control request 0x58 for audio support with
value=1 for 2 channel 16 bit PCM @ 44100 Kh`z
● If you are requesting for audio support,this must be
done before starting in accessory mode
● If manufacturer,model identity strings are not
supplied device goes to audio only mode
bmRequestType TYPE_VENDOR|
DIR_HOST_TO_DEVICE
bRequest 53
wValue 1
wIndex 0
Data NULL
wLength 0
HID Support
● ADK can acts as HID event source or HID proxy to
your android device
● The following request codes are used for HID support
Register HID 54
Unregister HID 55
Set HID Report 56
Send HID Event 57
Configuration
0x18D1:0x2D00 Accessory only
0x18D1:0x2D01 Accessory+ADB
0x18D1:0x2D02 Audio only
0x18D1:0x2D03 Audio + ADB
0x18D1:0x2D04 Accessory + Audio
0x18D1:0x2D05 Accessory + Audio + ADB
● Upon initialization android device switches to
accessory mode from MTP/PTP mode and re-
enumerated by ADK Host with one of the following
vendor id,product id combinations and interface 0
with two bulk end points for communication
Using driver skeleton
● Hosted on github.com/rajeshsola/adk-driver-skeleton
based on Gary Bisson's libusb based linux-adk code
● Load the driver,optionally with module parameters
my_dev_vid, my_dev_pid
● Initialize using simple shell commands
cat /sys/kernel/adk_linux/aoa_init/version
echo “Manu=OSI Days” > /sys/kernel/adk_linux/aoa_init/identity
echo “Model=uisample” > /sys/kernel/adk_linux/aoa_init/identity
echo “version=1.0” > /sys/kernel/adk_linux/aoa_init/identity
echo “accessory” > /sys/kernel/adk_linux/aoa_init/start
● Alternatives for initialization
ioctl code
module parametet init_on_probe=1
Communication – ADK side
● Simple userspace file operations on linux(ADK) side to talk to
the app
● Start the communication
fd=open(“/dev/aoa-skel0”,O_RDWR);
● For output peripherals(Android to ADK), eg:- LEDs,Volume
read(fd,buf,len);
//process the buffer and control peripherals
● For input peripherals(ADK to Android), eg:- Sensors, RTC
//fill the buffer with state of peripherals
write(fd,str,len);
● Stop the communication
close(fd);
● can go for threaded design for Asynchronous transfer
Sample Apps
● From Google Playstore
– ADK 2012 from Google
– Basic Accessory Demo from Microchip
● From other repositories with source code
– SimpleAccessory Demo
– Examples for AOA Kit from Embedded Artists
– ADK Demo from rowboat project for beagle bone
– TinyAccessory Demo
– FTDI Android examples
Developing Your own Apps
● intent-filter section and other changes in Manifest file
● Getting the reference of USB service manager
● Getting the reference for connected accessory
● Checking/Obtaining permissions
● Getting references of file streams
● Steps to take care during Activity life cycle
– OnCreate
– OnPause
– OnResume
– OnDestroy
● A walk through of skeleton code ADKControl class
Communication – Android App side
● Add the skeleton class ADKControl to your project
● Create an instance of ADKControl in MainActivity
by passing the reference of same,if necessary pass the
reference of ADKControl to other activities or
fragments or retrieve through getInstance(null)
ADKControl adk=ADKControl.getInstance(this)
● Use sendCommand method for output activity,in
appropriate listeners
● Use readData method for input activity, preferably in
a different thread for asynchronous read
● Can obtain references for Input,Output references
using methods getInputStream,getOutputStream
An Example – App to ADK
Peripheral
Type
Peripheral
Id
Peripheral
State/Data
Peripheral
Data
Peripheral
Data
Byte buffer
0 1 2 3 4
--------------->
An Example – ADK to App
Input
Type
DataData DataData DataData --------------->
0x46 hours mins secs
Thank You
http://github.com/rajeshsola/adk-driver-skeleton
rajeshsola@gmail.com

More Related Content

PDF
Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...
The Linux Foundation
 
PDF
Android power management
Jerrin George
 
PPTX
Android vs iOS security
Sumanth Veera
 
PDF
ADB(Android Debug Bridge): How it works?
Tetsuyuki Kobayashi
 
PDF
Booting Android: bootloaders, fastboot and boot images
Chris Simmonds
 
PDF
Android
Jindal Gohil
 
ODP
Inter-process communication of Android
Tetsuyuki Kobayashi
 
PPT
Linux Audio Drivers. ALSA
GlobalLogic Ukraine
 
Rootlinux17: Hypervisors on ARM - Overview and Design Choices by Julien Grall...
The Linux Foundation
 
Android power management
Jerrin George
 
Android vs iOS security
Sumanth Veera
 
ADB(Android Debug Bridge): How it works?
Tetsuyuki Kobayashi
 
Booting Android: bootloaders, fastboot and boot images
Chris Simmonds
 
Android
Jindal Gohil
 
Inter-process communication of Android
Tetsuyuki Kobayashi
 
Linux Audio Drivers. ALSA
GlobalLogic Ukraine
 

What's hot (20)

PDF
Embedded Android : System Development - Part IV
Emertxe Information Technologies Pvt Ltd
 
ODP
Hybrid application development
Knoldus Inc.
 
PDF
Embedded Android : System Development - Part II (HAL)
Emertxe Information Technologies Pvt Ltd
 
PPT
PPT Companion to Android
Dharani Kumar Madduri
 
PPTX
Android Training (Storing & Shared Preferences)
Khaled Anaqwa
 
PDF
Android Boot Time Optimization
Kan-Ru Chen
 
PDF
Android Programming Basics
Eueung Mulyana
 
PDF
Embedded Android Workshop
Opersys inc.
 
PDF
Android - Wakelock detector
Hikmat Abdoollayev
 
PDF
Character Drivers
Anil Kumar Pugalia
 
PPT
Learning AOSP - Android Booting Process
Nanik Tolaram
 
PDF
Android media
Krazy Koder
 
PPT
Android booting sequece and setup and debugging
Utkarsh Mankad
 
PPT
Mobile Application Development With Android
guest213e237
 
PPTX
Android Training Report
Achal kumari
 
PDF
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Opersys inc.
 
PPTX
Android internals By Rajesh Khetan
Rajesh Khetan
 
PDF
Embedded Android : System Development - Part I
Emertxe Information Technologies Pvt Ltd
 
PDF
Xen Memory Management
The Linux Foundation
 
Embedded Android : System Development - Part IV
Emertxe Information Technologies Pvt Ltd
 
Hybrid application development
Knoldus Inc.
 
Embedded Android : System Development - Part II (HAL)
Emertxe Information Technologies Pvt Ltd
 
PPT Companion to Android
Dharani Kumar Madduri
 
Android Training (Storing & Shared Preferences)
Khaled Anaqwa
 
Android Boot Time Optimization
Kan-Ru Chen
 
Android Programming Basics
Eueung Mulyana
 
Embedded Android Workshop
Opersys inc.
 
Android - Wakelock detector
Hikmat Abdoollayev
 
Character Drivers
Anil Kumar Pugalia
 
Learning AOSP - Android Booting Process
Nanik Tolaram
 
Android media
Krazy Koder
 
Android booting sequece and setup and debugging
Utkarsh Mankad
 
Mobile Application Development With Android
guest213e237
 
Android Training Report
Achal kumari
 
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
Opersys inc.
 
Android internals By Rajesh Khetan
Rajesh Khetan
 
Embedded Android : System Development - Part I
Emertxe Information Technologies Pvt Ltd
 
Xen Memory Management
The Linux Foundation
 
Ad

Viewers also liked (17)

PDF
Leveraging the Android Open Accessory Protocol
Gary Bisson
 
PPT
Development, debug and deploy hardware/software solutions based on Android an...
Илья Родин
 
PPSX
Controlling and monitoring external embedded device using android frameworks ...
Dhruvilkumar patel
 
PDF
Getting started with IOT Development using Fedora on ARM
Rajesh Sola
 
PDF
aoa-adk-osidays-rajeshsola
Rajesh Sola
 
PDF
Hands on with embedded linux using zero hardware
Rajesh Sola
 
PDF
Kickstarting IOT using NodeRED
Rajesh Sola
 
PDF
Hacktime for adk
SeongJae Park
 
DOCX
Seminar on Android Auto
Kiran Krishna
 
PDF
AAME ARM Techcon2013 002v02 Advanced Features
Anh Dung NGUYEN
 
PDF
Experience protocol buffer on android
Richard Chang
 
PDF
fudcon-fedora-arm-iot-rajeshsola
Rajesh Sola
 
PDF
Vba Macros Interoperability
Rajesh Sola
 
PDF
Go Green - Save Power
Rajesh Sola
 
PDF
Introduction of Android Auto
Zaicheng Qi
 
PDF
[NEXT] Android Profiler 사용법
YoungSu Son
 
PPTX
Android - ADB
Yossi Gruner
 
Leveraging the Android Open Accessory Protocol
Gary Bisson
 
Development, debug and deploy hardware/software solutions based on Android an...
Илья Родин
 
Controlling and monitoring external embedded device using android frameworks ...
Dhruvilkumar patel
 
Getting started with IOT Development using Fedora on ARM
Rajesh Sola
 
aoa-adk-osidays-rajeshsola
Rajesh Sola
 
Hands on with embedded linux using zero hardware
Rajesh Sola
 
Kickstarting IOT using NodeRED
Rajesh Sola
 
Hacktime for adk
SeongJae Park
 
Seminar on Android Auto
Kiran Krishna
 
AAME ARM Techcon2013 002v02 Advanced Features
Anh Dung NGUYEN
 
Experience protocol buffer on android
Richard Chang
 
fudcon-fedora-arm-iot-rajeshsola
Rajesh Sola
 
Vba Macros Interoperability
Rajesh Sola
 
Go Green - Save Power
Rajesh Sola
 
Introduction of Android Auto
Zaicheng Qi
 
[NEXT] Android Profiler 사용법
YoungSu Son
 
Android - ADB
Yossi Gruner
 
Ad

Similar to Android Open Accessory Protocol - Turn Your Linux machine as ADK (20)

PDF
FTF2014 - Android Accessory Protocol
Gary Bisson
 
PDF
From Arduino to ADK
CoLab Athens
 
PDF
Android のusb support
magoroku Yamamoto
 
PDF
Android project
Rajdeep Sahoo
 
PPTX
Android meets Arduino
Andino Maseleno
 
ODP
Osh camp 2012 experience with adk
Paul Tanner
 
ODP
Osh camp 2012 experience with adk
Paul Tanner
 
PDF
Smartphone++
mharkus
 
KEY
I/O 2011 報告会 ADKで遊んでみた
Makoto Yamazaki
 
PPTX
Android Open Accessory
Shaul Rosenzwieg
 
PPTX
Android Open Accessory APIs
Pearl Chen
 
PDF
Programming objects with android
firenze-gtug
 
PDF
Adk 101
amirlazarovich
 
PDF
Hardware hacking
Tavish Naruka
 
PPT
GDG-CJ; Andorid and Arduino: Amarino
Alexandru IOVANOVICI
 
PDF
Embedded Android Workshop part I ESC SV 2012
Opersys inc.
 
PDF
Tos tutorial
manikainth
 
PDF
Show & Tell.- Introduction
zvikapika
 
PPTX
Capabilities of Arduino
Sudar Muthu
 
ODP
Philip polstra
Philip Polstra
 
FTF2014 - Android Accessory Protocol
Gary Bisson
 
From Arduino to ADK
CoLab Athens
 
Android のusb support
magoroku Yamamoto
 
Android project
Rajdeep Sahoo
 
Android meets Arduino
Andino Maseleno
 
Osh camp 2012 experience with adk
Paul Tanner
 
Osh camp 2012 experience with adk
Paul Tanner
 
Smartphone++
mharkus
 
I/O 2011 報告会 ADKで遊んでみた
Makoto Yamazaki
 
Android Open Accessory
Shaul Rosenzwieg
 
Android Open Accessory APIs
Pearl Chen
 
Programming objects with android
firenze-gtug
 
Hardware hacking
Tavish Naruka
 
GDG-CJ; Andorid and Arduino: Amarino
Alexandru IOVANOVICI
 
Embedded Android Workshop part I ESC SV 2012
Opersys inc.
 
Tos tutorial
manikainth
 
Show & Tell.- Introduction
zvikapika
 
Capabilities of Arduino
Sudar Muthu
 
Philip polstra
Philip Polstra
 

Recently uploaded (20)

PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
The Future of Artificial Intelligence (AI)
Mukul
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 

Android Open Accessory Protocol - Turn Your Linux machine as ADK

  • 1. Android Open Accessory Protocol Turn Your Linux machine as ADK By Rajesh Sola, CDAC ACTS,Pune ` OSI Days 2014, Nimhans Convention Centre, Bengaluru
  • 2. Outline ● Need for AOA Protocol/ADK ● Introduction,History ● Available ADK hardware ● Initializing Android device ● Using driver skeleton ● Communication – ADK Side ● Sample Apps ● Developing your own apps ● Communication – Android Side
  • 3. Need for AOA Protocol/ADK Host ● Peripheral support of typical android gadget ● Adding more peripherals like temperature sensor,CANBus support,SPI,I2C,PWM etc? ● With/wthout rooting of android device ● Scope of Android USB Host capabilities ● USB device capabilities of android gadget ● Alternatives for USB – Bluetooth,WiFi etc. ● Designing rich UI for your hardware control. ● Lets talk about the solution for all...
  • 4. ADK Host ● In this protocol android gadget is kept in device mode and external hardware will be chosen in host mode ● Any hardware with USB host capabilities and capable of supplying a power of 5V@500mA to the android device can be chosen for this purpose,which is called as Android Accessory Development Kit(ADK) or Accessory Host ● Simple USB communication with two bulk end points
  • 5. History ● AOA v1.0 – Supported from Android 3.1(API Level 12) onwards – With add on library from Android 2.3.4(API level 10) – Announced in Google I/O 2011 – Demonstrated through Custom shield for Arduino Mega board ● AOA v2.0 – Supported from Android 4.1(API Level 16) onwards – Comes with additional features like audio,hid support and bluetooth connectivity – Announced in Google I/O 2012 – Demonstrated through Arduino Due based custom board
  • 6. Available Hardware for ADK ● Arduino Mega ● Arduino Due ● AOA kit from Embedded Artists ● FTDI Vinculum II ● Microchip PIC24F ADK ● Sparkfun IOIO ● BeagleBone powered with TI Starterware Any Linux machine with USB Host support Not limited to this hardware,any board with USB Host support can be designed as ADK with suitable USB Host APIs. The only advantage with this listing is availability of some sample code and certain tested apps.
  • 7. Initialization Step1:- ● Send Control request 51(0x33) to get the protocol version ● Returns 1 for AOA 1.0, 2 for AOA 2.0 bmRequestType TYPE_VENDOR| DIR_DEVICE_TO_HOST bRequest 51 wValue 0 wIndex 0 Data Address of two byte buffer wLength 2
  • 8. Initialization Step2:- ● Send identity strings through control request 52 ● Essentially one should send manufacturer, model, version to communicate ADK with an app ● Rest all are optional bmRequestTyp e TYPE_VENDOR| DIR_HOST_TO_DEVICE bRequest 52 wValue 0 wIndex String id Data Address of string wLength Length of the string String IDs Manufacturer 0 Model 1 Description 2 Version 3 Url 4 Serial id 5
  • 9. Initialization Step3:- ● Start in accessory mode through control request 53(0x35) ● Launch an app matched by essential identity strings or start without app just for audio/hid support. bmRequestType TYPE_VENDOR| DIR_HOST_TO_DEVICE bRequest 53 wValue 0 wIndex 0 Data NULL wLength 0
  • 10. Audio Support ● Send control request 0x58 for audio support with value=1 for 2 channel 16 bit PCM @ 44100 Kh`z ● If you are requesting for audio support,this must be done before starting in accessory mode ● If manufacturer,model identity strings are not supplied device goes to audio only mode bmRequestType TYPE_VENDOR| DIR_HOST_TO_DEVICE bRequest 53 wValue 1 wIndex 0 Data NULL wLength 0
  • 11. HID Support ● ADK can acts as HID event source or HID proxy to your android device ● The following request codes are used for HID support Register HID 54 Unregister HID 55 Set HID Report 56 Send HID Event 57
  • 12. Configuration 0x18D1:0x2D00 Accessory only 0x18D1:0x2D01 Accessory+ADB 0x18D1:0x2D02 Audio only 0x18D1:0x2D03 Audio + ADB 0x18D1:0x2D04 Accessory + Audio 0x18D1:0x2D05 Accessory + Audio + ADB ● Upon initialization android device switches to accessory mode from MTP/PTP mode and re- enumerated by ADK Host with one of the following vendor id,product id combinations and interface 0 with two bulk end points for communication
  • 13. Using driver skeleton ● Hosted on github.com/rajeshsola/adk-driver-skeleton based on Gary Bisson's libusb based linux-adk code ● Load the driver,optionally with module parameters my_dev_vid, my_dev_pid ● Initialize using simple shell commands cat /sys/kernel/adk_linux/aoa_init/version echo “Manu=OSI Days” > /sys/kernel/adk_linux/aoa_init/identity echo “Model=uisample” > /sys/kernel/adk_linux/aoa_init/identity echo “version=1.0” > /sys/kernel/adk_linux/aoa_init/identity echo “accessory” > /sys/kernel/adk_linux/aoa_init/start ● Alternatives for initialization ioctl code module parametet init_on_probe=1
  • 14. Communication – ADK side ● Simple userspace file operations on linux(ADK) side to talk to the app ● Start the communication fd=open(“/dev/aoa-skel0”,O_RDWR); ● For output peripherals(Android to ADK), eg:- LEDs,Volume read(fd,buf,len); //process the buffer and control peripherals ● For input peripherals(ADK to Android), eg:- Sensors, RTC //fill the buffer with state of peripherals write(fd,str,len); ● Stop the communication close(fd); ● can go for threaded design for Asynchronous transfer
  • 15. Sample Apps ● From Google Playstore – ADK 2012 from Google – Basic Accessory Demo from Microchip ● From other repositories with source code – SimpleAccessory Demo – Examples for AOA Kit from Embedded Artists – ADK Demo from rowboat project for beagle bone – TinyAccessory Demo – FTDI Android examples
  • 16. Developing Your own Apps ● intent-filter section and other changes in Manifest file ● Getting the reference of USB service manager ● Getting the reference for connected accessory ● Checking/Obtaining permissions ● Getting references of file streams ● Steps to take care during Activity life cycle – OnCreate – OnPause – OnResume – OnDestroy ● A walk through of skeleton code ADKControl class
  • 17. Communication – Android App side ● Add the skeleton class ADKControl to your project ● Create an instance of ADKControl in MainActivity by passing the reference of same,if necessary pass the reference of ADKControl to other activities or fragments or retrieve through getInstance(null) ADKControl adk=ADKControl.getInstance(this) ● Use sendCommand method for output activity,in appropriate listeners ● Use readData method for input activity, preferably in a different thread for asynchronous read ● Can obtain references for Input,Output references using methods getInputStream,getOutputStream
  • 18. An Example – App to ADK Peripheral Type Peripheral Id Peripheral State/Data Peripheral Data Peripheral Data Byte buffer 0 1 2 3 4 --------------->
  • 19. An Example – ADK to App Input Type DataData DataData DataData ---------------> 0x46 hours mins secs