EAAccessory Class Reference

Inherits from
Conforms to
Availability
Available in iOS 3.0 and later.
Declared in
EAAccessory.h
Related sample code

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

Getting the Manufacturer-Supplied Attributes

Accessing the Delegate

Properties

connected

A Boolean value indicating whether the accessory is currently connected to the iOS-based device. (read-only)

@property(nonatomic, readonly, getter=isConnected) BOOL connected
Availability
  • Available in iOS 3.0 and later.
Declared In
EAAccessory.h

connectionID

The accessory’s unique connection ID to the iOS-based device. (read-only)

@property(nonatomic, readonly) NSUInteger connectionID
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.h

delegate

The object that acts as the delegate of the accessory.

@property(nonatomic, assign) id<EAAccessoryDelegate> delegate
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.h

firmwareRevision

The current firmware version for the accessory. (read-only)

@property(nonatomic, readonly) NSString *firmwareRevision
Discussion

The format of this string is determined by the accessory manufacturer.

Availability
  • Available in iOS 3.0 and later.
Declared In
EAAccessory.h

hardwareRevision

The hardware version of the accessory. (read-only)

@property(nonatomic, readonly) NSString *hardwareRevision
Discussion

The format of this string is determined by the accessory manufacturer.

Availability
  • Available in iOS 3.0 and later.
Declared In
EAAccessory.h

manufacturer

The name of the accessory’s manufacturer. (read-only)

@property(nonatomic, readonly) NSString *manufacturer
Availability
  • Available in iOS 3.0 and later.
Declared In
EAAccessory.h

modelNumber

The model information for the accessory. (read-only)

@property(nonatomic, readonly) NSString *modelNumber
Availability
  • Available in iOS 3.0 and later.
Declared In
EAAccessory.h

name

The display name of the accessory. (read-only)

@property(nonatomic, readonly) NSString *name
Availability
  • Available in iOS 3.0 and later.
Declared In
EAAccessory.h

protocolStrings

The communication protocols supported by the accessory. (read-only)

@property(nonatomic, readonly) NSArray *protocolStrings
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.
Related Sample Code
Declared In
EAAccessory.h

serialNumber

The serial number of the accessory. (read-only)

@property(nonatomic, readonly) NSString *serialNumber
Availability
  • Available in iOS 3.0 and later.
Declared In
EAAccessory.h

Constants

Null Connection ID

Identifies an unconnected accessory.

enum {
   EAConnectionIDNone = 0,
};
Constants
EAConnectionIDNone

Indicates an invalid connection.

Available in iOS 3.0 and later.

Declared in EAAccessory.h.