Download - Google I/O 2011 HowToADK
![Page 1: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/1.jpg)
パナソニックAVCマルチメディアソフト日高正博
@mhidaka
1
![Page 2: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/2.jpg)
2
![Page 3: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/3.jpg)
Android Open Accessoryとは
ADK(Accessory Development Kit)とは
デモンストレーション
まとめ
3
![Page 4: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/4.jpg)
Room 9: TBA
To Be Announcement
4
![Page 5: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/5.jpg)
Androidの普及を広げる施策
周辺機器が繋がる仕組みを提供
5
Android@Home
楽器演奏照明制御
![Page 6: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/6.jpg)
Androidとつながる周辺機器の開発キット
6
![Page 7: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/7.jpg)
7
http://developer.android.com/intl/ja/guide/topics/usb/index.html
![Page 8: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/8.jpg)
3.1 2.3.4
○ ×
○ ○
8
http://developer.android.com/intl/ja/guide/topics/usb/index.html
![Page 9: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/9.jpg)
9
android.hardware.usb.action.
USB_ACCESSORY_ATTACHED
![Page 10: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/10.jpg)
Arudino(アルデュイーノ)互換
電子工作の経験がなくても使いやすいデバイス
モーターをつけて走り回ってもOK
10
![Page 11: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/11.jpg)
11
![Page 12: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/12.jpg)
DemoKit https://dl-
ssl.google.com/android/adk/adk_release_0512.zip
開発環境の注意◦ Accessories must also provide 500mA at 5V for
charging power.◦ For Build Target, select Google APIs (Platform 2.3.3,
API Level 10).
◦ http://developer.android.com/guide/topics/usb/index.html
12
![Page 13: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/13.jpg)
13
![Page 14: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/14.jpg)
http://developer.android.com/guide/topics/usb/adk.html
ADK販売◦ RT:Arduino互換。国内代理店
◦ Microchip:PIC24F 16-bit PIC
◦ Modern Device:Aruduino互換。99ドルと安い(在庫なし)
14
![Page 15: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/15.jpg)
http://arduino.cc/en/Guide/HomePage からArduinoの開発IDEをDownload
CapSense library: タッチセンサを使うためのLibrary
The ADK package: Arduinoの開発IDEへのプラグインとサンプルコード集
15
![Page 16: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/16.jpg)
http://developer.android.com/guide/topics/usb/adk.html (Ubuntu,Macはこっち)
ADK packageの解凍、コピー◦ <arduino_installation_root>/libraries/ へ以下をコピー◦ firmware/arduino_libs/AndroidAccessory◦ firmware/arduino_libs/USB_Host_Shield
CapSenseの解凍、コピー◦ <arduino_installation_root>/libraries/CapSenseディレクトリを作成
◦ 以下をコピー:CapSense.cpp / CapSense.h
16
![Page 17: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/17.jpg)
17
![Page 18: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/18.jpg)
<manifest ...>
<uses-feature android:name="android.hardware.usb.accessory" />
<uses-sdk android:minSdkVersion="<version>" />
...
<application>
<uses-library android:name="com.android.future.usb.accessory" />
<activity ...>
...
<intent-filter>
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
android:resource="@xml/accessory_filter" />
</activity>
</application></manifest>
18
Intentを受けただけでは、どんなADKボードが繋がってもアプリ起動してしまうので、ADKボード側の種類をfilter設定して
特定のソフトが焼かれたADKだけ反応するようにします
![Page 19: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/19.jpg)
細かい手順◦ http://developer.android.com/guide/topics/usb/ac
cessory.html
◦ ADK_packageの ADK_release_0512¥app にAndroid Appのサンプルプログラムがあるよ!
USBでのデータ交換が主な作業です◦ 非同期通信なのでUIスレッドでやらない。◦ ADKの応答を待ってる間に「アプリ応答なし」に。 Runnable / thread をつかって、メッセージを受信したらHandlerでUIスレッドにpost何を言ってるかわからねーと思うが俺もわ(ry
19
![Page 20: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/20.jpg)
USBAccessoryをつないでいるとUSBポートが埋まります ネットワーク経由でadbでDebugする
1. Android端末をPCとUSB接続する 2. コマンドプロンプトより
adb tcpip 5555ネットワークのlistening port を指定
3. コマンドプロンプトよりadb connect <device-ip-address>:5555
4. コマンドプロンプトよりadb usb.
20
![Page 21: Google I/O 2011 HowToADK](https://reader033.vdocuments.pub/reader033/viewer/2022052901/556a3d22d8b42a4a1e8b4782/html5/thumbnails/21.jpg)
Expand: Android !◦ OpenAccessoryにより、周辺機器との関係が変わる
◦ 今後、Hubとして機能、対応が広がる
Make: Android !◦ ADKは開発者へのメッセージ。アプリだけで簡単にMydroidが作れる
21