iOS Developer Library

Developer

EAAccessory Class Reference

Options
Deployment Target:

On This Page

EAAccessory

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.

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

    Declaration

    @property(nonatomic, readonly, getter=isConnected) BOOL connected

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

    Declaration

    @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.

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

    Declaration

    @property(nonatomic, readonly) NSString *name

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

    Declaration

    @property(nonatomic, readonly) NSString *manufacturer

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

    Declaration

    @property(nonatomic, readonly) NSString *modelNumber

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

    Declaration

    @property(nonatomic, readonly) NSString *serialNumber

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

    Declaration

    @property(nonatomic, readonly) NSString *firmwareRevision

    Discussion

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

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

    Declaration

    @property(nonatomic, readonly) NSString *hardwareRevision

    Discussion

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

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

    Declaration

    @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.

  • The object that acts as the delegate of the accessory.

    Declaration

    @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.

  • Identifies an unconnected accessory.

    Declaration

    enum { EAConnectionIDNone = 0, };

    Constants

    • EAConnectionIDNone

      Indicates an invalid connection.