Class

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.

Declaration

class EAAccessory : NSObject

Overview

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 always first check the accessory’s declared protocols in the protocolStrings array. This list indicates the types of data the accessory is capable of processing at that moment, which may not be the full list of protocols for which the accessory is designed. For example, an accessory that is connected but not yet authenticated will report no supported protocols until authentication is successful. You should not connect to the accessory unless and until the list includes the protocol you intend to use.

Accessories can be physically connected to the device through the Lightning dock connector (or through the 30-pin dock connector on older devices) or wirelessly using Bluetooth.

Topics

Getting Connection Information

var isConnected: Bool

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

var connectionID: Int

The accessory’s unique connection ID to the iOS-based device.

Getting the Manufacturer-Supplied Attributes

var name: String

The display name of the accessory.

var manufacturer: String

The name of the accessory’s manufacturer.

var modelNumber: String

The model information for the accessory.

var serialNumber: String

The serial number of the accessory.

var firmwareRevision: String

The current firmware version for the accessory.

var hardwareRevision: String

The hardware version of the accessory.

var protocolStrings: [String]

The communication protocols supported by the accessory.

Accessing the Delegate

var delegate: EAAccessoryDelegate?

The object that acts as the delegate of the accessory.

Constants

Null Connection ID

Identifies an unconnected accessory.

Instance Properties

Relationships

Inherits From

Conforms To