LogicalLabs External Accessories Module

API Docs for: 1.0.0
Show:

ExternalAccessoriesModule Class

Module: Readme

Methods

showPicker

(
  • [params]
)
Void

Available since 1.0.0

Displays an alert that allows the user to pair the device with a Bluetooth accessory.

Parameters:

  • [params] Object optional

    An object with the following properties:

    • [filterCallback] Function optional

      An optional callback function that can be used to filter the accessories shown by the picker. This function will receive a string parameter, the name of the accessory, and expected to return true or false indicating whether or not the accessory should be shown by the picker.

Returns:

Void:

Properties

connectedAccessories

Array of Accessories read-only

Available since 1.0.0

An array of Accessory objects representing the accessories currently connected to the iOS device.

Constants

PICKER_ERROR_ALREADY_CONNECTED

Number

Available since 1.0.0

One of the possible values of the errorCode properties of the pickerFinished event.

The specified accessory was already connected.

PICKER_ERROR_CANCELLED

Number

Available since 1.0.0

One of the possible values of the errorCode properties of the pickerFinished event.

The user canceled the picker alert.

PICKER_ERROR_NOT_FOUND

Number

Available since 1.0.0

One of the possible values of the errorCode properties of the pickerFinished event.

The specified accessory could not be found, perhaps because it was turned off prior to connection.

PICKER_ERROR_UNKNOWN

Number

Available since 1.0.0

One of the possible values of the errorCode properties of the pickerFinished event.

Selecting an accessory failed for an unknown reason.

Events

accessoryConnected

Available since 1.0.0

Fired whenever a new accessory connects to the iOS device.

Event Payload:

  • accessory Accessory

    The object representing the accessory that was connected.

  • selected Boolean

    true if the accessory was connected due to the user having selected it from the picker started by the showPicker function.

accessoryDisconnected

Available since 1.0.0

Fired whenever an accessory disconnects from the iOS device.

Event Payload:

  • accessory Accessory

    The object representing the accessory that was disconnected.

pickerFinished

Available since 1.0.0

Fired whenever the picker opened using the showPicker function completed.

Event Payload:

  • data TiBuffer

    The data received.

  • errorCode Number

    The error code; only present if an error occurred. Possible values are captured by the PICKER_ERROR_* constants.

  • errorDomain String

    The error domain; only present if an error occurred.

  • errorDescription String

    The error description; only peresent if an error occurred.