5

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.

uerceg
  • 4,637
  • 6
  • 45
  • 63

2 Answers2

5

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

javieralog
  • 1,337
  • 9
  • 10
  • Thank you for quick answer. I read that only iPhone 4S supports Bluetooth 4.0 LE compliant devices and previous versions don't. Is that true? And one more question: If any device is not Bluetooth 4.0 LE compliant, are you saying that it is IMPOSSIBLE to control it with ANY iPhone version in way I want? Thanks in advance. – uerceg Jul 03 '12 at 11:38
  • true for the iPhone part. Not sure if true for iPad; I think new iPad is BT4.0 with LE mode – javieralog Jul 03 '12 at 11:39
  • are you saying that it is IMPOSSIBLE to control it with ANY iPhone version in way I want? Yes outside the MFi program – javieralog Jul 03 '12 at 11:40
  • Thank you very much javieralog. Can you maybe in 2 sentences clarify to me what MFi really is? Is that program where members get some specific framework to interact with non-Bluetooth 4.0 LE devices or is that program which states how to build Bluetooth device in order to interact with Apple device (iPhone, iPad, or what ever)? – uerceg Jul 03 '12 at 11:44
  • MFi is covered with NDAs, so there is no much publicly available info. But I think both are true: there may be a Framework for it, and you should design your BT device to connect with the iOS device. – javieralog Jul 03 '12 at 11:46
  • Thank you once more for answers. I would give you +1, but I don't have reputation to do such thing. If anyone read this conversation on this first reply, I would like to hear answer to my last question (if we suppose that device which I am trying to control via iPhone is Bluetooth 4.0 LE compliant). – uerceg Jul 03 '12 at 11:51
  • MFI enabled devices use External Accessory framework. BTLE devices use Core Bluetooth, both use raw commands and there is no framework for each profile (just documented commands if a known profile is adopted). – Martin Jul 03 '12 at 12:09
  • Thank you Martin. I am reading now all kinds of posts online and I must ask again: If target non-Apple Bluetooth device supports some Bluetooth profile that iPhone also supports, it is STILL NOT POSSIBLE for iPhone to interact with that device UNLESS that device is Bluetooth 4.0 LE compliant? – uerceg Jul 03 '12 at 12:27
  • Not without using the MFI program. – Martin Jul 03 '12 at 13:11
  • Yes, thank you once more. I think we clarified this part with non-BT4.0 LE and MFi. Now if anyone knows how to interact with target device which is BT4.0 LE compliant (answer to my 4th question), I'd be very grateful to hear the answer. – uerceg Jul 03 '12 at 13:29
  • Using the Core Bluetooth framework. have a look at the most recent set of WWDC videos. 2 hours worth of tutorials in there :) – Martin Jul 03 '12 at 15:48
  • Martin, can you, please, give me the link to those videos you are referring to? Many thanks in advance. (edit #1: I have found Core Bluetooth 101 video at: https://developer.apple.com/videos/wwdc/2012/ and also presentation slides at http://adcdownload.apple.com//wwdc_2012/wwdc_2012_session_pdfs/session_703__core_bluetooth_101.pdf If I missed something, please, let me know. Thanks.) – uerceg Jul 09 '12 at 14:01
  • I am creating a app which will control my video/DVD player. I know I can control it using Core Blue API. But is it possible on Ipad 2 or some older iphones in ios 7? – Yogesh Kulkarni Mar 27 '14 at 05:43
0

Most likely you shall not be able to do it even if your car CD player has BLE 4.0.

With Core Bluetooth devices act as "Central" (client) or "Peripheral" (server), the peripheral "has data" and expose services with characteristics (variables). The central (client) reads data from the peripheral or subscribe for notifications.

Your only chance is to connect to the CD player as peripheral (server) and your iPhone being the central (client). In this case the CD player must expose services that allow you to control it. To be honest I do not know how this can be done, since the central (the iPhone) will read data and receive notifications from the peripheral, not vice versa.

Reversing roles, implementing iPhone as peripheral makes sense, but there is no predefined Bluetooth LE service for remote control, so your car CD player does not know what service to expect from you. It might work using HID service (Human Interface Device), used in general for keyboards and mouse, but according to this post the HID is forbidden by Apple on iOS.

launic
  • 51
  • 4