ADC Home > Reference Library > Reference > Hardware & Drivers > Bluetooth > Bluetooth Framework Reference
|
IOBluetoothDeviceInquiry |
Inherits from: | NSObject |
Declared In: |
Object representing a device inquiry that finds Bluetooth devices in-range of the computer, and (optionally) retrieves name information for them.
You should only use this object if your application needs to know about in-range devices and cannot use the GUI provided by the IOBluetoothUI framework. It will not let you perform unlimited back-to-back inquiries, but will instead throttle the number of attempted inquiries if too many are attempted within a small window of time. Important Note: DO NOT perform remote name requests on devices from delegate methods or while this object is in use. If you wish to do your own remote name requests on devices, do them after you have stopped this object. If you do not heed this warning, you could potentially deadlock your process.
Removes all found devices from the inquiry object.
Returns the current delegate, if any.
Returns found IOBluetoothDevice objects as an array.
Initializes an alloc'd inquiry object, and sets the delegate object, as if -setDelegate: were called on it.
Returns the number of seconds the search will be performed.
Class method to create an inquiry object.
Set the delegate that will receive delegate messages, as defined below.
Set the length of the inquiry that is performed each time -start is used on an inquiry object.
Use this method to set the criteria for the device search.
Use this method to set the criteria for the device search.
Sets whether or not the inquiry object will retrieve the names of devices found during the search.
Tells inquiry object to begin the inquiry and name updating process, if specified.
Halts the inquiry object. Could either stop the search for new devices, or the updating of found device names.
Returns whether or the inquiry object will perform remote name requests on found devices.
clearFoundDevices |
Removes all found devices from the inquiry object.
- (void)clearFoundDevices;
delegate |
Returns the current delegate, if any.
- (id)delegate;
Returns delegate object, otherwise returns nil.
foundDevices |
Returns found IOBluetoothDevice objects as an array.
- (NSArray*)foundDevices;
Returns an NSArray of IOBluetoothDevice objects.
Will not return nil. If there are no devices found, returns an array with length of 0.
initWithDelegate: |
Initializes an alloc'd inquiry object, and sets the delegate object, as if -setDelegate: were called on it.
- (id)initWithDelegate:(id)delegate;
delegate
A delegate object that wishes to receive messages from the inquiry object. Delegate methods are listed below, under IOBluetoothDeviceInquiryDelegate.
A pointer to the initialized IOBluetoothDeviceInquiry object.
inquiryLength |
Returns the number of seconds the search will be performed.
- (uint8_t)inquiryLength;
Number of seconds the search will be performed.
inquiryWithDelegate: |
Class method to create an inquiry object.
+ (IOBluetoothDeviceInquiry *)inquiryWithDelegate:(id)delegate;
delegate
A delegate object that wishes to receive messages from the inquiry object. Delegate methods are listed below, under IOBluetoothDeviceInquiryDelegate.
A pointer to the created IOBluetoothDeviceInquiry object.
The inquiry is NOT automatically started. You musts call -start on it to start the search for in-range devices.
setDelegate: |
Set the delegate that will receive delegate messages, as defined below.
- (void)setDelegate:(id)delegate;
delegate
The object that should receive delegate messages.
All delegate methods are optional, although it would be a good idea to implement them all. The passed object will be retained.
setInquiryLength: |
Set the length of the inquiry that is performed each time -start is used on an inquiry object.
- (uint8_t)setInquiryLength:(uint8_t)seconds;
seconds
Number of seconds the inquiry will search for in-range devices before refreshing device names, if specified.
Number of seconds the search will be performed.
A default of 10 seconds is used, unless a different value is specified using this method. Note that if you have called -start again too quickly, your inquiry may actually take much longer than what length you specify, as inquiries are throttled in the system. Also note that if you have the inquiry object updating device names for you, the whole inquiry process could be much longer than the specified length, depending on the number of devices found and how responsive to name requests they are. If you -must- have a strict inquiry length, disable name updates. In other words, this "length" only refers to the actual device discovery portion of the whole inquiry process.
setSearchCriteria |
Use this method to set the criteria for the device search.
See Also:
setSearchCriteria:majorDeviceClass:minorDeviceClass:
- (void)setSearchCriteria:(BluetoothServiceClassMajor)inServiceClassMajor majorDeviceClass:(BluetoothDeviceClassMajor)inMajorDeviceClass minorDeviceClass:(BluetoothDeviceClassMinor)inMinorDeviceClass;
inServiceClassMajor
Set the major service class for found devices. Set to kBluetoothServiceClassMajorAny for all devices. See BluetoothAssignedNumbers.h for possible values.
inMajorDeviceClass
Set the major device class for found devices. Set to kBluetoothDeviceClassMajorAny for all devices. See BluetoothAssignedNumbers.h for possible values.
inMinorDeviceClass
Set the minor device class for found devices. Set to kBluetoothDeviceClassMinorAny for all devices. See BluetoothAssignedNumbers.h for possible values.
The default inquiry object will search for all types of devices. If you wish to find only keyboards, for example, you might use this method like this:
[myInquiryObject setSearchCriteria:kBluetoothServiceClassMajorAny majorDeviceClass:kBluetoothDeviceClassMajorPeripheral minorDeviceClass:kBluetoothDeviceClassMinorPeripheral1Keyboard];
However, we recommend only using this if you are certain of the device class you are looking for, as some devices may report a different/unexpected device class, and the search may miss the device you are interested in.
setSearchCriteria:majorDeviceClass:minorDeviceClass: |
Use this method to set the criteria for the device search.
See Also:
setSearchCriteria
- (void)setSearchCriteria:(BluetoothServiceClassMajor)inServiceClassMajor majorDeviceClass:(BluetoothDeviceClassMajor)inMajorDeviceClass minorDeviceClass:(BluetoothDeviceClassMinor)inMinorDeviceClass;
inServiceClassMajor
Set the major service class for found devices. Set to kBluetoothServiceClassMajorAny for all devices. See BluetoothAssignedNumbers.h for possible values.
inMajorDeviceClass
Set the major device class for found devices. Set to kBluetoothDeviceClassMajorAny for all devices. See BluetoothAssignedNumbers.h for possible values.
inMinorDeviceClass
Set the minor device class for found devices. Set to kBluetoothDeviceClassMinorAny for all devices. See BluetoothAssignedNumbers.h for possible values.
The default inquiry object will search for all types of devices. If you wish to find only keyboards, for example, you might use this method like this:
[myInquiryObject setSearchCriteria:kBluetoothServiceClassMajorAny majorDeviceClass:kBluetoothDeviceClassMajorPeripheral minorDeviceClass:kBluetoothDeviceClassMinorPeripheral1Keyboard];
However, we recommend only using this if you are certain of the device class you are looking for, as some devices may report a different/unexpected device class, and the search may miss the device you are interested in.
setUpdateNewDeviceNames: |
Sets whether or not the inquiry object will retrieve the names of devices found during the search.
- (void)setUpdateNewDeviceNames:(BOOL)inValue;
inValue
Pass TRUE if names are to be updated, otherwise pass FALSE.
The default value for the inquiry object is TRUE, unless this method is used to change it.
start |
Tells inquiry object to begin the inquiry and name updating process, if specified.
- (IOReturn)start;
Returns kIOReturnSuccess if start was successful. Returns kIOReturnBusy if the object is already in process. May return other IOReturn values, as appropriate.
Calling start multiple times in rapid succession or back-to-back will probably not produce the intended results. Inquiries are throttled if they are called too quickly in succession.
stop |
Halts the inquiry object. Could either stop the search for new devices, or the updating of found device names.
- (IOReturn)stop;
Returns kIOReturnSuccess if the inquiry is successfully stopped. Returns kIOReturnNotPermitted if the inquiry object is already stopped. May return other IOReturn values, as appropriate.
updateNewDeviceNames |
Returns whether or the inquiry object will perform remote name requests on found devices.
- (BOOL)updateNewDeviceNames;
TRUE if the inquiry will get device name for found objects, FALSE if not.
|
Last Updated: 2008-08-07