using iPhone dock connecter to light a LED? - iphone

Is there a way to get output through the iPhone's dock connecter.
For example: i have a regular LED and i want to make an application that turns this LED on when pressed on a certain button.
Does an API exists, which enables me to transmit something out through some part of the dock connector?

To get the details of the dock connector, you have to sign up for the hardware developers license through http://developer.apple.com/programs/mfi/

Unless you are a corporation enrolled in the MFi program, you might have better luck using the audio jack to get (modulated) control signals out from a stock iPhone.

Related

Connect CBPeripheral so that macOS MIDI Studio recognises the connection

This is probably in a book but I don't know which.
I'm trying to connect a BLE MIDI CBPeripheral so that it becomes connected on MIDI Studio, i.e. usable as a MIDI source/sink by all the apps in the system. Although I get the indication that it is connected, it doesn't appear so in MIDI Studio or other apps. I know it's possible because Korg's Bluetooth MIDI Connect is able to do it. But it does seem to open the system's 'Bluetooth Configuration' window, so maybe there's no programmatic way of doing it.
I'm creating a CBCentralManager and keeping a reference to it;
When state is poweredOn I do a scanForPeripherals;
When I get a didDiscover:CBPeripheral, I keep the reference to the CBPeripheral and call central.connect(peripheral...);
I get a didConnect:CBPeripheral and keep my app running, but it doesn't appear as connected to anyone else.
I know 'connected' means connected to my app. But I'd really like to have it available for others.
If this is a purposefully Apple-designed limitation, does anyone know what the purpose is?
If not, is there some CoreMIDI API I can use?
Maybe I am missing something, but the apple guide gives you a hint on how to connect a BLE MIDI device to your Mac:
In the Audio MIDI Setup app on your Mac, choose Window > Show MIDI
Studio.
In the MIDI Studio window, click the Configure Bluetooth button in
the toolbar.
Set your Bluetooth MIDI peripheral in pairing mode.
Select the peripheral in the list of devices, then click Connect.
There is no need for custom coding. It should be possible for multiple apps to use the same BLE device, but the apps need to connect to it. BLE devices usually don't show up in the system settings but this might be different for MIDI devices.
For items connected by USB, it does keep the connection information. Once you use the Bluetooth Configuration screen and select the devices, do they appear on the MIDI Studio screen. You may have to create a new External Device.
I think it's like using a new printer. You have to add the new printer using manual methods. However, you can print to it using code.
I have an Objective-C program in the BRossTools directory of the GitHub repository https://github.com/BradleyRoss/ObjectiveC-Examples . If you run the program, it might be interesting to see what happens when you use "Show Configuration" and "Show Sources/Destinations"

Make use of external hardware Music controls in my custom App

I'm looking for a way to detect the buttons pressed of external music control buttons, I have integrated in my car via bluetooth. Is it possible to make use of them in my App for something else that playing and stoping music?
Thanks a lot!
Markus
Those controls are probably talking to your iPhone using the remote control lingo, part of iAP (iPod Accessory Protocol). For documentation on this, you need to join Apple's MFi program, which is a separate account to a normal developer account and quite a bit more difficult to get approved for.
I'm not certain whether it's possible to get your application to talk to those devices, as you need to specifically enable application communication on the device itself and there's an authentication scheme you need to handle.

Detect Bluetooth answer/end-call button on iPhone

Is it possible to detect and respond to the answer/end-call button presses from an HFP Bluetooth device on iOS? Has anyone seen this? Where should I look for answers? I understand one could get access to lower level bluetooth if you register for the device manufacturer (MFI) program but I'm hoping I don't have to dive this deep. I also know that you can respond to AVRCP commands but I am not wanting to use this option. Can anyone help?
UIResponder has a -remoteControlReceivedWithEvent: method that you can use to receive events from external devices, possibly including Bluetooth headsets. From the docs:
Remote-control events originate as commands from external accessories, including headsets. An application responds to these commands by controlling audio or video media presented to the user. The receiving responder object should examine the subtype of event to determine the intended command—for example, play (UIEventSubtypeRemoteControlPlay)—and then proceed accordingly.
To allow delivery of remote-control events, you must call the beginReceivingRemoteControlEvents method of UIApplication; to turn off delivery of remote-control events, call endReceivingRemoteControlEvents.
It’s not clear whether the answer/end button on a headset is considered equivalent to the play/pause button on, say, the earbuds’ remote, but this might be worth a try.
Sadly, there are no available bluetooth public APIs for developers, so no way to get that access in the conventional means.
As of my research, some person received some event from their bleu-tooth devices via "remoteControlReceivedWithEvent" but not all of them! Some are receiving none! And very few are receiving all of them!
I also tried Core Bluetooth but it only supports LEB (Low Energy Bluetooth devices)!
https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothOverview/CoreBluetoothOverview.html#//apple_ref/doc/uid/TP40013257-CH2-SW1
Also, some posts suggest it is possible to use Classic bleutooth instead of "Low Energy":
How to use bluetooth classic instead of le
But it has limitation as well (the post is taking about "MFi accessory"! MFi is it for "made for iphone" ?!?!?!)
from the post above:
"A non-LE Bluetooth device needs to be MFi-approved to be used with the External Accessory framework (it needs to use a specific Apple chip and a proprietary communication protocol). You won't be able to build applications to access this device unless it either uses the more open Bluetooth LE or has this chip in it for standard Bluetooth. There might be ways to do this via jailbreak, but pretty much everyone I know has moved over to Bluetooth LE." !
more post: Connecting to a Bluetooth device from iOS, no MFi
Regards.

How to launch an iphone app when an external accessory is either paired over BT or plugged into dock connector

I have researched this to death online and cannot find anything regarding auto launching an iphone app when an external accessory is either paired using BT or plugged into the dock connector.
We are an MFi developer with a BT accessory and application that we would like to launch when paired. We have the Info.plist containing our protocols and the device containing the correct protocol all working and communicating. The application works well with our BT device, however I would like to see the app launch when paired.
I have seen this before with accessories plugged into the connector and would live to know how that is accomplished.
http://www.metacafe.com/watch/5772611/ces_2011_withings/
Check at 3:15 in the video.
Does iPhone just have that ability for dock connected items to auto start?
I know that the External Accessory framework registers the protocol with the iPhone when the app is installed. This is how the iPhone/iPod knows to take you to the apple store when you connect a BT (or connector) device and you don't have an app for your connected devices protocol.
I don't understand why the app does not launch when paired, I would think this would be a no brainer. Can someone please shed some light on this topic. The best I found is from Apples docs:
Applications that are able to communicate with an external accessory should declare the ?protocols they support in their Info.plist file. Declaring support for specific protocols lets the system know that your application can be launched when that accessory is connected. If no application supports the connected accessory, the system may choose to launch the App Store and point out applications that do."
I cannot understand the meaning by "may choose to launch", does this mean is also chooses to launch? Please help.
The manufacturer of the device needs to include support for this feature at the firmware level. The details of this process are currently confidential by way of the MFi (Made For iPhone/iPod) non disclosure agreement, so unfortunately that is all the detail I can provide. Good luck!

iOS app with hardware integration

I want to develop an iOS app that uses an external hardware plug-in, kind of like Square https://squareup.com. However I was unable to find any references in Apple's documentation. Can someone point me to the right direction?
If you want to use the iPod connector to connect to your hardware, the only option is the External Accessory framework. Be advised that you must be a registered accessory developer (more expensive than the standard developer license).
I believe Square uses the audio input (others may correct me), an ingenious hack that doesn't require use of the iPod connector. If your hardware can operate over (analog) audio in/out, that might be an option to consider.
This book might help you: Building iPhone OS Accessories: Use the iPhone Accessories API to Control and Monitor Devices
In order to develop hardware accessories, you must be a member of Apple's MFi program. Despite what the user above stated, it doesn't cost anything. But it does require a lot more work than becoming an app developer.
Accessories don't necessarily need to go through the MFi process if they are NOT over 30pin connector OR bluetooth (ie, the Square connecter goes through the headphone port, or any WiFi accessories).