ADC Home > Reference Library > Reference > Hardware & Drivers > Bluetooth > Bluetooth Framework Reference

 


IOBluetoothHeadsetDevice

Inherits from:

IOBluetoothRFCOMMAudioController

Declared In:

Overview

There are some suggested error checks developers should provide before using this object. When connecting out to a remote device developers need to check that the device has the Headset service in its SDP records. Use the provided class method in this object.

To attach to a device that has connected into the machine, developers need to check for the existence of the service (using the provided class method in this object), that the device is attaching to the RFCOMM channel associated with the Headset Gateway SDP record published on the machine, and that the device that is connecting is configured as a headset with the machine. Developers will need to search the local SDP records to find the Gateway record for the machine, the provided APIs are only for the target device.



Methods

+getRequiredSDPRFCOMMChannelIDForDevice:

Return the rfcomm channel ID as specified in the Headset SDP record of the device.

+getRequiredSDPServiceRecordForDevice:

Returns the Headset SDP service record for the device.

-initForConnectionToDevice:delegate:

Create a new IOBluetoothHeadsetDevice for outgoing connect to a device

-initForConnectionToDevice:supportedFeatures:delegate:

Create a new IOBluetoothHeadsetDevice for outgoing connect to a device

-initWithIncomingDevice:incomingRFCOMMChannelID:delegate:

Create a new IOBluetoothHeadsetDevice for a device that is trying to connect in


getRequiredSDPRFCOMMChannelIDForDevice:


Return the rfcomm channel ID as specified in the Headset SDP record of the device.

+ (BluetoothRFCOMMChannelID) 
        getRequiredSDPRFCOMMChannelIDForDevice:(IOBluetoothDevice*)device; 
Parameters
device

A valid IOBluetoothDevice

Return Value

The SDP specified RFCOMM channel ID for the device on success, 0 on failure


getRequiredSDPServiceRecordForDevice:


Returns the Headset SDP service record for the device.

+ (IOBluetoothSDPServiceRecord *) 
        getRequiredSDPServiceRecordForDevice:(IOBluetoothDevice*)device; 
Parameters
device

A valid IOBluetoothDevice

Return Value

The Headset SDP record for the device on success, nil on failure


initForConnectionToDevice:delegate:


Create a new IOBluetoothHeadsetDevice for outgoing connect to a device

See Also:

initForConnectionToDevice:supportedFeatures:delegate:

- (id) initForConnectionToDevice: (IOBluetoothDevice *)device delegate: (id)inDelegate; 
Parameters
device

A valid IOBluetoothDevice

inDelegate

An object to act as delegate


initForConnectionToDevice:supportedFeatures:delegate:


Create a new IOBluetoothHeadsetDevice for outgoing connect to a device

See Also:

initForConnectionToDevice:delegate:

- (id) initForConnectionToDevice: (IOBluetoothDevice *)device delegate: (id)inDelegate; 
Parameters
device

A valid IOBluetoothDevice

inDelegate

An object to act as delegate

Return Value

A newly created IOBluetoothHeadsetDevice object on success, nil on failure


initWithIncomingDevice:incomingRFCOMMChannelID:delegate:


Create a new IOBluetoothHeadsetDevice for a device that is trying to connect in

- (id) initWithIncomingDevice: (IOBluetoothDevice *)device incomingRFCOMMChannelID: (BluetoothRFCOMMChannelID)incomingRFCOMMChannelID delegate: (id)inDelegate; 
Parameters
device

A valid IOBluetoothDevice with baseband connection

incomingRFCOMMChannelID

The RFCOMM ID the device is trying to connect to

inDelegate

An object to act as delegate

Return Value

A newly created IOBluetoothHeadsetDevice object on success, nil on failure

Discussion

An incoming connection from a Headset/Handsfree device must be validated against the local Gateway service records to find out what the device is trying to connect to. For example, headsets must be connecting over RFCOMM to a corresponding headset audio gateway rfcomm channel published in the service, handsfree to a handsfree audio gateway service. If this were L2CAP we could just look at the PSM, but these devices use RFCOMM. This method will do the proper check internally and will return nil if the incoming channel does not match with a published Headset AG record.


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-08-07