3

I am trying to emulate a HandsFree device from Mac OS X.

  1. I advertise correctly my SDP service as Handsfree
  2. I can pair my Android phone to my computer which is seen as "HandsFree" device
  3. I can send a couple of AT Commands (AT+BRST, CIND, CMER) to establish a service level connection
  4. 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 ?

kiddouk
  • 2,487
  • 2
  • 17
  • 19
  • Hey, could you solve the problem? Because I need a similar functionality in my app. – Daniel Dec 05 '12 at 21:35
  • Sorry for the laate answer. No I couldn't. It looks like the API call have changed and I didn't had much time to dig further in the problem. I wanted to make a Mac App that can act as a headset, I could pair properly but never got the audio channels up and running. :-/ – kiddouk Jan 17 '13 at 08:11

0 Answers0