BluetoothManager Framework Notifications List

I want to get all the notifications of the BluetoothManager private framework. I've been searching but i only have found two (BluetoothAvailabilityChangedNotification and BluetoothDeviceDiscoveredNotification). I'm interesting in a notification that reports if iphone connected/disconnected to a device. If anyone could get me a list of all notifications i will be appreciated.

Upvotes: 2

Views: 974

Answers (2)

Bushrod
Bushrod

Reputation: 417

I don't have a full list, but these are the ones you were interested in:

BluetoothDeviceConnectFailedNotification
BluetoothDeviceConnectSuccessNotification
BluetoothDeviceDisconnectFailedNotification // haven't confirmed this one
BluetoothDeviceDisconnectSuccessNotification

Here are some others:

BluetoothConnectabilityChangedNotification // fires when bluetooth is turned on/off
BluetoothAvailabilityChangedNotification // seems to fire once at app start)
BluetoothPowerChangedNotification
BluetoothDeviceDiscoveredNotification
BluetoothDeviceRemovedNotification
BluetoothPairingUserNumericComparisionNotification
BluetoothPairingPINResultSuccessNotification

Upvotes: 2

Michael Dorner
Michael Dorner

Reputation: 20145

Add before you call [BluetoothManager sharedInstance]:

CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(),
                                    NULL,
                                    bluetoothCallback,
                                    NULL,
                                    NULL,
                                    CFNotificationSuspensionBehaviorDeliverImmediately);

and somewhere in this implementation the method void bluetoothCallback:

void bluetoothCallback (CFNotificationCenterRef center,
                 void *observer,
                 CFStringRef name,
                 const void *object,
                 CFDictionaryRef userInfo)
{
    if (CFStringGetCharacterAtIndex(name, 0) == 'B') { // stupid way to filter for only 'B'luetooth notifications
        NSLog(@"%@", name);
    }
}

Your console log shows you all bluetooth notifications now.

Upvotes: 1

Related Questions