EAAccessory Class Reference
| Inherits from | |
| Conforms to | |
| Availability | Available in iOS 3.0 and later. |
| Declared in | EAAccessory.h |
Overview
The EAAccessory class provides your application with information about a single connected hardware accessory. You can use the information in this class to determine if your application is able to open a session to a given accessory. After you have an open session, you can also associate a custom delegate with the accessory object to be notified to changes in the accessory state. Your delegate must adopt the EAAccessoryDelegate protocol.
You use an accessory object to create an EASession object, which itself provides the communications channel to and from the accessory hardware. The accessory object provides information about the communications protocols the accessory supports, along with information about current hardware and firmware revisions.
When deciding whether to connect to an accessory, you should use the accessory’s declared protocols to make your determination. The protocols associated with an accessory indicate the types of data the accessory is capable of processing. You may use other properties to help you decide whether or not to connect to an accessory but the list of protocols should be the key factor you consider.
Accessories can be physically connected to the device through the 30-pin dock connector or wirelessly using Bluetooth.
Tasks
Getting Connection Information
-
connectedproperty -
connectionIDproperty
Getting the Manufacturer-Supplied Attributes
-
nameproperty -
manufacturerproperty -
modelNumberproperty -
serialNumberproperty -
firmwareRevisionproperty -
hardwareRevisionproperty -
protocolStringsproperty
Accessing the Delegate
-
delegateproperty
Properties
connected
A Boolean value indicating whether the accessory is currently connected to the iOS-based device. (read-only)
Availability
- Available in iOS 3.0 and later.
Declared In
EAAccessory.hconnectionID
The accessory’s unique connection ID to the iOS-based device. (read-only)
Discussion
The connection ID uniquely identifies this accessory to the device. If multiple accessories of the same type are connected to the device, you can use this information to distinguish between them.
The connection ID for an accessory persists only for the duration of the current connection. If the accessory is disconnected and reconnected, a new connection ID is assigned.
Availability
- Available in iOS 3.0 and later.
Declared In
EAAccessory.hdelegate
The object that acts as the delegate of the accessory.
Discussion
The delegate receives notifications about changes to the status of the accessory object. The delegate must adopt the EAAccessoryDelegate protocol.
Availability
- Available in iOS 3.0 and later.
Declared In
EAAccessory.hfirmwareRevision
The current firmware version for the accessory. (read-only)
Discussion
The format of this string is determined by the accessory manufacturer.
Availability
- Available in iOS 3.0 and later.
Declared In
EAAccessory.hhardwareRevision
The hardware version of the accessory. (read-only)
Discussion
The format of this string is determined by the accessory manufacturer.
Availability
- Available in iOS 3.0 and later.
Declared In
EAAccessory.hmanufacturer
The name of the accessory’s manufacturer. (read-only)
Availability
- Available in iOS 3.0 and later.
Declared In
EAAccessory.hmodelNumber
The model information for the accessory. (read-only)
Availability
- Available in iOS 3.0 and later.
Declared In
EAAccessory.hname
The display name of the accessory. (read-only)
Availability
- Available in iOS 3.0 and later.
Declared In
EAAccessory.hprotocolStrings
The communication protocols supported by the accessory. (read-only)
Discussion
Protocol names are formatted as reverse-DNS strings. For example, the string “com.apple.myProtocol” might represent a custom protocol defined by Apple. Manufacturers can define custom protocols for their accessories or work with other manufacturers and organizations to define standard protocols for different accessory types.
The protocol name should be the primary factor in determining whether your application is capable of communicating with a given accessory. You may use other properties to help you decide whether or not to connect to an accessory but the protocol should still be the key factor you consider. If your application supports multiple protocols for a single accessory, your code should always choose the highest-fidelity protocol that you support.
Availability
- Available in iOS 3.0 and later.
Declared In
EAAccessory.hserialNumber
The serial number of the accessory. (read-only)
Availability
- Available in iOS 3.0 and later.
Declared In
EAAccessory.hConstants
Null Connection ID
Identifies an unconnected accessory.
enum {
EAConnectionIDNone = 0,
};
Constants
© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-05-12)