mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-23 19:20:51 +00:00
use autorelease pool when calling bluetooth manager
This commit is contained in:
parent
d59f499a58
commit
23bf349214
@ -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"
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user