iOS Developer Library

Developer

EAAccessory Class Reference

Options
Deployment Target:

On This Page
Language:

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

Inheritance


Conforms To


Import Statement


import ExternalAccessory @import ExternalAccessory;

Availability


Available in iOS 3.0 and later.
  • connected connected Property

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

    Declaration

    Swift

    var connected: Bool { get }

    Objective-C

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

    Import Statement

    import ExternalAccessory

    Availability

    Available in iOS 3.0 and later.

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

    Declaration

    Swift

    var connectionID: Int { get }

    Objective-C

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

    Import Statement

    import ExternalAccessory

    Availability

    Available in iOS 3.0 and later.

  • name name Property

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

    Declaration

    Swift

    var name: String! { get }

    Objective-C

    @property(nonatomic, readonly) NSString *name

    Import Statement

    import ExternalAccessory

    Availability

    Available in iOS 3.0 and later.

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

    Declaration

    Swift

    var manufacturer: String! { get }

    Objective-C

    @property(nonatomic, readonly) NSString *manufacturer

    Import Statement

    import ExternalAccessory

    Availability

    Available in iOS 3.0 and later.

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

    Declaration

    Swift

    var modelNumber: String! { get }

    Objective-C

    @property(nonatomic, readonly) NSString *modelNumber

    Import Statement

    import ExternalAccessory

    Availability

    Available in iOS 3.0 and later.

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

    Declaration

    Swift

    var serialNumber: String! { get }

    Objective-C

    @property(nonatomic, readonly) NSString *serialNumber

    Import Statement

    import ExternalAccessory

    Availability

    Available in iOS 3.0 and later.

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

    Declaration

    Swift

    var firmwareRevision: String! { get }

    Objective-C

    @property(nonatomic, readonly) NSString *firmwareRevision

    Discussion

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

    Import Statement

    import ExternalAccessory

    Availability

    Available in iOS 3.0 and later.

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

    Declaration

    Swift

    var hardwareRevision: String! { get }

    Objective-C

    @property(nonatomic, readonly) NSString *hardwareRevision

    Discussion

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

    Import Statement

    import ExternalAccessory

    Availability

    Available in iOS 3.0 and later.

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

    Declaration

    Swift

    var protocolStrings: [AnyObject]! { get }

    Objective-C

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

    Import Statement

    import ExternalAccessory

    Availability

    Available in iOS 3.0 and later.

  • delegate delegate Property

    The object that acts as the delegate of the accessory.

    Declaration

    Swift

    unowned(unsafe) var delegate: EAAccessoryDelegate!

    Objective-C

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

    Import Statement

    import ExternalAccessory

    Availability

    Available in iOS 3.0 and later.

  • Identifies an unconnected accessory.

    Declaration

    Swift

    var EAConnectionIDNone: Int { get }

    Objective-C

    enum { EAConnectionIDNone = 0, };

    Constants

    • EAConnectionIDNone

      EAConnectionIDNone

      Indicates an invalid connection.

      Available in iOS 3.0 and later.

    Import Statement