I am trying to emulate a HandsFree device from Mac OS X.
- I advertise correctly my SDP service as Handsfree
- I can pair my Android phone to my computer which is seen as "HandsFree" device
- I can send a couple of AT Commands (AT+BRST, CIND, CMER) to establish a service level connection
- I then install an Audio Driver to route all incoming/outgoing sound to/from the device
Unfortunately, it seems that the SCO channel is never opened. My android phone still emits sound (i.e.: when pressing dial pad) on its own speaker.
When going in the sound preferences of Mac OS X, I can see my device as an input/output device but the sound level never change.
Here is my code :
(void)rfcommChannelData:(IOBluetoothRFCOMMChannel*)rfcommChannel data:(void *)dataPointer length:(size_t)dataLength
{
... STATE MACHINE GOES HERE and SEND AT COMMANDS ...
... AT CMER OK RECEIVED ...
ret = IOBluetoothAddSCOAudioDevice([[rfcommChannel getDevice] getDeviceRef], NULL);
if (ret != kIOReturnSuccess ){
IOBluetoothRemoveSCOAudioDevice([[rfcommChannel getDevice] getDeviceRef]);
NSLog(@"%@", @"Deleting previously audio device");
ret = IOBluetoothAddSCOAudioDevice([[rfcommChannel getDevice] getDeviceRef], NULL);
if (ret != kIOReturnSuccess) {
NSLog(@"%@", @"Can't install Audio Driver");
}
}
Any idea on why the Audio Driver is installed and reported by the system but can't open an SCO connection ?