博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Custom Accessories
阅读量:6913 次
发布时间:2019-06-27

本文共 4483 字,大约阅读时间需要 14 分钟。

来自: http://source.android.com/devices/accessories/custom.html

Custom Accessories

An accessory for Android can be anything: keyboard, thermometer, robot, lighting control, or anything else you can imagine. All Android accessories connect to an Android device in some way, so when building an accessory you must consider the type of connections your accessory will use. This page provides a quick overview of your options for connecting your Android accessory and a list of resources to help you get started.

Connecting over USB


An accessory that connects to an Android device through a USB cable must support the Android Open Accessory (AOA) protocol, which specifies how an accessory can establish communication with an Android device via USB. Due to the low power output of Android devices, AOA requires the accessory to act as a USB host, meaning the connecting accessory must power the bus.

AOA has two versions that support different types of communication:

  • AOAv1. Supports generic accessory communication and adb debugging. Available in Android 3.1 (API Level 12) and higher and supported through an in Android 2.3.4 (API Level 10) and higher.
  • AOAv2. Supports audio streaming and human interface device (HID) capabilities. Available in Android 4.1 (API Level 16).

If you use the general accessory protocol to communicate with your accessory (rather than the adb or audio protocol), you must provide an Android application that can detect the connection of your USB accessory and establish communication.

Next steps

To get started building an Android accessory that uses a USB connection:

  • Select a hardware platform or build a hardware device that can support USB host mode.
  • Review specifications to understand how to implement this protocol on your accessory hardware. Implementing is recommended for all new Android USB accessories.
  • Review the ADK 2012 (<adk-src>/adk2012/board/library/ADK2/), which demonstrates an implementation of an accessory using a USB connection for general data communications and audio streaming.
  • When planning to build an Android application that communicates with your accessory via USB, review the ADK 2012 Android (<adk-src>/adk2012/app/).

Connecting over Bluetooth


An accessory that connects with Android devices over a Bluetooth connection can use connection profiles supported by Android, including the Simple Serial Protocol (SSP) and Advanced Audio Distribution Profile (A2DP) profile. An accessory that uses Bluetooth to connect to Android devices must support Bluetooth communications and at least one of the supported connection profiles.

Users must enable Bluetooth on their Android device and pair with your accessory to use the accessory. You can also provide a secondary Android application that handles specialized communication such as data input or control outputs to interface with your accessory.

Next steps

To get started building an Android accessory that uses a Bluetooth connection:

  • Select a hardware platform or build an hardware device that can support Bluetooth communications and an Android supported connection profile, such as SSP or A2DP.
  • Review the ADK 2012 (<adk-src>/adk2012/board/library/ADK2/), which includes an example implementation of general data communications and audio streaming using a Bluetooth connection.
  • When planning to build an Android application that communicates with your accessory via Bluetooth, review the ADK 2012 Android (<adk-src>/adk2012/app/).

Note: The ADK 2012 source code includes an open source Bluetooth stack built for the Texas Instruments CC2564 chip but is designed to work with any Bluetooth chip that supports a standard Host/Controller Interface (HCI).

Connecting audio over USB


An accessory that connects with Android over USB can use AOAv2 (supported on Android 4.1 (API Level 16) and higher. After an Android device connects to an accessory that supports this protocol, the Android system treats it as a standard audio output device and routes all audio to that accessory. No secondary software application is required on the Android device.

Note: Due to the low power output of Android devices, AOA requires accessories to act as a USB host, meaning the connecting accessory must power the bus.

Next steps

To get started building an audio accessory that uses a USB connection, see

AOAv2 also supports the (HID) protocol through a USB connection, enabling accessories such as audio docks to provide hardware play back controls such as pause, fast-forward or volume buttons.

 

转载地址:http://hencl.baihongyu.com/

你可能感兴趣的文章
docker 的简单使用
查看>>
Java基础/阿里巴巴Java开发手册
查看>>
python学习笔记十一:操作mysql
查看>>
war 配置文件路径
查看>>
linux 打包与解包
查看>>
scrapy-redis使用以及剖析
查看>>
(转载)Javascript 严格模式详解
查看>>
[C++] Const Summary (mind map)
查看>>
day08 文件操作
查看>>
WSL quick overview
查看>>
[解题报告]The Lazy Lumberjacks
查看>>
有用的,可学习的地址
查看>>
Java中对文件的处理01-递归删除
查看>>
checkbox属性checked="checked"通过js已设置,但是不勾选
查看>>
设计一个无限级分类的数据表
查看>>
linux常用命令备忘
查看>>
利用mathematica识别答题卡(3)
查看>>
Container,Injection
查看>>
vue.js中$emit的理解
查看>>
前端实现连连看小游戏(1)
查看>>