ExternalAccessoriesModule Class
Item Index
Methods
Properties
Constants
Methods
showPicker
-
[params]
Displays an alert that allows the user to pair the device with a Bluetooth accessory.
Parameters:
-
[params]Object optionalAn object with the following properties:
-
[filterCallback]Function optionalAn 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
trueorfalseindicating whether or not the accessory should be shown by the picker.
-
Returns:
Properties
connectedAccessories
Array of Accessories
read-only
An array of Accessory objects representing the accessories currently connected to the iOS device.
Constants
PICKER_ERROR_ALREADY_CONNECTED
Number
One of the possible values of the errorCode properties of the
pickerFinished event.
The specified accessory was already connected.
PICKER_ERROR_CANCELLED
Number
One of the possible values of the errorCode properties of the
pickerFinished event.
The user canceled the picker alert.
PICKER_ERROR_NOT_FOUND
Number
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
One of the possible values of the errorCode properties of the
pickerFinished event.
Selecting an accessory failed for an unknown reason.
Events
accessoryConnected
Fired whenever a new accessory connects to the iOS device.
Event Payload:
-
accessoryAccessoryThe object representing the accessory that was connected.
-
selectedBooleantrueif the accessory was connected due to the user having selected it from the picker started by the showPicker function.
accessoryDisconnected
Fired whenever an accessory disconnects from the iOS device.
Event Payload:
-
accessoryAccessoryThe object representing the accessory that was disconnected.
pickerFinished
Fired whenever the picker opened using the showPicker function completed.
Event Payload:
-
dataTiBufferThe data received.
-
errorCodeNumberThe error code; only present if an error occurred. Possible values are captured by the PICKER_ERROR_* constants.
-
errorDomainStringThe error domain; only present if an error occurred.
-
errorDescriptionStringThe error description; only peresent if an error occurred.
