use autorelease pool when calling bluetooth manager

This commit is contained in:
matthias.ringwald 2010-01-23 22:43:42 +00:00
parent d59f499a58
commit 23bf349214
2 changed files with 9 additions and 1 deletions

View File

@ -95,7 +95,7 @@ if test "x$target" = xiphone; then
CPPFLAGS="$CPPFLAGS -I$SDK_PATH/usr/lib/gcc/arm-apple-darwin9/$GCC_VERSION/include"
CPPFLAGS="$CPPFLAGS -F$SDK_PATH/System/Library/Frameworks"
LDFLAGS="$LDFLAGS -F$SDK_PATH/System/Library/Frameworks"
LDFLAGS="$LDFLAGS -L$SDK_PATH/usr/lib -framework CoreFoundation -framework UIKit"
LDFLAGS="$LDFLAGS -L$SDK_PATH/usr/lib -framework Foundation -framework CoreFoundation -framework UIKit"
LDFLAGS="$LDFLAGS -L$SDK_PATH/System/Library/Frameworks/IOKit.framework/Versions/A"
LDFLAGS="$LDFLAGS $SDK_PATH/System/Library/PrivateFrameworks/BluetoothManager.framework/BluetoothManager"
LDFLAGS="$LDFLAGS -lIOkit -lobjc"

View File

@ -90,15 +90,21 @@ kern_return_t IOObjectRelease(mach_port_t object);
#define kKeyBTNetwork CFSTR("bluetooth-network")
int iphone_system_bt_enabled(){
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
if ([[BluetoothManager sharedInstance] enabled]) {
return 1;
} else {
return 0;
}
[pool release];
}
void iphone_system_bt_set_enabled(int enabled)
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
/* Get a copy of the global bluetooth server */
BluetoothManager *bm = [BluetoothManager sharedInstance];
if ( [bm enabled] && enabled) return;
@ -119,6 +125,8 @@ void iphone_system_bt_set_enabled(int enabled)
}
/* Synchronize to preferences, e.g. write to disk, bluetooth settings */
CFPreferencesAppSynchronize(kAppNetwork);
[pool release];
}
#endif