Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Control Bluetooth audio device with iPhone

I am looking to write application for iPhone which will be able to control radio and CD player in car. Radio and player have Bluetooth connection available.

I started this question in order to obtain all informations I need for this one one place. I have few questions, but if you find anything I didn't ask important for me to start developing this application, please, let me know.

I have read about AVRCP profile and Bluetooth device in car supports AVRCP 1.3, which is good enough for me, having in mind controls which can be performed in that protocol version.

I read a lot about people saying "Apple device can only interact with each other", "Apple device can't be connected via Bluetooth to non-Apple device", "MFi program is obligatory if you want to do that", "MFi is not needed", etc. My first question is:

1)Is it even possible to pair iPhone (4, 4S) with radio and CD player in car via Bluetooth and control radio stations and music with any iPhone version? If yes, what are the limitations for making this kind of successful Bluetooth connection?

There is also very few informations about roles in which iPhone can work. For AVRCP there are two kind of roles: controller and target role. By reading this paper: https://developer.apple.com/hardwaredrivers/BluetoothDesignGuidelines.pdf I didn't find answer to my second question:

2) Can iPhone act as a controller and issue all available commands stated in AVRCP 1.3 to target device (radio and CD player)?

I would also like to know about available frameworks for this particular problem. I know there are several of them, but if anyone recognizes the right one for my problem, I'd like to know:

3) Which framework for interacting with target device should I use?

From developer point of view, I am also interested in available APIs for interacting with connected Bluetooth device. Since I am making my own application and assigning actions to buttons, inside of methods assigned to buttons I need to perform message sending to target device. So my next question is:

4) Does anyone know how if there's a way to send commands to target device (start/stop/pause/forward/backward, etc) as part of some API provided in XCode, or each message which I attend to send via Bluetooth to target device I need to make according to protocol documentation (make entire message (header, body, command part, etc) by myself)?

AVRCP was my thought for accomplishing this application. If I am wrong, please let me know. Bluetooth has different profiles and when message is sent from one device, as far as I understand, profile itself handles message and interprets it and delivers to target device so target device can understand it. I do not understand how a message sent from iPhone to target Bluetooth device is handled from the moment I send it from my Objective-C (or C) code. That's the main doubt I have and it is related with question 4 - do I need to make raw messages in correct format in order to send AVRCP commands to device or I can use some API which will recognize those messages as AVRCP (or any other kind) and deliver it to target device?

This last question (if I suppose there is any kind of positive answer to all previous) concerns me the most from developer point of view. So, if anyone had maybe experience with this specific problem, I would appreciate any kind of answer or advice.

I am really looking forward to your answers. I hope that constructive and useful discussion will start on this topic and that lots of useful informations will be written.

Best regards.

like image 757
uerceg Avatar asked Jul 03 '12 11:07

uerceg


1 Answers

You can do it using CoreBluetooth if your device (CD Player) is Bluetooth 4.0 LE compliant

like image 119
javieralog Avatar answered Sep 30 '22 09:09

javieralog