The object you use to manage communications between your app and a connected hardware accessory.


class EASession : NSObject


An EASession object creates a communications channel between your application and a connected hardware accessory. When creating a session, specify the protocol to use to communicate with the accessory. After initializing an EASession object, use the provided output and input streams to transfer data to and from the accessory according to that protocol.

After creating a session object, immediately retrieve and configure the stream objects provided by the session. Streams send events to their associated delegate to notify it of changes in the stream status. For example, streams notify the delegate when data is waiting to be read or when more space is available for writing data. For more information about how to use stream objects, see Stream Programming Guide.

When sending and receiving data using the provided streams, it is your responsibility to ensure the data is formatted according to the specified protocol. The EASession class has no knowledge of specific accessory protocols and doesn't attempt to format the data in any way before or after transferring it.


Creating the Session Object

init?(accessory: EAAccessory, forProtocol: String)

Initializes the session for the specified accessory and protocol.

Getting Session Information

var accessory: EAAccessory?

The accessory attached to the session.

var protocolString: String?

The protocol being used for communication with the accessory.

Getting the Communication Streams

var inputStream: InputStream?

The stream to use for receiving data from the accessory.

var outputStream: OutputStream?

The stream to use for sending data to the accessory.


Inherits From

Conforms To

See Also

Accessory Communication

class EAAccessory

An object containing information about a single, connected hardware accessory.