The application I'm working with is used to connect phones via Bluetooth to a computer and control the phone that way. I've come across an issue when it comes to pairing devices.
The program uses wxWidgets with its own UI (It's made for people with disabilities) and so I don't want to use the native Mac controls for pairing a device with the computer. The way I'm doing things now are as follows:
I have a phone manager class is called from the UI. The phone manager implements the delegate methods:
When a user wants to pair a device (A bluetooth inquiry has already been performed at that point) this function is called:
Basically I start a pairing attempt with the phone manager as delegate (The stringToAddress function simply converts a std::string send from the UI to a BluetoothDeviceAdress).
When the user has to confirm the pairing PIN-code, the function devicePairingUserConfirmationRequest is called which in turn calls a function in the UI that displays the PIN-code and asks the user if the code on the monitor matches the one on the phone. When the accepts the PIN, the UI calls a function pinIsCorrect (written by myself) in the phone manager which in turn calls the function replyUserConfirmation as is required according to the documentation. When the pin is accepted, the pairing finishes and the phone can now be connected to.
This all works as it should but for one issue. When I show the dialog asking the user to accept or reject the PIN, the native Mac dialog suddenly also shows up and asks the same question. Why is this and is there a way I can make it not show up?
The documentation for IOBluetoothDevicePair says:
So as I understand it, I should be able to do this pairing without any standard Mac panels showing at all. For some reason the OS X PIN confirmation dialog is still shown. If anyone can give me a hint on how to make it not show, it would be appreciated.
Update: Added a picture to make things clearer
(The text is in Swedish if anyone is wondering)
As you can see, both the OS X confirmation dialog and my own dialog is showing. Now how do I NOT show the OS X one?
The program uses wxWidgets with its own UI (It's made for people with disabilities) and so I don't want to use the native Mac controls for pairing a device with the computer. The way I'm doing things now are as follows:
I have a phone manager class is called from the UI. The phone manager implements the delegate methods:
Code:
- (void) devicePairingStarted:(id)sender;
- (void) devicePairingUserConfirmationRequest:(id)sender numericValue:(BluetoothNumericValue)numericValue;
- (void) devicePairingFinished:(id)sender error:(IOReturn)error;
When a user wants to pair a device (A bluetooth inquiry has already been performed at that point) this function is called:
Code:
[SIZE="2"]- (bool) pairWithDevice:(std::string)device_address_string
{
BluetoothDeviceAddress btaddr = [self stringToAddress:device_address_string];
m_pairing = [IOBluetoothDevicePair pairWithDevice:[IOBluetoothDevice deviceWithAddress:&btaddr]];
[m_pairing setDelegate:self];
[m_pairing replyUserConfirmation:true];
if([m_pairing start] == kIOReturnSuccess)
{
return true;
}
else
{
return false;
}
}
[/SIZE]
Basically I start a pairing attempt with the phone manager as delegate (The stringToAddress function simply converts a std::string send from the UI to a BluetoothDeviceAdress).
When the user has to confirm the pairing PIN-code, the function devicePairingUserConfirmationRequest is called which in turn calls a function in the UI that displays the PIN-code and asks the user if the code on the monitor matches the one on the phone. When the accepts the PIN, the UI calls a function pinIsCorrect (written by myself) in the phone manager which in turn calls the function replyUserConfirmation as is required according to the documentation. When the pin is accepted, the pairing finishes and the phone can now be connected to.
This all works as it should but for one issue. When I show the dialog asking the user to accept or reject the PIN, the native Mac dialog suddenly also shows up and asks the same question. Why is this and is there a way I can make it not show up?
The documentation for IOBluetoothDevicePair says:
Use the IOBluetoothDevicePair object to attempt to pair with any Bluetooth device. Once -start is invoked on it, progress is returned to the delegate via the messages defined below. This object enables you to pair with devices within your application without having to use the standard panels provided by the IOBluetoothUI framework, allowing you to write custom UI to select devices, and still handle the ability to perform device pairings.
So as I understand it, I should be able to do this pairing without any standard Mac panels showing at all. For some reason the OS X PIN confirmation dialog is still shown. If anyone can give me a hint on how to make it not show, it would be appreciated.
Update: Added a picture to make things clearer

(The text is in Swedish if anyone is wondering)
As you can see, both the OS X confirmation dialog and my own dialog is showing. Now how do I NOT show the OS X one?
Last edited: