Re: IOBluetoothDeviceSelectorController and IOBluetoothDeviceSearchAttributes...
Here is the code I use : + (NSArray*)devicesWithService:(BluetoothClassOfDevice)service { IOBluetoothDevice *currentDevice; NSArray *devices = [ IOBluetoothDevice pairedDevices]; NSEnumerator *e = [devices objectEnumerator ]; NSMutableArray *result = [NSMutableArray array]; while (currentDevice = [ e nextObject ]) { //10100100000001000000100 T610 //00000000010010110000000 MX900 //NSLog(@"%i : %@",[ device getClassOfDevice ], [ device getName ]); if ([ currentDevice getClassOfDevice ] & service) [result addObject: [NSDictionary dictionaryWithObjectsAndKeys:[currentDevice getName],@"name",[currentDevice getAddressString],@"address",nil]]; } return [[result copy]autorelease]; } I do not use standard bluetooth selection dialog, beacause I just need telephones, but as far as I know, you need the same :-) Pass it 0x400000 to get phone class device Le 13 juil. 04, ` 11:21, Aurilien Hugeli a icrit :
hi !
Apple's BT team is really helpful (as i experienced myself 2 weeks ago
is SF ;-) ) so i have another question for them (or any other list
member !)
i would like my BT device selector to filter only phone/telephony
devices.
i've read the doc (and the headers this time !) and found that i should
use something like :
deviceSelector = [[IOBluetoothDeviceSelectorController alloc] init];
[deviceSelector setSearchAttributes:<#(const
IOBluetoothDeviceSearchAttributes *)searchAttributes#>];
[deviceSelector runModal];
// test the return of runModal
[deviceSelector getResults];
The problem for me is the searchAttributes structure... i'm not really
familiar with low level stuff and must admit i'm lost...
struct IOBluetoothDeviceSearchAttributes
{
IOBluetoothDeviceSearchOptions options; // Options.
IOItemCount maxResults; // Maximum number of results you
desire. 0 means infinite.
IOItemCount deviceAttributeCount;
IOBluetoothDeviceSearchDeviceAttributes *attributeList;
};
I don't really care of the options, maxResults. Only the attributeList
is important :
struct IOBluetoothDeviceSearchDeviceAttributes
{
BluetoothDeviceAddress address; // 00 08 22 44 AB 56, etc.
BluetoothDeviceName name; // "Al Yankovic's Phone", etc.
BluetoothServiceClassMajor serviceClassMajor; // Networking,
Rendering, etc.
BluetoothDeviceClassMajor deviceClassMajor; // Computer, Phone,
Audio, etc.
BluetoothDeviceClassMinor deviceClassMinor; // Desktop, cordless,
headset, etc.
};
with my current testing, i only need to set the deviceClassMajor and
deviceClassClassMinor to specific values to discover BT enabled
cellular phones (the serviceClassMajor seems to differ with each
brand...)
can i create my IOBluetoothDeviceSearchAttributes with NULL for each
members of the structure (except attributeList of course) ? or 0 ? (the
headers comments are not really clear on this point)
how to create my IOBluetoothDeviceSearchDeviceAttributes struct ??
any address, any name, how to get that ? i don't see any
kBluetoothServiceAddressAny, kBluetoothServiceNameAny ...
any serviceClassMajor (kBluetoothServiceClassMajorAny) would be ok, i
just need specific deviceClassMajor/Minor...
can you help me ?
thanks for all your help !
_______________________________________________
bluetooth-dev mailing list | bluetooth-dev@lists.apple.com
Help/Unsubscribe/Archives:
Do not post admin requests to the list. They will be ignored.
-- Yann Bizeul - yann at tynsoe.org http://projects.tynsoe.org/ _______________________________________________ bluetooth-dev mailing list | bluetooth-dev@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/bluetooth-dev Do not post admin requests to the list. They will be ignored.
participants (1)
-
Yann Bizeul