Apple Developer Connection
Advanced Search
Member Login Log In | Not a Member? Contact ADC
ADC Home > Reference Library > Reference > Hardware & Drivers > Bluetooth > Bluetooth User Interface Framework Reference

 


IOBluetoothPairingController

Inherits from:
Declared In:

Overview

A NSWindowController subclass to display a window to initiate pairing to other bluetooth devices.

Discussion

Implementation of a window controller to handle pairing with a bluetooth device. This class will handle connecting to the Bluetooth Daemon for the purposes of searches, and displaying the results. When necessary this class will display a sheet asking the user for a PIN code. This window will not return anything to the caller if it is canceled or if pairing occurs.



Methods

-addAllowedUUID:
Adds a UUID to the list of UUIDs that are used to validate the user's selection.
-addAllowedUUIDArray:
Adds an array of UUIDs to the list of UUIDs that are used to validate the user's selection.
-clearAllowedUUIDs
Resets the controller back to the default state where it will accept any device the user selects.
-getDescriptionText
Returns the description text that appears in the device selector panel (i.e. what was set in -setDescriptionText:).
-getOptions
Returns the option bits that control the panel's behavior.
-getPairingControllerRef
Returns an IOBluetoothPairingControllerRef representation of the target IOBluetoothPairingController object.
-getPrompt
Returns the title of the default/select button in the device selector panel (i.e. what was set in -setPrompt:).
-getResults
Returns an NSArray of the devices that were paired.
-getSearchAttributes
Returns the search attributes that control the panel's search/inquiry behavior.
-getTitle
Returns the title of the device selector panel (i.e. what was set in -setTitle:).
+pairingController
-runModal
Runs the pairing panel in a modal session to allow the user to select a Bluetooth device.
-runPanelWithAttributes:
Run the IOBluetoothPairingController with a list of device attributes to filter on.
-setDescriptionText:
Sets the description text that appears in the device selector panel.
-setOptions:
Sets the option bits that control the panel's behavior.
-setPrompt:
Sets the title of the default/select button in the device selector panel.
-setSearchAttributes:
Sets the search attributes that control the panel's search/inquiry behavior.
-setTitle:
Sets the title of the panel when not run as a sheet.
+withPairingControllerRef:
Method call to convert an IOBluetoothPairingControllerRef into an IOBluetoothPairingController *.

addAllowedUUID:


Adds a UUID to the list of UUIDs that are used to validate the user's selection.

- (void)addAllowedUUID:(IOBluetoothSDPUUID *)allowedUUID; 
Parameters
allowedUUID
UUID that a device may contain to be selected
Discussion

The user's device selection gets validated against the UUIDs passed to -addAllowedUUID: addAllowedUUIDArray:. Each call to those methods essentially adds a filter that the selected device gets validated with. If any of the filters match, the device is considered valid. If they all fail, the device is not valid and the user is presented with an error code that the device does not support the required services. The UUID passed to -addAllowedUUID: is the only UUID that must be present in the device's SDP service records. Alternatively, all of the UUIDs in the UUID array passed to -addAllowedUUIDArray must be present.

NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.


addAllowedUUIDArray:


Adds an array of UUIDs to the list of UUIDs that are used to validate the user's selection.

- (void)addAllowedUUIDArray:(NSArray *)allowedUUIDArray; 
Parameters
allowedUUIDArray
An NSArray of UUIDs that all must be present in a device for it to be selectable.
Discussion

The user's device selection gets validated against the UUIDs passed to -addAllowedUUID: addAllowedUUIDArray:. Each call to those methods essentially adds a filter that the selected device gets validated with. If any of the filters match, the device is considered valid. If they all fail, the device is not valid and the user is presented with an error code that the device does not support the required services. The UUID passed to -addAllowedUUID: is the only UUID that must be present in the device's SDP service records. Alternatively, all of the UUIDs in the UUID array passed to -addAllowedUUIDArray must be present.

NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.


clearAllowedUUIDs


Resets the controller back to the default state where it will accept any device the user selects.

- (void)clearAllowedUUIDs; 
Discussion

NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.


getDescriptionText


Returns the description text that appears in the device selector panel (i.e. what was set in -setDescriptionText:).

- (NSString *)getDescriptionText; 
Return Value

Returns the description text of the device selector panel.

Discussion

NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.


getOptions


Returns the option bits that control the panel's behavior.

- (IOBluetoothServiceBrowserControllerOptions)getOptions; 
Return Value

Returns the option bits set by setOptions:

Discussion

NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.


getPairingControllerRef


Returns an IOBluetoothPairingControllerRef representation of the target IOBluetoothPairingController object.

- (IOBluetoothPairingControllerRef)getPairingControllerRef; 
Return Value

Returns an IOBluetoothPairingControllerRef representation of the target IOBluetoothPairingController object.


getPrompt


Returns the title of the default/select button in the device selector panel (i.e. what was set in -setPrompt:).

- (NSString *)getPrompt; 
Return Value

Returns the default button title of the device selector panel.

Discussion

NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.


getResults


Returns an NSArray of the devices that were paired.

- (NSArray *)getResults; 
Return Value

Returns an NSArray of IOBluetoothDevice objects of devices that were paired. If the user cancelled the panel, nil will be returned.

Discussion

There will only be results if the panel has been run, the user has successfully made a selection, that selection has been validated and the selected device paired. If kIOBluetoothUISuccess was returned for the session, there should be valid results. Currently only a single device is allowed to be selected, so the results array will only contain one object. However in the future multiple selection may be supported.

NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.


getSearchAttributes


Returns the search attributes that control the panel's search/inquiry behavior.

- (const IOBluetoothDeviceSearchAttributes *)getSearchAttributes; 
Return Value

Returns the search attributes set by setSearchAttributes:

Discussion

NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.


getTitle


Returns the title of the device selector panel (i.e. what was set in -setTitle:).

- (NSString *)getTitle; 
Return Value

Returns the title of the device selector panel.

Discussion

NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.


pairingController


+ (IOBluetoothPairingController *)pairingController; 
Return Value

An IOBluetoothPairingController instance. Call runPanelWithAttributes

Success - a new instance of the Pairing Controller

Failure - nil

Discussion

Method call to instantiate a new IOBluetoothPairingController object.


runModal


Runs the pairing panel in a modal session to allow the user to select a Bluetooth device.

- (int)runModal; 
Return Value

Returns kIOBluetoothUISuccess if a successful, validated device selection was made by the user and that device successfully paired. Returns kIOBluetoothUIUserCanceledErr if the user cancelled the panel. These return values are the same as NSRunStoppedResponse and NSRunAbortedResponse respectively. They are the standard values used in a modal session.

Discussion

The controller will use the panel attributes to filter what devices the user sees. The allowed UUIDs will be used to validate the selection the user makes. Only when a selection has been validated (or the panel cancelled) and the device paired, will this method return.

NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.


runPanelWithAttributes:


Run the IOBluetoothPairingController with a list of device attributes to filter on.

- (void)runPanelWithAttributes:(IOBluetoothDeviceSearchAttributes *)attributes DEPRECATED_IN_BLUETOOTH_VERSION_2_0_AND_LATER; 
Parameters
attributes
A pointer to an IOBluetoothDeviceSearchAttributes list. This list can be used to include the devices to allow the UI IOBluetoothPairingController to display. Set to NULL to allow any devices to be shown.
Return Value

none - runs the panel from a previously created pairing controller.

Discussion

***WARNING*** This method has been deprecated in favor of -setSearchAttributes:, -runModal and -getResults When called this routine will display the PairingController window, using the attributes parameter as a filter of device types to display in the UI.


setDescriptionText:


Sets the description text that appears in the device selector panel.

- (void)setDescriptionText:(NSString *)descriptionText; 
Parameters
descriptionText
String that appears in the description section of the device selector panel.
Discussion

The description text should be localized for best user experience.

NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.


setOptions:


Sets the option bits that control the panel's behavior.

- (void)setOptions:(IOBluetoothServiceBrowserControllerOptions)options; 
Parameters
options
Options to control the panel's behavior.
Discussion

The pairing controller options control the behavior of the panel. Currently kIOBluetoothServiceBrowserControllerOptionsAutoStartInquiry is the only supported option. In the future more options will be added to control things like whether the connection to the device is closed when the controller is finished or if multiple selection is allowed.

NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.


setPrompt:


Sets the title of the default/select button in the device selector panel.

- (void)setPrompt:(NSString *)prompt; 
Parameters
prompt
String that appears in the default/select button in the device selector panel.
Discussion

The prompt text should be localized for best user experience.

NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.


setSearchAttributes:


Sets the search attributes that control the panel's search/inquiry behavior.

- (void)setSearchAttributes:(const IOBluetoothDeviceSearchAttributes *)searchAttributes; 
Parameters
searchAttributes
Attributes to control the panel's inquiry behavior.
Discussion

The device search attributes control the inquiry behavior of the panel. They allow only devices that match the specified attributes (i.e. class of device) to be displayed to the user. Note that this only covers attributes returned in an inquiry result and not actual SDP services on the device.

NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.


setTitle:


Sets the title of the panel when not run as a sheet.

- (void)setTitle:(NSString *)windowTitle; 
Parameters
windowTitle
Title of the device selector panel.
Discussion

The panel title should be localized for best user experience.

NOTE: This method is only available in Mac OS X 10.2.4 (Bluetooth v1.1) or later.


withPairingControllerRef:


Method call to convert an IOBluetoothPairingControllerRef into an IOBluetoothPairingController *.

+ (IOBluetoothPairingController *)withPairingControllerRef:(IOBluetoothPairingControllerRef)pairingControllerRef; 
Parameters
pairingControllerRef
IOBluetoothPairingControllerRef for which an IOBluetoothPairingController * is desired.
Return Value

Returns the IOBluetoothPairingController * for the given IOBluetoothPairingControllerRef.




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Last Updated: 2008-03-11