Re: Welcome to the "Bluetooth-dev" mailing list
Re: Welcome to the "Bluetooth-dev" mailing list
- Subject: Re: Welcome to the "Bluetooth-dev" mailing list
- From: Bubba Giles <email@hidden>
- Date: Fri, 19 Aug 2005 15:37:19 -0700
> Hey Everyone,
> I am trying to use the deviceinquiry class from the bluetooth
> framework so I can discover devices and the reason I don't use the GUI
> is because I need to be able to select multiple devices. So my code is
> below but I am not too sure if it is the right way of using the class.
> When I go through in the debugger nothing seems to change or be set
> with the palmSizedDevice variable. Also I am not too sure on how to
> check if the inquiry has completed. The api says I should use the
> delegate methods and well I am not even sure that everything is setup
> properly. I have tried looking for examples on this but I can't find
> anything. Kinda frustrating. But below is my code and I am pretty sure
> I am missing something.
>
> IOBluetoothDeviceInquiry * palmSizedDevices;
> id discoverDelegate;
> IOReturn isFoundDevices;
>
> palmSizedDevices = [IOBluetoothDeviceInquiry inquiryWithDelegate:
> discoverDelegate];
>
> //initilize the search object
> palmSizedDevices = [palmSizedDevices initWithDelegate: discoverDelegate];
>
> //start search
> isFoundDevices = [palmSizedDevices start];
Hi Landon,
You are reinitializing the object, with the call to initWithDelegate, which
is not good. So just do this first:
[IOBluetoothDeviceInquiry inquiryWithDelegate:discoverDelegate];
And don't call initWithDelegate, since there is no reason to do this second
step, the above call implies the object is init'ed with your delegate. If
you make this change, however, make sure you retain the inquiry, as the
+inquiryWithDelegate class method will return an auto-released object, and
thus won't call your delegate object because it would be gone.
Once you call -start and it is successful (return value is 0), your delegate
methods should start being called as things are found. You should at least
get the
- (void) deviceInquiryStarted:(IOBluetoothDeviceInquiry*)sender
delegate method called if you implemented it in your delegate object. You
should get found devices returned to you on this delegate method:
- (void) deviceInquiryDeviceFound:(IOBluetoothDeviceInquiry*)sender
device:(IOBluetoothDevice*)device
Also, it never hurts to run the packet logger to see if the hardware is
actually getting the inquiry request.
Well, anyway, that should get you started. If you have further questions,
just let us know.
Jason
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden