Skip to content

mgiannikouris/OpenXC_iOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Read Me about OpenXCDemo
==============================
1.1

OpenXCDemo shows how to communicate from an iOS 3.x application, with an external accessory using the External Accessory (EA) Framework API. The sample can be used with a Made For iPod (MFI) accessory, which supports the iPod Accessory Protocol (see http://developer.apple.com/iphone/program/sdk/accessories.html) designed for use with the ExternalAccessory.framework. The sample is provided to demonstrate the common functions of an EA Framework application. The goal of this sample is to demonstrate the following functions

 - detect the connections and disconnections of accessories that support EA protocols.

 - provide a demonstration for communicating with the accessory.

OpenXCDemo requires iOS 4 or later to run on an iPhone or iPod Touch.
OpenXCDemo requires iOS 3.2 to run on an iPad.

Packing List
------------
The sample contains the following items:

o ReadMe.txt -- This file.

o OpenXCDemo_Prefix.pch -- Prefix header for all source files in the OpenXCDemo project.

o OpenXCDemo.xcodeproj -- An Xcode project for the sample.

o OpenXCDemo-Info.plist -- The application Info.plist file.

o EADSessionController.[hm] -- Provides an interface for communication with an EASession. It is also the delegate for the EASession input and output stream objects.

o EADSessionTransferViewController.[hm] -- A view controller to allow transferring data to and from an accessory form the UI.

o OpenXCDemoAppDelegate.[hm] -- A delegate object for the User Interface.

o RootViewController.[hm] -- A table view controller for watching the device come and go.

Using the Sample
----------------
The sample can be used with any Made For iPod (MFI) accessory designed for use with the External Accessory Framework. The application will display all attached External Accessories in the "Accessories" table view, provide information registered by the MFI accessory, and provides methods to send and receive data to the accessory. Information about MFI accessories is available to licensees of the MFI program. You can learn more about the MFI program at the Apple Developer Connection "Made For iPod Program" web page <http://developer.apple.com/ipod/index.html>.

When the MFI accessory is attached, iOS reads the MFI accessory provided information that includes the supported protocol strings. The system searches for a matching protocol string in the UISupportedExternalAccessoryProtocols array of the Info.plist of all the installed applications. If no matching protocol string is found, iOS raises the "Application Not Installed" alert. You can modify the UISupportedExternalAccessoryProtocols property in the OpenXCDemo-Info.plist to include the protocol string registered by your accessory, to keep the system from presenting the "Application Not Installed" alert on accessory attachment.

At the "Accessories" table view, the name of all attached MFI accessories are displayed. Click on the accessory name to see a list of supported protocols. Select a protocol, and the application will use the protocol to open a session for communication with the accessory.

The Protocol table view provides options for three different ways to send data to the accessory. There is also a counter to display the number of bytes received from the accessory. The three buttons and the methods that are called are
"Send String"   - sendString - sends the string entered in the UITextField it's associated with in the view to the accessory.
"Send Hex Data" - sendHex - sends the string entered in the UITextField it's associated with in the view interpreted as a hex byte sequence to the accessory.
"Send 10K"      - send10K - sends 10K bytes of incrementing 8-bit values (0 to 255) to the accessory.

If the accessory is detached, the application will detect this action and reset itself to the main Accessories table view. When no accessory is attached, the main screen will display the message "No Accessories Connected".

Building the Sample
-------------------
The sample requires Xcode 3.2.3 on Mac OS X 10.6 with iOS 4 SDK.

The sample program will run in the Simulator, but there is is no support communicate with real accessories through the simulator.

Credits and Version History
---------------------------
If you find any problems with this sample, please file a bug against it.

<http://developer.apple.com/bugreporter/>

Apple Developer Technical Support
Core OS/Hardware

10 July 2010

About

iOS demo application for OpenXC devices

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published