Remove adk docs and channels.
Change-Id: I6fa367d806062a126bd1efc67772400bfca66956
diff --git a/docs/html/adk/adk.jd b/docs/html/adk/adk.jd
deleted file mode 100755
index d602497..0000000
--- a/docs/html/adk/adk.jd
+++ /dev/null
@@ -1,672 +0,0 @@
-page.title=Accessory Development Kit 2011 Guide
-page.tags=adk
-@jd:body
-
- <div id="qv-wrapper">
- <div id="qv">
- <h2>In this document</h2>
-
- <ol>
- <li><a href="#components">ADK Components</a></li>
- <li>
-
- <a href="#getting-started">Getting Started with the ADK</a>
-
- <ol>
- <li><a href="#installing">Installing the Arduino software and necessary
- libraries</a></li>
-
- <li><a href="#installing-firmware">Installing the firmware to the ADK board</a></li>
-
- <li><a href="#running-demokit">Running the DemoKit Android application</a></li>
-
- <li><a href="#monitoring">Monitoring the ADK board</a></li>
- </ol>
- </li>
-
- <li>
- <a href="#firmware">How the ADK board implements the Android Accessory Protocol</a>
-
- <ol>
- <li><a href="#wait-adk">Wait for and detect connected devices</a></li>
-
- <li><a href="#determine-adk">Determine the connected device's accessory mode
- support</a></li>
-
- <li><a href="#start-adk">Attempt to start the device in accessory mode</a></li>
-
- <li><a href="#establish-adk">Establish communication with the device</a></li>
- </ol>
- </li>
- </ol>
-
- <h2>Download</h2>
- <ol>
- <li><a href="https://dl-ssl.google.com/android/adk/adk_release_20120606.zip">ADK package</a></li>
- </ol>
-
- <h2>See also</h2>
-
- <ol>
- <li><a href="http://www.youtube.com/watch?v=s7szcpXf2rE">Google I/O Session Video</a></li>
- <li><a href="{@docRoot}guide/topics/connectivity/usb/accessory.html">USB Accessory Dev Guide</a></li>
- </ol>
-
- </div>
- </div>
-
- <p>The Android Open Accessory Development Kit (ADK) is a reference implementation of an Android
- Open Accessory, based on the <a href="http://www.arduino.cc/">Arduino open source electronics
- prototyping platform</a>. The accessory's hardware design files, code that implements the
- accessory's firmware, and the Android application that interacts with the accessory are provided
- as part of the kit to help hardware builders and software developers get started building their
- own accessories. The hardware design files and firmware code are contained in the <a href=
- "https://dl-ssl.google.com/android/adk/adk_release_20120606.zip">ADK package download</a>.</p>
-
- <p>A limited number of kits were produced and distributed at the Google I/O 2011 developer
- conference. However, many hardware builders have reproduced and enhanced the original design and
- these boards are available for purchase. The following list of distributors are currently
- producing Android Open Accessory compatible development boards:</p>
-
- <ul>
- <li>The <a href="http://store.arduino.cc/">Arduino Store</a> provides the <a
-href="http://arduino.cc/en/Main/ArduinoBoardADK">Arduino Mega ADK</a> (for EU nations or non-
- EU nations) that is based on the ATmega2560 and supports the ADK firmware.</li>
-
- <li><a href="https://store.diydrones.com/ProductDetails.asp?ProductCode=BR-PhoneDrone">DIY
- Drones</a> provides an Arduino-compatible board geared towards RC (radio controlled) and UAV
- (unmanned aerial vehicle) enthusiasts.</li>
-
- <li><a href="http://mbed.org/order/">mbed</a> provides a microcontroller and a library
- to develop accessories that support the Android accessory protocol. For more information, see
- <a href="http://mbed.org/cookbook/mbed-with-Android-ADK">mbed with the Android ADK</a>.
- </li>
-
- <li><a href="http://www.microchip.com/android">Microchip</a> provides a PIC based USB
- microcontroller board.</li>
-
- <li><a href="http://shop.moderndevice.com/products/freeduino-usb-host-board">Modern
- Device</a> provides an Arduino-compatible board that supports the ADK firmware.</li>
-
- <li><a href="http://www.rt-net.jp/shop/index.php?main_page=product_info&cPath=3_4&products_id=1">
- RT Corp</a> provides an Arduino-compatible board based on the Android ADK board design.</li>
-
- <li><a href="http://www.seeedstudio.com/depot/seeeduino-adk-main-board-p-846.html">
- Seeed Studio</a> provides an Arduino-compatible board that supports the ADK firmware.</li>
-
- <li><a href="http://www.sparkfun.com/products/10748">
- SparkFun</a>'s IOIO board now has beta support for the ADK firmware.</li>
-
- <li><a href="http://troido.de/de/shoplsmallgbuy-android-stufflsmallg">Troido</a> has produced an
- Arduino-compatible version of the ADK hardware.</li>
-
- </ul>
-
- <p>We expect more hardware distributers to create a variety of kits, so please stay tuned for
- further developments.</p>
-
- <h2 id="components">ADK Components</h2>
-
- <p>The main hardware and software components of the ADK include:</p>
-
- <ul>
- <li>A USB micro-controller board that is based on the Arduino Mega2560 and Circuits@Home USB
- Host Shield designs (now referred to as the ADK board), which you will later implement as an
- Android USB accessory. The ADK board provides input and output pins that you can implement
- through the use of attachments called "shields." Custom firmware, written in C++, is installed
- on the board to define the board's functionality and interaction with the attached shield and
- Android-powered device. The hardware design files for the board are located in
- <code>hardware/</code> directory.</li>
-
- <li>An Android Demo Shield (ADK shield) that affixes atop the ADK board implements the input
- and output points on the board. These implementations include a joystick, LED outputs, and
- temperature and light sensors. You can create or buy your own shields or wire your own features
- to the ADK board to implement custom functionality. The hardware design files for the shield
- are located in <code>hardware/</code>.</li>
-
- <li>A library based on the <a href=
- "http://www.circuitsathome.com/arduino_usb_host_shield_projects">Arduino USB Host Shield</a>
- library provides the logic for the USB micro-controller board to act as a USB Host. This allows
- the board to initiate transactions with USB devices. Describing how to use this entire library
- is beyond the scope of this document. Where needed, this document points out important
- interactions with the library. For more information, see the source code for the Arduino USB
- Host Shield library in the <code>arduino_libs/USB_Host_Shield</code> directory.</li>
-
- <li>An Arduino sketch, <code>arduino_libs/AndroidAccessory/examples/demokit/demokit.pde</code>,
- defines the firmware that
- runs on the ADK board and is written in C++. The sketch calls the Android accessory protocol
- library to interact with the Android-powered device. It also sends data from the ADK board and
- shield to the Android application and receives data from the Android application and outputs it
- to the ADK board and shield.</li>
-
- <li>The Android accessory protocol library, which is located in the
- <code>arduino_libs/AndroidAccessory</code> directory. This library defines how to
- enumerate the bus, find a connected Android-powered device that supports accessory mode, and
- how to setup communication with the device.</li>
-
- <li>Other third party libraries to support the ADK board's functionality:
- <ul>
- <li><a href="http://www.arduino.cc/playground/Main/CapSense">CapSense library</a></li>
-
- <li><a href="http://www.arduino.cc/playground/Learning/I2C">I2C / TWI (Two-Wire Interface)
- library</a></li>
-
- <li><a href="http://www.arduino.cc/playground/ComponentLib/Servo">Servo library</a></li>
-
- <li><a href="http://www.arduino.cc/playground/Code/Spi">Spi library</a></li>
-
- <li><a href="http://www.arduino.cc/en/Reference/Wire">Wire library</a></li>
-
- <li>An Android application, DemoKit, that communicates with the ADK board and shield. The
- source for this project is in the <code>app/</code> directory.</li>
- </ul>
- </li>
-
- </ul>
-
- <h2 id="getting-started">Getting Started with the ADK</h2>
-
- <p>The following sections describe how to install the Arduino software on your computer, use the
- Arduino IDE to install the ADK board's firmware, and install and run the accompanying
- Android application for the ADK board. Before you begin, download the following items to set up
- your development environment:</p>
-
- <ul>
- <li><a href="http://arduino.cc/en/Main/Software">Arduino 1.0 or higher</a>: contains
- libraries and an IDE for coding and installing firmware to the ADK board.</li>
-
- <li><a href="http://www.arduino.cc/playground/Main/CapSense">CapSense library v.04</a>:
- contains the libraries to sense human capacitance. This library is needed for the capacitive
- button that is located on the ADK shield.</li>
-
- <li><a href="https://dl-ssl.google.com/android/adk/adk_release_20120606.zip">ADK software
- package</a>: contains the firmware for the ADK board and hardware design files for the ADK
- board and shield.</li>
- </ul>
-
- <h3 id="installing">Installing the Arduino software and necessary libraries</h3>
-
- <p>To install the Arduino software:</p>
-
- <ol>
- <li>
- <a href="http://arduino.cc/en/Main/Software">Download and install</a> the Arduino 1.0 or
- higher as described on the Arduino website.
-
- <p class="note"><strong>Note:</strong> If you are on a Mac, install the FTDI USB Serial
- Driver that is included in the Arduino package, even though the installation instructions say
- otherwise.</p>
- </li>
-
- <li><a href="https://dl-ssl.google.com/android/adk/adk_release_20120606.zip">Download</a> and
- extract the ADK package to a directory of your choice. You should have an <code>app</code>,
- <code>arduino_libs</code>, and <code>hardware</code> directories.</li>
-
- <li><a href="http://www.arduino.cc/playground/Main/CapSense">Download</a> and extract
- the CapSense package to a directory of your choice.</li>
-
- <li>Install the necessary libraries:
-
- <p>On Windows:</p>
-
- <ol type="a">
- <li>Copy the <code>arduino_libs/AndroidAccessory</code> and
- <code>arduino_libs/USB_Host_Shield</code> directories (the complete directories,
- not just the files within) to the <code><arduino_installation_root>/libraries/</code>
- directory.</li>
-
- <li>Copy the extracted <code>CapSense/</code> library directory and its contents to the
- <code><arduino_installation_root>/libraries/</code> directory.</li>
- </ol>
-
- <p>On Mac:</p>
-
- <ol type="a">
- <li>Create, if it does not already exist, an <code>Arduino</code>
- directory inside your user account's <code>Documents</code> directory, and within
- that, a <code>libraries</code> directory.</li>
-
- <li>Copy the <code>arduino_libs/AndroidAccessory</code> and
- <code>arduino_libs/USB_Host_Shield</code> directories (the
- complete directories, not just the files within) to your
- <code>Documents/Arduino/libraries/</code> directory.</li>
-
- <li>Copy the extracted <code>CapSense/</code> library directory and its contents to the
- <code>Documents/Arduino/libraries/</code> directory.
- </ol>
-
- <p>On Linux (Ubuntu):</p>
-
- <ol type="a">
- <li>Copy the <code>firmware/arduino_libs/AndroidAccessory</code> and
- <code>firmware/arduino_libs/USB_Host_Shield</code> directories (the complete directories,
- not just the files within) to the <code><arduino_installation_root>/libraries/</code>
- directory.</li>
-
- <li>Copy the extracted <code>CapSense/</code> library directory and its contents to the
- <code><arduino_installation_root>/libraries/</code> directory.</li>
-
- <li>Install the avr-libc library by entering <code>sudo apt-get install avr-libc</code>
- from a shell prompt.</li>
- </ol>
- </li>
- </ol>
-
- <p>You should now have three new directories in the Arduino <code>libraries/</code> directory:
- <code>AndroidAccessory</code>, <code>USB_Host_Shield</code>, and <code>CapSense</code>.</p>
-
- <h3 id="installing-firmware">Installing the firmware to the ADK board</h3>
-
- <p>To install the firmware to the ADK board:</p>
-
- <ol>
- <li>Connect the ADK board to your computer using the micro-USB port, which allows two-way
- communication and provides power to the ADK board.</li>
-
- <li>Launch the Arduino IDE.</li>
-
- <li>Click <strong>Tools > Board > Arduino Mega 2560</strong> to specify the ADK board's
- type.</li>
-
- <li>Select the appropriate USB port:
-
- <ul>
- <li>On Windows: click <strong>Tools > Serial Port > COM#</strong> to specify the port
- of communication. The COM port number varies depending on your computer. COM1 is usually
- reserved for serial port connections. You most likely want COM2 or COM3.</li>
-
- <li>On Mac: Click <strong>Tools > Serial Port > dev/tty.usbserial-###</strong> to
- specify the port of communication.</li>
-
- <li>On Linux (Ubuntu): Click <strong>Tools > Serial Port > dev/ttyUSB#</strong> to
- specify the port of communication.</li>
- </ul>
- </li>
-
- <li>To open the Demokit sketch (firmware code), click <strong>File > Examples >
- AndroidAccessory > demokit</strong>.</li>
-
- <li>Click <strong>Sketch > Verify/Compile</strong> to ensure that the sketch has no
- errors.</li>
-
- <li>Select <strong>File > Upload</strong>. When Arduino outputs <strong>Done
- uploading.</strong>, the board is ready to communicate with your Android-powered device.</li>
- </ol>
-
- <h3 id="running-demokit">Running the DemoKit Android application</h3>
-
- <p>The DemoKit Android application runs on your Android-powered device and communicates with the
- ADK board. The ADK board receives commands such as lighting up the board's LEDs or sends data
- from the board such as joystick movement and temperature readings.</p>
-
- <p>After the application is installed, you can interact with the ADK board by moving the color
- LED or servo sliders (make sure
- the servos are connected) or by pressing the relay buttons in the application. On the ADK shield,
- you can press the buttons and move the joystick to see their outputs displayed in the
- application.</p>
-
- <h3 id="monitoring">Monitoring the ADK Board</h3>
-
- <p>The ADK firmware consists of a few files that you should be looking at if you want to build
- your own accessory. The files in the <code>arduino_libs/AndroidAccessory</code>
- directory are the most important files and have the logic to detect and connect to
- Android-powered devices that support accessory mode. Feel free to add debug statements (Arduino
- <code>Serial.println()</code> statements) to the code located in the
- <code><arduino_installation_root>/libraries/AndroidAccessory</code> directory and
- <code>demokit.pde</code> sketch and re-upload the sketch to the ADK board to
- discover more about how the firmware works.</p>
-
- <p>You can view the debug statements in the Arduino Serial Monitor by clicking <strong>Tools >
- Serial Monitor</strong> and setting the baud to 115200. The following sections about how
- accessories communicate with Android-powered devices describe much of what you should be doing in
- your own accessory.</p>
-
- <h2 id="firmware">How the ADK board implements the Android Accessory protocol</h2>
-
- <p>If you have access to the ADK board and shield, the following sections describe the firmware
- code that you installed onto the ADK board. The firmware demonstrates a practical example of how
- to implement the Android Accessory protocol. Even if you do not have the ADK board and shield,
- reading through how the hardware detects and interacts with devices in accessory mode is still
- useful if you want to port the code over for your own accessories.</p>
-
- <p>The important pieces of the firmware are the
- <code>arduino_libs/AndroidAccessory/examples/demokit/demokit/demokit.pde</code> sketch, which is
- the code that receives and sends data to the DemoKit application running on the Android-powered
- device. The code to detect and set up communication with the Android-powered device is contained
- in the <code>arduino_libs/AndroidAccessory/AndroidAccessory.h</code> and
- <code>arduino_libs/AndroidAccessory/AndroidAccessory.cpp</code> files. This code
- includes most of the logic that will help you implement your own accessory's firmware. It might
- be useful to have all three of these files open in a text editor as you read through these next
- sections.</p>
-
- <p>The following sections describe the firmware code in the context of the algorithm described in
- <a href="#accessory-protocol">Implementing the Android Accessory Protocol</a>.</p>
-
- <h3 id="wait-adk">Wait for and detect connected devices</h3>
-
- <p>In the firmware code (<code>demokit.pde</code>), the <code>loop()</code> function runs
- repeatedly and calls <code>AndroidAccessory::isConnected()</code> to check for any connected
- devices. If there is a connected device, it continuously updates the input and output streams
- going to and from the board and application. If nothing is connected, it continuously checks for
- a device to be connected:</p>
- <pre>
-...
-
-AndroidAccessory acc("Google, Inc.",
- "DemoKit",
- "DemoKit Arduino Board",
- "1.0",
- "http://www.android.com",
- "0000000012345678");
-
-...
-void loop()
-{
-...
- if (acc.isConnected()) {
- //communicate with Android application
- }
- else{
- //set the accessory to its default state
- }
-...
-}
-</pre>
-
- <h3 id="determine-adk">Determine the connected device's accessory mode support</h3>
-
- <p>When a device is connected to the ADK board, it can already be in accessory mode, support
- accessory mode and is not in that mode, or does not support accessory mode. The
- <code>AndroidAccessory::isConnected()</code> method checks for these cases and responds
- accordingly when the <code>loop()</code> function calls it. This function first checks to see if
- the device that is connected hasn't already been handled. If not, it gets the connected device's
- device descriptor to figure out if the device is already in accessory mode by calling
- <code>AndroidAccessory::isAccessoryDevice()</code>. This method checks the vendor and product ID
- of the device descriptor. A device in accessory mode has a vendor ID of 0x18D1 and a product ID
- of 0x2D00 or 0x2D01. If the device is in accessory mode, then the ADK board can <a href=
- "#establish">establish communication with the device</a>. If not, the board <a href=
- "#start">attempts to start the device in accessory mode</a>.</p>
- <pre>
-bool AndroidAccessory::isConnected(void)
-{
- USB_DEVICE_DESCRIPTOR *devDesc = (USB_DEVICE_DESCRIPTOR *) descBuff;
- byte err;
-
- max.Task();
- usb.Task();
-
- if (!connected &&
- usb.getUsbTaskState() >= USB_STATE_CONFIGURING &&
- usb.getUsbTaskState() != USB_STATE_RUNNING) {
- Serial.print("\nDevice addressed... ");
- Serial.print("Requesting device descriptor.");
-
- err = usb.getDevDescr(1, 0, 0x12, (char *) devDesc);
- if (err) {
- Serial.print("\nDevice descriptor cannot be retrieved. Program Halted\n");
- while(1);
- }
-
- if (isAccessoryDevice(devDesc)) {
- Serial.print("found android accessory device\n");
-
- connected = configureAndroid();
- } else {
- Serial.print("found possible device. switching to serial mode\n");
- switchDevice(1);
- }
- } else if (usb.getUsbTaskState() == USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE) {
- connected = false;
- }
-
- return connected;
-}
-</pre>
-
- <h3 id="start-adk">Attempt to start the device in accessory mode</h3>
-
- <p>If the device is not already in accessory mode, then the ADK board must determine whether or
- not it supports it by sending control request 51 to check the version of the USB accessory
- protocol that the device supports (see <code>AndroidAccessory::getProtocol()</code>). Protocol
- version 1 is supported by Android 2.3.4 (API Level 10) and higher. Protocol version 2 is
- supported by Android 4.1 (API Level 16) and higher. Versions greater than 2 may supported in
- the future.
- If the appropriate protocol version is returned, the board sends control request 52 (one
- for each string with <code>AndroidAcessory:sendString()</code>) to send it's identifying
- information, and tries to start the device in accessory mode with control request 53. The
- <code>AndroidAccessory::switchDevice()</code> method takes care of this:</p>
- <pre>
-bool AndroidAccessory::switchDevice(byte addr)
-{
- int protocol = getProtocol(addr);
- if (protocol >= 1) {
- Serial.print("device supports protocol 1\n");
- } else {
- Serial.print("could not read device protocol version\n");
- return false;
- }
-
- sendString(addr, ACCESSORY_STRING_MANUFACTURER, manufacturer);
- sendString(addr, ACCESSORY_STRING_MODEL, model);
- sendString(addr, ACCESSORY_STRING_DESCRIPTION, description);
- sendString(addr, ACCESSORY_STRING_VERSION, version);
- sendString(addr, ACCESSORY_STRING_URI, uri);
- sendString(addr, ACCESSORY_STRING_SERIAL, serial);
-
- usb.ctrlReq(addr, 0, USB_SETUP_HOST_TO_DEVICE | USB_SETUP_TYPE_VENDOR | USB_SETUP_RECIPIENT_DEVICE,
- ACCESSORY_START, 0, 0, 0, 0, NULL);
- return true;
-}
-</pre>If this method returns false, the board waits until a new device is connected. If it is
-successful, the device displays itself on the USB bus as being in accessory mode when the ADK board
-re-enumerates the bus. When the device is in accessory mode, the accessory then <a href=
-"#establish-adk">establishes communication with the device</a>.
-
- <h3 id="establish-adk">Establish communication with the device</h3>
-
- <p>If a device is detected as being in accessory mode, the accessory must find the proper bulk
- endpoints and set up communication with the device. When the ADK board detects an Android-powered
- device in accessory mode, it calls the <code>AndroidAccessory::configureAndroid()</code>
- function:</p>
- <pre>
-...
-if (isAccessoryDevice(devDesc)) {
- Serial.print("found android acessory device\n");
-
- connected = configureAndroid();
- }
-...
-</pre>
-
- <p>which in turn calls the <code>findEndpoints()</code> function:</p>
- <pre>
-...
-bool AndroidAccessory::configureAndroid(void)
-{
- byte err;
- EP_RECORD inEp, outEp;
-
- if (!findEndpoints(1, &inEp, &outEp))
- return false;
-...
-</pre>
-
- <p>The <code>AndroidAccessory::findEndpoints()</code> function queries the Android-powered
- device's configuration descriptor and finds the bulk data endpoints in which to communicate with
- the USB device. To do this, it first gets the device's first four bytes of the configuration
- descriptor (only need descBuff[2] and descBuff[3]), which contains the information about the
- total length of data returned by getting the descriptor. This data is used to determine whether
- or not the descriptor can fit in the descriptor buffer. This descriptor also contains information
- about all the interfaces and endpoint descriptors. If the descriptor is of appropriate size, the
- method reads the entire configuration descriptor and fills the entire descriptor buffer with this
- device's configuration descriptor. If for some reason the descriptor is no longer attainable, an
- error is returned.</p>
- <pre>
-...
-
-bool AndroidAccessory::findEndpoints(byte addr, EP_RECORD *inEp, EP_RECORD *outEp)
-{
- int len;
- byte err;
- uint8_t *p;
-
- err = usb.getConfDescr(addr, 0, 4, 0, (char *)descBuff);
- if (err) {
- Serial.print("Can't get config descriptor length\n");
- return false;
- }
-
-
- len = descBuff[2] | ((int)descBuff[3] << 8);
- if (len > sizeof(descBuff)) {
- Serial.print("config descriptor too large\n");
- /* might want to truncate here */
- return false;
- }
-
- err = usb.getConfDescr(addr, 0, len, 0, (char *)descBuff);
- if (err) {
- Serial.print("Can't get config descriptor\n");
- return false;
- }
-
-...
-</pre>
-
- <p>Once the descriptor is in memory, a pointer is assigned to the first position of the buffer
- and is used to index the buffer for reading. There are two endpoint pointers (input and output)
- that are passed into <code>AndroidAccessory::findEndpoints()</code> and their addresses are set
- to 0, because the code hasn't found any suitable bulk endpoints yet. A loop reads the buffer,
- parsing each configuration, interface, or endpoint descriptor. For each descriptor, Position 0
- always contains the size of the descriptor in bytes and position 1 always contains the descriptor
- type. Using these two values, the loop skips any configuration and interface descriptors and
- increments the buffer with the <code>descLen</code> variable to get to the next descriptor.</p>
-
- <p class="note"><strong>Note:</strong> An Android-powered device in accessory mode can
- potentially have two interfaces, one for the default communication to the device and the other
- for ADB communication. The default communication interface is always indexed first, so finding
- the first input and output bulk endpoints will return the default communication endpoints, which
- is what the <code>demokit.pde</code> sketch does. If you are writing your own firmware, the logic
- to find the appropriate endpoints for your accessory might be different.</p>
-
- <p>When it finds the first input and output endpoint descriptors, it sets the endpoint pointers
- to those addresses. If the findEndpoints() function finds both an input and output endpoint, it
- returns true. It ignores any other endpoints that it finds (the endpoints for the ADB interface,
- if present).</p>
- <pre>
-...
- p = descBuff;
- inEp->epAddr = 0;
- outEp->epAddr = 0;
- while (p < (descBuff + len)){
- uint8_t descLen = p[0];
- uint8_t descType = p[1];
- USB_ENDPOINT_DESCRIPTOR *epDesc;
- EP_RECORD *ep;
-
- switch (descType) {
- case USB_DESCRIPTOR_CONFIGURATION:
- Serial.print("config desc\n");
- break;
-
- case USB_DESCRIPTOR_INTERFACE:
- Serial.print("interface desc\n");
- break;
-
- case USB_DESCRIPTOR_ENDPOINT:
- epDesc = (USB_ENDPOINT_DESCRIPTOR *)p;
- if (!inEp->epAddr && (epDesc->bEndpointAddress & 0x80))
- ep = inEp;
- else if (!outEp->epAddr)
- ep = outEp;
- else
- ep = NULL;
-
- if (ep) {
- ep->epAddr = epDesc->bEndpointAddress & 0x7f;
- ep->Attr = epDesc->bmAttributes;
- ep->MaxPktSize = epDesc->wMaxPacketSize;
- ep->sndToggle = bmSNDTOG0;
- ep->rcvToggle = bmRCVTOG0;
- }
- break;
-
- default:
- Serial.print("unkown desc type ");
- Serial.println( descType, HEX);
- break;
- }
-
- p += descLen;
- }
-
- if (!(inEp->epAddr && outEp->epAddr))
- Serial.println("can't find accessory endpoints");
-
- return inEp->epAddr && outEp->epAddr;
-}
-
-...
-</pre>
-
- <p>Back in the <code>configureAndroid()</code> function, if there were endpoints found, they are
- appropriately set up for communication. The device's configuration is set to 1 and the state of
- the device is set to "running", which signifies that the device is properly set up to communicate
- with your USB accessory. Setting this status prevents the device from being re-detected and
- re-configured in the <code>AndroidAccessory::isConnected()</code> function.</p>
- <pre>
-bool AndroidAccessory::configureAndroid(void)
-{
- byte err;
- EP_RECORD inEp, outEp;
-
- if (!findEndpoints(1, &inEp, &outEp))
- return false;
-
- memset(&epRecord, 0x0, sizeof(epRecord));
-
- epRecord[inEp.epAddr] = inEp;
- if (outEp.epAddr != inEp.epAddr)
- epRecord[outEp.epAddr] = outEp;
-
- in = inEp.epAddr;
- out = outEp.epAddr;
-
- Serial.print("inEp: ");
- Serial.println(inEp.epAddr, HEX);
- Serial.print("outEp: ");
- Serial.println(outEp.epAddr, HEX);
-
- epRecord[0] = *(usb.getDevTableEntry(0,0));
- usb.setDevTableEntry(1, epRecord);
-
- err = usb.setConf( 1, 0, 1 );
- if (err) {
- Serial.print("Can't set config to 1\n");
- return false;
- }
-
- usb.setUsbTaskState( USB_STATE_RUNNING );
-
- return true;
-}
-</pre>
-
- <p>Lastly, methods to read and write to the appropriate endpoints are needed. The
- <code>demokit.pde</code> sketch calls these methods depending on the data that is read from the
- Android-powered device or sent by the ADK board. For instance, moving the joystick on the ADK
- shield writes data that is read by the DemoKit application running on the Android-powered device.
- Moving sliders on the DemoKit application is read by the <code>demokit.pde</code> sketch and
- changes the state of the accessory, such as lighting up or changing the color of the LED
- lights.</p>
- <pre>
-int AndroidAccessory::read(void *buff, int len, unsigned int nakLimit) {
- return usb.newInTransfer(1, in, len, (char *)buff, nakLimit); }
-
-int AndroidAccessory::write(void *buff, int len) {
- usb.outTransfer(1, out, len, (char *)buff);
- return len; }
-</pre>
-
- <p>See the <code>demokit.pde</code> sketch for information about how the ADK board
- reads and writes data.</p>
diff --git a/docs/html/adk/adk2.jd b/docs/html/adk/adk2.jd
deleted file mode 100644
index d69125a..0000000
--- a/docs/html/adk/adk2.jd
+++ /dev/null
@@ -1,652 +0,0 @@
-page.title=Accessory Development Kit 2012 Guide
-page.tags=adk
-@jd:body
-
-<div id="qv-wrapper">
- <div id="qv">
- <h2>In this document</h2>
- <ol>
- <li><a href="#components">Components</a></li>
- <li><a href="#clock">Using the Alarm Clock</a></li>
- <li><a href="#play-audio">Playing Audio</a></li>
- <li><a href="#dev">Developing Accessories with ADK 2012</a>
- <ol>
- <li><a href="#src-download">Downloading the ADK Source</a></li>
- <li><a href="#dev-setup">Setting Up the Development Environment</a></li>
- <li><a href="#alt-build">Using the ADK Alternative Build System</a></li>
- </ol>
- </li>
- <li><a href="#adk-conn">How the ADK Connects with Android Devices</a>
- <ol>
- <li><a href="#adk-conn-bt">ADK Connection over Bluetooth</a></li>
- <li><a href="#adk-conn-usb">ADK Connection over USB</a></li>
- </ol>
- </li>
- <li><a href="#audio-dock">USB Audio Dock Implementation</a></li>
- </ol>
-
- <h2>See also</h2>
- <ol>
- <li><a href="https://developers.google.com/events/io/sessions/gooio2012/128/">
- Google I/O Session Video</a></li>
- <li><a href="http://source.android.com/tech/accessories/aoap/aoa.html">
- Android Open Accessory Protocol</a></li>
- <li><a href="http://source.android.com/tech/accessories/aoap/aoa2.html">
- Android Open Accessory Protocol 2.0</a></li>
- <li><a href="{@docRoot}guide/topics/connectivity/usb/accessory.html">
- USB Accessory Dev Guide</a></li>
- </ol>
- </div>
-</div>
-
-<p>The Android Accessory Development Kit (ADK) for 2012 is the latest reference implementation of an
-<a href="http://source.android.com/tech/accessories/index.html">Android Open Accessory</a> device,
-designed to help Android hardware accessory builders and software developers create accessories
-for Android. The ADK 2012 is based on the <a href="http://arduino.cc">Arduino</a> open source
-electronics prototyping platform, with some hardware and software extensions that allow it to
-communicate with Android devices.</p>
-
-<p>A limited number of these kits were produced and distributed at the Google I/O 2012 developer
-conference. If you did not receive one of these kits, fear not! The specifications and design files
-for the hardware were also released for use by manufacturers and hobbyists. You should expect to see
-kits with similar features available for purchase, or you can build one yourself!</p>
-
-<p>One of the important new features demonstrated by this ADK is the ability to play audio over a
-USB connection. Be sure to check out the <a href="#audio-dock">reference implementation</a> of a USB
-audio dock in this ADK if you are interested in making audio-related USB accessories for
-Android.</p>
-
-<h2 id="components">Components</h2>
-
-<p>The ADK 2012 is based on the Arduino open source electronics prototyping platform and is an open
-hardware design. The hardware design files and firmware source code are included with the ADK
-software download. The ADK contains two main physical hardware components:</p>
-
-<ol>
- <li>Main processing board containing the microprocessor, USB connections, power connector and
-input/output pins. This board can be removed and used separately from the rest of the hardware.</li>
- <li>Shield containing sensors, LEDs, input controls, audio amplifier and speaker output, contained
-in a custom, polygon box enclosure.</li>
-</ol>
-
-<p>The main hardware features of the ADK are as follows:</p>
-
-<ul>
- <li>An ARM 32-bit Cortex M3 micro-processor</li>
- <li>Separate USB connections for an Android device and computer connection for programming and
-debugging</li>
- <li>Sensors for light, color, proximity, temperature, humidity, barometric pressure, and
-acceleration</li>
- <li>Micro SD Card slot</li>
- <li>Bluetooth support</li>
-</ul>
-
-<p>The ADK comes preloaded with an alarm clock firmware program that you can use immediately. A
-companion Android application, <a
-href="https://play.google.com/store/apps/details?id=com.google.android.apps.adk2">ADK 2012</a>, is
-available on Google Play. The source code for both the Android application and the ADK firmware (an
-Arduino sketch) can be downloaded from this page.</p>
-
-<p>The ADK 2012 also comes with additional parts to help you develop accessories with it,
-including:</p>
-
-<ul>
- <li>AC power adapter</li>
- <li>USB A to Micro USB B connector cable</li>
- <li>Micro USB B to Micro USB AB connector (small, rectangular plug)</li>
- <li>Micro SD Card, preinstalled in the ADK SD Card socket</li>
-</ul>
-
-<h2 id="clock">Using the Alarm Clock</h2>
-
-<p>An alarm clock program comes preloaded on the ADK. This firmware program allows you to use the
-ADK as an alarm clock.</p>
-
-<p>To use the ADK as an alarm clock:</p>
-
-<ol>
- <li>Open up the ADK by gently squeezing the two widest faces of the enclosure.</li>
- <li>Attach the provided AC power adapter (round connector) to the main ADK board, or attach a USB
-cable to the port marked <strong>Computer</strong> and a USB port on your computer.</li>
- <li>Place and hold your fingertip over the clock symbol on the control face.
- <p class="note"><strong>Note:</strong> You may need to hold your finger in place for 1-2
-seconds.</p>
- </li>
- <li>Use the plus (+) and minus (-) symbols inside the clock digits to set the correct time.</li>
- <li>Place your fingertip over the alarm clock symbol to activate alarm setting.</li>
- <li>Use the plus (+) and minus (-) symbols inside the clock digits to set the alarm time.</li>
- <li>Use the plus (+) and minus (-) symbols inside the last two clock digits to turn the alarm on
-({@code on}) or off ({@code oF}).</li>
- <li>To set the alarm tone, place and hold your fingertip over the alarm clock symbol, then tap the
-slider control on top of the enclosure.</li>
-</ol>
-
-<p>To use the <strong>ADK 2012</strong> companion application for the alarm clock:</p>
-
-<ol>
- <li>Load the companion application on your Android device running Android 3.1 (API Level 12) or
-higher:
- <ul>
- <li>Using an NFC-enabled Android device, unlock and hold the device against the left side of
-the ADK enclosure. Follow the prompts to install the app.
- <br>- or -</li>
- <li>Start Google Play on your device, search for the <strong>ADK 2012</strong> application and
-install it. If you cannot find the app, your device is not compatible. Try installing on another
-device.</li>
- </ul>
- </li>
- <li>Connect your Android device to the ADK using one of the following methods:
- <ul>
- <li id="conn-bt">To connect using Bluetooth:
- <ol>
- <li>Plug the AC power adapter into the ADK.</li>
- <li>On your Android device, turn Bluetooth On (<strong>Settings >
-Bluetooth</strong>).</li>
- <li>In the <strong>Settings</strong> page, press the <strong>Bluetooth</strong> option to
-view paired devices.</li>
- <li>Select <strong>Search for Devices</strong> to locate the ADK 2012 accessory and follow
-the on screen instructions to connect.</li>
- <li>After pairing is complete, start the <strong>ADK 2012</strong> app on your Android
-device.</li>
- <li>On the start screen, select the <strong>Use Bluetooth</strong> button.</li>
- <li>In the list of paired devices, select the <strong>ADK 2012</strong> device.</li>
- <li>The <strong>ADK 2012</strong> app should switch to the menu screen and you can start
-interacting with the ADK accessory.</li>
- </ol>
- </li>
-
- <li id="conn-usb">To connect using USB:
- <ol>
- <li>Plug the AC power adapter into the ADK.</li>
- <li>Connect the Micro USB AB connector (small, rectangular plug) to the port labeled
-<strong>Phone</strong> on the ADK board.</li>
- <li>Unlock your Android device and connect the Micro USB B connector to your device.
- <p class="note"><strong>Note:</strong> Your device must support Android USB accessory
-mode. Devices that support this mode include Google Nexus devices.</p>
- </li>
- <li>On the Android device, you should see a prompt to connect to the <strong>ADK DemoKit
-2012</strong>, select <strong>OK</strong>.</li>
- <li>The <strong>ADK 2012</strong> app should start automatically and you can start
-interacting with the ADK.</li>
- </ol>
- </li>
- </ul>
- </li>
-</ol>
-
-<p class="note"><strong>Note:</strong> When using the ADK with a USB connection to an Android
-device, make sure the AC power adapter is plugged in. A USB connection to a computer does not
-provide sufficient voltage to power both the ADK and a USB connection to a device.</p>
-
-
-<h2 id="play-audio">Playing Audio</h2>
-
-<p>The ADK 2012 comes with audio output capabilities, including an amplifier and speaker. You can
-use it to play audio from your Android device using either a Bluetooth or USB connection.</p>
-
-<p>To play audio over Bluetooth:</p>
-
-<ol>
- <li>Follow the instructions in the <a href="#conn-bt">previous section</a> to connect your Android
-device to the ADK over Bluetooth.</li>
- <li>On your Android device, navigate to the <strong>Settings > Bluetooth</strong> page to view the
-list of paired devices, and make sure the ADK is connected.</li>
- <li>Select the settings icon next to the <strong>ADK 2012</strong> item.</li>
- <li>Make sure the <strong>Media Audio</strong> option is enabled.</li>
- <li>Navigate to an application that plays music or other audio.</li>
- <li>Play a song or sound and listen to it on the ADK speaker!</li>
-</ol>
-
-<p>To play audio over USB, you must use a device running Android 4.1 (API Level 16) or higher:</p>
-
-<ol>
- <li>Plug the AC power adapter into the ADK.</li>
- <li>Connect the Micro USB AB connector (small, rectangular plug) to the Phone port on the ADK
-board.</li>
- <li>Unlock your Android device and connect the Micro USB B connector to your device.
- <p class="note"><strong>Note:</strong> Your device must support Android USB accessory
-mode. Devices that support this mode include Google Nexus devices.</p>
- </li>
- <li>On the Android device, you should see a prompt to connect to the <strong>ADK DemoKit
-2012</strong>, select <strong>Cancel</strong> and allow the ADK to connect as a media device
-only.</li>
- <li>Navigate to an application that plays music or other audio.</li>
- <li>Play a song or sound and listen to it on the ADK speaker!</li>
-</ol>
-
-<p class="note"><strong>Note:</strong> When using the ADK with a USB connection to an Android
-device, make sure the AC power adapter is plugged in. A USB connection to a computer does not
-provide sufficient voltage to power both the ADK and a USB connection to a device.</p>
-
-
-<h2 id="dev">Developing Accessories with ADK 2012</h2>
-
-<p>The ADK 2012 is a hardware platform and a set of software libraries for prototyping Android
-accessories. This section discusses how to set up a development environment for programming the ADK
-to make it do what you want and to test software for building your own Android accessories.</p>
-
-<h3 id="src-download">Downloading the ADK Source</h3>
-
-<p>The support software and hardware specifications for the ADK 2012 are available from the Android
-source repository. Follow the instructions below to obtain the source material for the ADK.</p>
-
-<p>To download the ADK 2012 software, source code and hardware design specifications.</p>
-
-<ol>
- <li>Download and install <a href="http://git-scm.com/download">Git</a> for your development
-system.</li>
- <li>Download and setup the {@code repo} tool, as described on the <a
-href="http://source.android.com/source/downloading.html#installing-repo">Android open source
-project</a> site.
- <p class="note"><strong>Note:</strong> Developers using Windows must use a Linux compatibility
-package, such as <a href="http://www.cygwin.com/">cygwin</a>, to install and run {@code repo}.
-Within your compatibility environment, you must install {@code curl}, {@code git} and {@code
-python} to be able to download and use the {@code repo} tool.</p>
- </li>
- <li>In a terminal window, create a new directory for the downloaded source files, initialize and
-synchronize a local repository:
-<pre>
-$> mkdir android-accessories
-$> cd android-accessories
-$> repo init -u https://android.googlesource.com/accessories/manifest
-$> repo sync
-</pre>
- </li>
-</ol>
-
-<p>After successfully completing this process, you should have the source code and tools for
-working with the ADK 2012:</p>
-
-<ul>
- <li>{@code adk2012/board} - Source code and hardware design files for the ADK 2012</li>
- <li>{@code adk2012/app} - Source code for the ADK 2012 Android companion application</li>
- <li>{@code external/ide} - Source code for the ADK 2012 Integrated Development Environment
-(IDE)</li>
- <li>{@code external/toolchain} - The toolchain used by the ADK 2012 IDE</li>
-</ul>
-
-
-<h3 id="dev-setup">Setting Up the Development Environment</h3>
-
-<p>The ADK 2012 comes with an integrated development environment (IDE) that you use to develop
-software and program the ADK 2012 accessory. The following instructions explain how to setup and run
-the ADK 2012 IDE.</p>
-
-<p>To set up and run the ADK 2012 IDE:</p>
-
-<ol>
- <li>Download and install the Java Development Kit 6 or higher from <a
- href="http://java.oracle.com">java.oracle.com</a>.</li>
- <li>Download the ADK 2012 IDE for your development platform:
- <ul>
- <li><a href="https://dl-ssl.google.com/android/adk/adk2012_ide-win32-20120629.zip">
- Windows</a></li>
- <li><a href="https://dl-ssl.google.com/android/adk/adk2012_ide-macosx-20120626.zip">
- Mac</a></li>
- <li>Linux
- <a href="https://dl-ssl.google.com/android/adk/adk2012_ide-linux32-20120626.tgz">32bit</a>,
- <a href="https://dl-ssl.google.com/android/adk/adk2012_ide-linux64-20120626.tgz">64bit</a>
- </li>
- </ul>
- </li>
- <li>Unpack the downloaded archive.</li>
- <li>Run the application by navigating to the unpacked {@code ADK2012_IDE/} folder and execute
- the {@code arduino} file.</li>
-</ol>
-
-<p>After you have successfully installed and run the ADK 2012 IDE, you must configure it to use
-the ADK 2012 library.</p>
-
-<p>To configure the ADK 2012 IDE for use with the ADK libraries:</p>
-
-<ol>
- <li>Start the ADK 2012 IDE and choose <strong>File > Preferences</strong>.</li>
- <li>In the <strong>Preferences</strong> dialog, make a note of the <strong>Sketchbook
-location</strong> directory.</li>
- <li>Copy the {@code <adk-source-download>/adk2012/board/library/ADK2} directory and its
-contents into your {@code sketchbook/libraries/} directory, so that you create a {@code
-sketchbook/libraries/ADK2} directory.</li>
- <li>Stop and restart the <strong>ADK 2012 IDE</strong>.</li>
- <li>In the IDE, choose <strong>File > Examples > ADK2</strong> and then choose one of the example
-sketches:
- <ul>
- <li><strong>clock</strong> - The sketch that is preloaded onto the ADK 2012.</li>
- <li><strong>BluetoothScan</strong> - An example sketch demonstrating code that connects an
-accessory to an Android device over Bluetooth.</li>
- <li><strong>usbaccessory</strong> - An example sketch demonstrating code that connects an
-accessory to an Android device through a USB cable.</li>
- </ul>
- </li>
- <li>Connect a Micro USB cable from the <strong>Computer</strong> port on the ADK board to your
-development computer.</li>
- <li>In the <strong>ADK 2012 IDE</strong>, establish a serial port connection with the ADK by
-selecting <strong>Tools > Serial Port</strong> and selecting the serial port for the ADK.</li>
- <li>In the <strong>ADK 2012 IDE</strong>, choose the ADK by selecting<strong>Tools > Board >
-Google ADK2</strong>.</li>
- <li>Modify an example sketch or create your own.</li>
- <li>Upload the sketch to the ADK by choosing <strong>File > Upload</strong>. When the <strong>ADK
-2012 IDE</strong> reports <strong>Done uploading</strong>, the sketch is uploaded and the ADK is
-ready to communicate with your Android device.</li>
-</ol>
-
-<h3 id="alt-build">Using the ADK Alternative Build System</h3>
-
-<p>An alternative, make file-based build and upload system is also available for the ADK 2012. This
-system is command line based and intended for production environments where using an IDE environment
-to load software onto accessory hardware may be inconvenient or undesirable.</p>
-
-<p>To setup the environment:</p>
-<ol>
- <li><a href="#src-download">Download</a> the ADK 2012 source code files.</li>
- <li>In a terminal window, navigate to {@code
-<adk-source-download>/adk2012/board/MakefileBasedBuild}.</li>
- <li>Execute the following command and follow the instructions:
- <pre>$> ./setup</pre>
- </li>
-</ol>
-
-<p>To build a program for your accessory:</p>
-<ol>
- <li>Place your accessory code in the {@code MakefileBasedBuild/app} directory, including all
-required library files. See the {@code app/main.c} file for an example of the program format.</li>
- <li>Execute the following command and follow the instructions:
- <pre>$> ./build</pre>
- </li>
-</ol>
-
-<p>To load the program on your accessory hardware:</p>
-<ol>
- <li>Run the build process above and make sure your program compiled successfully.</li>
- <li>Attach the accessory via USB cable to your development computer.</li>
- <li>Check which port the accessory is attached to and modify the {@code UART} variable in the
-{@code flash} script to the correct port address. On linux machines, the port address is typically
-{@code /dev/ttyUSB0}.</li>
- <li>Execute the following command to load the program on the accessory:
- <pre>$> ./flash</pre></li>
-</ol>
-
-<h2 id="adk-conn">How the ADK Connects with Android Devices</h2>
-
-<p>The essential feature of any Android accessory is its ability to connect and communicate with an
-Android device. Creating a fast and reliable connection between your accessory and Android devices
-is the first order of business when building software for an accessory. This section describes the
-connection and communication essentials used in the ADK 2012 so that you can apply them to
-developing your own Android accessories.</p>
-
-<h3 id="adk-conn-bt">ADK Connection over Bluetooth</h3>
-
-<p>The ADK 2012 app and hardware accessory use a Bluetooth Serial Port Profile (SPP) connection to
-communicate. This connection allows two way communication between the ADK accessory and Android
-devices.</p>
-
-<p class="note"><strong>Note:</strong> The implementation of the ADK hardware allows the use of
-other profiles and multiple connections. However, the basic communication between the ADK 2012
-accessory and the Android application uses SPP.</p>
-
-<h4 id="acc-bt-code">Accessory Bluetooth Code</h4>
-
-<p>In order to enable Bluetooth communications, the {@code clock.ino} sketch for the ADK 2012
-accessory calls a {@code btStart()} method during the {@code setup()} method to enable radio
-frequency communications and start listening for Bluetooth connections:</p>
-
-<pre>
-ADK L;
-void setup() {
- L.adkInit();
- L.btStart();
-}
-...
-void btStart(){
- uint8_t i, dlci;
- int f;
-
- L.btEnable(adkBtConnectionRequest, adkBtLinkKeyRequest, adkBtLinkKeyCreated,
- adkBtPinRequest, NULL);
-
- dlci = L.btRfcommReserveDlci(RFCOMM_DLCI_NEED_EVEN);
-
- if(!dlci) dbgPrintf("BTADK: failed to allocate DLCI\n");
- else{
-
- //change descriptor to be valid...
- for(i = 0, f = -1; i < sizeof(sdpDescrADK); i++){
-
- if(sdpDescrADK[i] == MAGIX){
- if(f == -1) f = i;
- else break;
- }
- }
-
- if(i != sizeof(sdpDescrADK) || f == -1){
-
- dbgPrintf("BTADK: failed to find a single marker in descriptor\n");
- L.btRfcommReleaseDlci(dlci);
- return;
- }
-
- sdpDescrADK[f] = dlci >> 1;
-
- dbgPrintf("BTADK has DLCI %u\n", dlci);
-
- L.btRfcommRegisterPort(dlci, btAdkPortOpen, btAdkPortClose, btAdkPortRx);
- L.btSdpServiceDescriptorAdd(sdpDescrADK, sizeof(sdpDescrADK));
- }
-}
-</pre>
-
-<p>Notice that the {@code sdpDescrADK} object contains a Universally Unique Identifier (UUID) in the
-variable {@code BT_ADK_UUID}. This identifier <em>must match</em> the device UUID provided in the
-{@link android.bluetooth.BluetoothSocket} connection request in the Android application code.</p>
-
-<p>Once Bluetooth is enabled with the code shown above, the accessory listens for connection
-requests. The ADK library handles listening and connection details, so the accessory calls
-{@code ADK::adkEventProcess()} once during each loop execution:</p>
-
-<pre>
-void loop(void)
-{
- ...
- L.adkEventProcess(); //let the adk framework do its thing
- ...
-}
-</pre>
-
-<p>If a Bluetooth connection has been established, any commands are routed to the
-{@code btAdkPortRx()} callback method (which was registered with the ADK library as part of the
-{@code btStart()} method) and processed accordingly. The ADK accessory sends messages back through
-the Bluetooth connection using the {@code ADK::btRfcommPortTx()} method.
-For more details, review the implementations of these methods in the {@code clock.ino} sketch.</p>
-
-<h4 id="app-bt-code">Android App Bluetooth Code</h4>
-
-<p>In the ADK 2012 Android app, the code for handling Bluetooth connections is encapsulated in in a
-{@code BTConnection} class. In this class, the application requests access to the Bluetooth adapter
-and negotiates a connection with the ADK 2012 accessory. Here is a summary of the relevant code:</p>
-
-<pre>
-mAdapter = BluetoothAdapter.getDefaultAdapter();
-BluetoothDevice device = mAdapter.getRemoteDevice(address);
-mSocket = device.createInsecureRfcommSocketToServiceRecord(ADK_UUID);
-mSocket.connect();
-</pre>
-
-<p>Note the {@code ADK_UUID} parameter in the second line. This identifier must match the identifier
-output by the accessory (the {@code BT_ADK_UUID} variable mentioned earlier), otherwise the protocol
-negotiation fails and the {@link android.bluetooth.BluetoothSocket} is not created. Once a
-connection is established, you obtain {@link java.io.InputStream} and {@link java.io.OutputStream}
-objects from the socket to communicate with the accessory:</p>
-
-<pre>
-mInStream = mSocket.getInputStream();
-mOutStream = mSocket.getOutputStream();
-</pre>
-
-<p>Review the {@code BTConnection.java} file provided in the ADK 2012 software download for more
-implementation details.</p>
-
-<h3 id="adk-conn-usb">ADK Connection over USB</h3>
-
-<p>The ADK 2012 app and hardware accessory can also use a USB connection to communicate, similar to
-the original ADK.</p>
-
-<h4 id="acc-usb-code">Accessory USB Code</h4>
-
-<p>The ADK library takes care of most of the implementation details for a USB connection, the
-accessory code must make a few calls to initialize USB connectivity, including setting the accessory
-identification strings:</p>
-
-<pre>
-ADK L;
-void setup() {
- L.adkInit();
- L.usbSetAccessoryStringVendor(...);
- L.usbSetAccessoryStringName(...);
- L.usbSetAccessoryStringLongname(...);
- L.usbSetAccessoryStringVersion(...);
- L.usbSetAccessoryStringUrl(...);
- L.usbSetAccessoryStringSerial(...);
-
- L.usbStart();
-}
-</pre>
-
-<p class="note"><strong>Note:</strong> The identification strings must match the USB accessory
-filter settings specified in the connecting Android application,otherwise the application cannot
-connect with the accessory.</p>
-
-<p>Once USB is enabled with code shown above, the accessory listens for connection requests. The ADK
-library handles listening and connection details, so the accessory calls {@code
-ADK::adkEventProcess()} once during each loop execution:</p>
-
-<pre>
-void loop(void)
-{
- ...
- L.adkEventProcess(); //let the adk framework do its thing
- ...
-}
-</pre>
-
-<p>The accessory must then check for a live USB connection to process commands and send
-messages. Here is a summary of the relevant code:</p>
-
-<pre>
-void loop() {
- if (L.accessoryConnected()) {
- int recvLen = L.accessoryReceive(msg, sizeof(msg));
- if (recvLen > 0) {
- ... // process message
- }
-
- L.accessorySend(outmsg, outmsgLen);
- }
- L.adkEventProcess();
-}
-</pre>
-
-<p>For more details, review the implementations of these methods in the {@code clock.ino}
-sketch.</p>
-
-<h4 id="app-usb-code">Android App USB Code</h4>
-
-<p>In the ADK 2012 Android app, the code for handling USB connections is encapsulated in a
-{@code UsbConnection} class. This class sets up a {@link android.content.BroadcastReceiver} to
-listen for USB events and then attempts to connect when a matching connection event is received.
-Here is a summary of the relevant code:</p>
-
-<pre>
-import com.android.future.usb.UsbAccessory;
-import com.android.future.usb.UsbManager;
-
-mUSBManager = UsbManager.getInstance(this);
-UsbAccessory acc = mUSBManager.getAccessoryList()[0];
-
-if (!mUSBManager.hasPermission(acc)) return;
-</pre>
-
-<p>The ADK 2012 app uses the support library to implement the USB accessory connections, in order to
-support devices running Android 2.3.4 (API Level 10). If you only need to support Android
-3.1 (API Level 12) and higher devices, you can replace the first 4 lines the following code:</p>
-
-<pre>
-import android.hardware.usb.UsbAccessory
-import android.hardware.usb.UsbManager
-
-mUSBManager = (UsbManager) getSystemService(Context.USB_SERVICE);
-UsbAccessory acc = (UsbAccessory)
- intent.getParcelableExtra(UsbManager.EXTRA_ACCESSORY);
-</pre>
-
-<p>Note that the app only receives events when the USB accessory identification information matches
-the information in the {@code res/xml/usb_accessory_filter.xml} file, referenced by the
-application’s manifest statement:</p>
-
-<pre>
-<meta-data
- android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
- android:resource="@xml/usb_accessory_filter" />
-</pre>
-
-<p>Connections from other USB devices are not received by the ADK 2012 accessory.</p>
-
-<p>Once the connection is established, the app can communicate with the accessory through file input
-and output streams, as shown in the following example code:</p>
-
-<pre>
-ParcelFileDescriptor mFD = mUSBManager.openAccessory(acc);
-if (mFD != null) {
- FileDescripter fd = mFD.getFileDescriptor();
- mIS = new FileInputStream(fd); // use this to receive messages
- mOS = new FileOutputStream(fd); // use this to send commands
-}
-</pre>
-
-<p>Review the {@code UsbConnection.java} file provided in the ADK 2012 source code for more
-implementation details.</p>
-
-<h2 id="audio-dock">USB Audio Dock Implementation</h2>
-
-<p>One of the important new features introduced with the ADK 2012 is the ability to play audio over
-a USB connection. This innovation was introduced as an update to Android Open Accessory (AOA)
-<a href="http://source.android.com/tech/accessories/aoap/aoa2.html">protocol 2.0</a> and is
-available on devices running Android 4.1 (API Level 16) and higher.</p>
-
-<p>The ADK 2012 provides a reference implementation of this functionality for accessory developers.
-No software application is required to be installed on the connected Android device, accessory
-developers only need to support AOA v2. This implementation demonstrates audio output of 16bit,
-44.1kHz stereo PCM source data compressed into a single channel due to the audio hardware available
-on the accessory.</p>
-
-<p>Using the audio output features provided by the ADK library requires only a few function calls.
-The first few calls are in the accessory {@code setup()} routine, which prepare the accessory for
-USB connections and audio output, as summarized in the code example below:</p>
-
-<pre>
-ADK L;
-void setup() {
- L.audioInit();
- L.usbh_init()
- L.usbStart();
-}
-</pre>
-
-<p>For more information about the {@code ADK::audioInit()} function, see the {@code
-libraries/ADK/Audio.c} library file. For more information about the {@code ADK::usbh_init()}
-function, see the {@code libraries/ADK/Usbh.c} library file.</p>
-
-<p>After completing this setup, the {@code loop()} function calls {@code ADK::adkEventProcess()} to
-handle audio output and other ADK functions:</p>
-
-<pre>
-void loop(void)
-{
- ...
- L.adkEventProcess(); //let the adk framework do its thing
- ...
-}
-</pre>
-
-<p>This call executes task queuing for the ADK and as part of the execution process, the task queue
-executes {@code usbh_work()} in {@code libraries/ADK/Usbh.c}, which handles audio output requests.
-Review the implementation of this function for details. For additional implementation details on
-audio output, see the {@code libraries/ADK/accessory.c} library file.</p>
diff --git a/docs/html/adk/index.jd b/docs/html/adk/index.jd
deleted file mode 100644
index e08748fc..0000000
--- a/docs/html/adk/index.jd
+++ /dev/null
@@ -1,30 +0,0 @@
-page.title=Accessory Development Kit
-page.tags=adk
-@jd:body
-
-<p>The Accessory Development Kit (ADK) is a reference implementation for hardware manufacturers and
-hobbyists to use as a starting point for building accessories for Android. Each ADK release is
-provided with source code and hardware specifications to make the process of developing your own
-accessories easier. Creating new and alternative hardware based on the ADK is encouraged!</p>
-
-<p>Android accessories can be audio docking stations, exercise machines, personal medical testing
-devices, weather stations, or any other external hardware device that adds to the functionality of
-Android.</p>
-
-<p>Accessories use the Android Open Accessory (AOA) protocol to communicate with Android
-devices, over a USB cable or through a Bluetooth connection. If you are building an accessory that
-uses USB, make sure you understand how to implement the AOA protocol to establish communication
-between your accessory hardware and Android. For more information, see the
-<a href="http://source.android.com/tech/accessories/index.html">Android Open Acessory protocol</a>.
-</p>
-
-<p>The following sections provide more information about the Android Accessory Development Kits, how
-to use them, and how to get started building your own accessories for Android.</p>
-
-<dl>
- <dt><a href="adk2.html">ADK 2012 Guide</a></dt>
- <dd>Guide to getting started with the ADK released at Google I/O 2012.</dd>
-
- <dt><a href="adk.html">ADK 2011 Guide</a></dt>
- <dd>Guide to getting started with the original ADK, released at Google I/O 2011.</dd>
-</dl>
diff --git a/docs/html/channels/io2013.jd b/docs/html/channels/io2013.jd
deleted file mode 100644
index 2efda28..0000000
--- a/docs/html/channels/io2013.jd
+++ /dev/null
@@ -1,347 +0,0 @@
-excludeFromSuggestions=true
-fullpage=true
-page.title=Google I/O 13
-@jd:body
-
-<style>
-#ioplayer-frame {
- z-index:10;
- width:703px;
- height:396px;
- margin:0;
- position:relative;
-}
-
-#noplayer-message {
- position:absolute;
- top:50%;left:0;
- width:100%;
- z-index:-1;
- text-align:center;
- display:none;
-}
-
-h1 {
- font-weight:100;
- font-size:40px;
- line-height:30px;
- margin:30px 0 10px 0px;
- color:#000;
-}
-
-h2 {
- font-weight:100;
- font-size:30px;
- line-height:30px;
- margin:12px 0 10px 0px;
- color:#000;
- float:left;
- display:block;
-}
-
-.col-4 h2 {
- margin-top:40px;
-}
-
-ul.videos {
- list-style:none;
- margin:0;
- width:auto;
-}
-ul.videos li {
- display:block;
- float:left;
- position:relative;
- margin:0 2px 2px 0;
- background-repeat:no-repeat !important;
- background-size:320px auto;
- background-position:10% 50%;
- z-index:1; /* IE: the description is 2 */
-}
-ul.videos li a {
- color:#fff !important;
- display:block;
- margin:0;
- padding:8px 12px;
- width:209px;
- height:134px;
- box-shadow:inset 500px 500px 999px rgba(000, 000, 000, 0.2);
- background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, rgba(0,0,0,0.8)), color-stop(1, transparent));
- background-image: -webkit-linear-gradient(top, rgba(0,0,0,0.8), transparent);
- background-image: -moz-linear-gradient(top, rgba(0,0,0,0.8), transparent);
- background-image: -o-linear-gradient(top, rgba(0,0,0,0.8), transparent);
- background-image: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cc000000', endColorstr='#00ffffff',GradientType=0 ); /* IE6-9 */
-}
-ul.videos.featured li {
- margin:0 0 2px;
-}
-ul.videos.featured li a {
- margin:0;
- height:115px;
-}
-ul.videos li a:hover {
- box-shadow:inset 500px 500px 999px rgba(255,255,255, 0.6);
-}
-ul.videos li h4 {
- text-shadow:1px 1px 0 rgba(0,0,0,0.8);
- font-size:18px;
- line-height:22px;
- color:#fff;
- margin:0;
- height:100%; /* IE: to fill clickable area */
-}
-
-ul.videos li .description-frame {
- display:none;
- z-index:2; /* IE: the li is 1 */
-}
-ul.videos li a:hover .description-frame {
- display:block;
- position:absolute;
- top:80px;
- left:8px;
- z-index:99;
-}
-ul.videos .description {
- background:#fff;
- width:200px;
- padding:8px;
- -webkit-border-radius:1px;
- -moz-border-radius:1px;
- border-radius:1px;
- -moz-box-shadow: 0 2px 3px 2px rgba(000,000,000, 0.4);
- -webkit-box-shadow: 0 2px 3px 2px rgba(000,000,000, 0.4);
- box-shadow: 0 2px 3px 2px rgba(000,000,000, 0.4);
- font-size:11px;
- line-height:12px;
- color:#000;
- overflow:hidden;
-}
-ul.videos .arrow-up {
- position:absolute;
- left:15px;
- top:-11px;
- width:0;
- height:0;
- border-bottom:12px solid #fff;
- border-left:12px solid transparent;
- border-right:12px solid transparent;
-}
-ul.videos .arrow-down {
- position:absolute;
- left:15px;
- bottom:-11px;
- width:0;
- height:0;
- border-top:12px solid #fff;
- border-left:12px solid transparent;
- border-right:12px solid transparent;
-}
-
-ul.videos span.tag {
- font-size:.9em;
- font-weight:normal;
- display: block;
- position: absolute;
- bottom: 0;
- color: #fff;
- left: 0;
- padding: 4px;
- border-top-right-radius:4px;
- text-transform:uppercase;
- text-shadow: none;
-}
-ul.videos span.tag.design {
- background-color:rgba(51, 181, 229, .7);
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cc33b5e5', endColorstr='#cc33b5e5',GradientType=0 ); /* IE6-9 */
-}
-ul.videos span.tag.develop {
- background-color:rgba(255, 136, 0, .7);
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ccff8800', endColorstr='#ccff8800',GradientType=0 ); /* IE6-9 */
-}
-ul.videos span.tag.distribute {
- background-color:rgba(153, 204, 0, .7);
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cc99cc00', endColorstr='#cc99cc00',GradientType=0 ); /* IE6-9 */
-}
-
-</style>
-
-
-
-
-
-
-
-<div class="wrap">
-
- <div class="col-12" style="width:704px;margin:0">
- <h1>Android @ Google I/O 13</h1>
- <div id="ioplayer-frame">
- <div id="noplayer-message">
- <!-- busted flash player message -->
- Your video is supposed to appear here.<br/>
- Make sure you have the <a href="//get.adobe.com/flashplayer/" target="_blank">Flash® Player</a>.
- </div>
- <div id="player"><!-- Youtube embeds here... actually replaces this div --></div>
- </div>
- </div>
-
- <div class="col-4" style="margin:0;width:234px;padding:0 0 0 2px">
- <h2 class="norule">Most Popular</h2>
- <ul class="videos featured" id="playlist2">
- </ul>
- </div>
-</div>
-
-<div class="wrap">
-
- <div style="position:absolute;width:940px;text-align:right">
- <a href="//www.youtube.com/AndroidDevelopers" target="_blank">
- More on YouTube
- <img src="//www.youtube.com/favicon.ico" style="border:0;width:16px;height:16px;vertical-align:middle;margin:0 2px 3px 2px">
- </a>
- </div>
- <div style="width:944px;overflow:hidden;padding:0 0 20px">
- <h2 class="norule">All Videos</h2>
- <ul class="videos" id="playlist1" style="clear:left">
- <span id="videos-design"></span>
- <span id="videos-develop"></span>
- <span id="videos-distribute"></span>
- </ul>
- </div>
-
-</div>
-
-<br class="clearfix"/>
-
-
-
-
-
-
-
-
-
-
-
-<script src="//swfobject.googlecode.com/svn/trunk/swfobject/swfobject.js" type="text/javascript"></script>
-<script type="text/javascript">
-
-/* Load a video into the player box.
- * @param id The YouTube video ID
- * @param title The video title to display in the player box (character escaped)
- * @param autoplay Whether to automatically play the video
- */
-function loadVideo(id, title, autoplay) {
- var url = '//www.youtube.com/v/' + id + '&rel=1&border=0&fs=1' + (autoplay?'&autoplay=1':'');
- swfobject.embedSWF(url, 'player', '704', '397', '9.0.0', false, false, {allowfullscreen: 'true'});
- $('body,html').animate({ scrollTop: 0 }, "slow");
- setTimeout(function(){$('#noplayer-message').show()}, 2000);
-}
-
-
-function buildPlaylistDesign(data) {
- buildPlaylist(data, $('ul#playlist1 #videos-design'), "design");
-}
-
-function buildPlaylistDevelop(data) {
- buildPlaylist(data, $('ul#playlist1 #videos-develop'), "develop");
-}
-
-function buildPlaylistDistribute(data) {
- buildPlaylist(data, $('ul#playlist1 #videos-distribute'), "distribute");
-}
-
-function buildPlaylist2(data) {
- buildPlaylist(data, $('ul#playlist2'));
-}
-
-function buildPlaylist(data, ul, tag) {
-
- var MAX_DESC_LENGTH = 200; // the length at which we will trim the description
- var feed = data.feed;
- var entries = feed.entry || [];
- var playlistId = feed.yt$playlistId.$t;
-
- // Loop through each entry (each video) and add it to the '#DevelopersLive' list
- for (var i = 0; i < entries.length; i++) {
- var entry = entries[i];
- var title = entry.title.$t;
- var id = entry.media$group.yt$videoid.$t;
- // get 180x320 thumbnail
- var thumbs = entry.media$group.media$thumbnail;
- var thumbUrl;
- for (var j = 0; j < thumbs.length; j++) {
- if (thumbs[j].yt$name == "hqdefault") {
- thumbUrl = thumbs[j].url;
- }
- }
-
- // chop out the google io title
- title = title.substr(title.indexOf("-") + 1, title.length);
-
- var fullDescription = entry.media$group.media$description.$t;
- var playerUrl = entry.media$group.media$content[0].url;
- var shortDescription = fullDescription.substr(0, MAX_DESC_LENGTH);
- // further shorten description if there's a url (remove it)
- var httpindex = shortDescription.indexOf("http://");
- if (httpindex != -1) {
- shortDescription = shortDescription.substring(0,httpindex);
- }
- shortDescription += shortDescription.length == MAX_DESC_LENGTH ? "..." : ""; // add ellipsis if we've chopped the description
-
- var a = $('<a href="#" id="' + id + '" '
- + 'onclick="loadVideo(\'' + id + '\',\'' + escape(title) + '\',true); return false;" />');
- var pShortDescription = $('<div class="description-frame"><div class="arrow-up"></div>'
- + '<div class="description">' + shortDescription + '</div></div>');
- var h4Title = "<h4>" + title + "</h4>";
- var li = $('<li style="background-image:url(\'' + thumbUrl +'\')" />');
-
- li.append(a);
- a.append(h4Title).append(pShortDescription);
-
- if (tag !== undefined) {
- var $tag = $('<span class="tag ' + tag + '">' + tag + '</span>');
- a.append($tag);
- }
-
- ul.append(li);
-
-
- // put the first video in the player
- if ((tag == "design") && (i == 0)) {
- loadVideo(id, escape(title), false);
- }
- }
-}
-
-
-/* Request the playlist feeds from YouTube */
-function showDevelopersLivePlaylist() {
- var playlistId = "PLWz5rJ2EKKc-qVhMuAprIFYFbCotdgJKq"; /* IO 13 - Design */
- $.getScript("//gdata.youtube.com/feeds/api/playlists/"
- + playlistId +
- "?v=2&alt=json-in-script&max-results=50&callback=buildPlaylistDesign&orderby=position");
-
- playlistId = "PLWz5rJ2EKKc9rkwO9yBosRvkQBJd5utmR"; /* IO 13 - Develop */
- $.getScript("//gdata.youtube.com/feeds/api/playlists/"
- + playlistId +
- "?v=2&alt=json-in-script&max-results=50&callback=buildPlaylistDevelop&orderby=position");
-
- playlistId = "PLWz5rJ2EKKc-1WjgQqL0B4OQtbLfhMlB2"; /* IO 13 - Distribute */
- $.getScript("//gdata.youtube.com/feeds/api/playlists/"
- + playlistId +
- "?v=2&alt=json-in-script&max-results=50&callback=buildPlaylistDistribute&orderby=position");
-
-
- playlistId = "PLWz5rJ2EKKc9WGUwq2gQ-coU3fSyexgOx"; /* IO 13 - The Android Sessions */
- $.getScript("//gdata.youtube.com/feeds/api/playlists/"
- + playlistId +
- "?v=2&alt=json-in-script&max-results=3&callback=buildPlaylist2&orderby=viewCount");
-}
-
-showDevelopersLivePlaylist();
-
-
-</script>
\ No newline at end of file