Re: deprecated carbon calls?
Re: deprecated carbon calls?
- Subject: Re: deprecated carbon calls?
- From: "Daniel Birns" <email@hidden>
- Date: Tue, 27 Mar 2007 20:51:12 -0700
I found this wonderfully useful posting in the maillist from Bubba
Giles, appended, which works and which we're basing our carbon
bluetooth app on.
However, the compiler says that virtually all the calls are deprecated. I can't find any information on this.
Does anyone know about these being deprecated and what should be used instead?
Also, the note appended seems to indicate the cocoa is more reliable.
One
possibility is that I write the bluetooth code in cocoa for
reliability. (Geez what a lot of work that would be).
I'd really prefer to stay in carbon, but I'm concerned about the deprecated messages.
Thanks.
From: Bubba Giles <email@hidden>
Date: Fri, 1 Dec 2006 14:25:36 -0800
well, there are a couple of issues here:
1.
we screwed up the C API for 10.4 for inquiries, and omitted the
extremely important Start/Stop methods. Without calling Start(), the
inquiry never actually gets off the ground. We fixed this problem in
10.4.3 or later. The obj-c API does not have this issue.
2. the
inquiry API doesn't cause an event source to get set up, so the runloop
will immediately exit. Calling IOBluetoothLocalDeviceAvailable()
will rectify that problem.
3. extra note - Bluetooth activity must be done on the main thread,
so make sure you don't take this code and go crazy with threads, or
things will break. Make sure you perform all Bluetooth calls back on
the main thread.
I've attached a sample project and source code that will do inquiries on 10.4.3 or later using the C API.
jason
=======================================================
#include <CoreFoundation/CoreFoundation.h>
#include <IOBluetooth/IOBluetoothUserLib.h>
//===========================================================================================================================
// DeviceNamePrinterFunction
//===========================================================================================================================
void DeviceNamePrinterFunction( const void *value, void *context )
{
IOBluetoothDeviceRef deviceRef = (IOBluetoothDeviceRef) value;
if( deviceRef )
{
CFShow( IOBluetoothDeviceGetNameOrAddress( deviceRef ) );
}
}
[...]
_______________________________________________
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