views:

31

answers:

2

I need to detect an external hardware which is connected to the iPhone. Let say when the camera is running in our application and user plugss an external hardware device which is a camera and default behavior is propagated to the external hardware. In that scenarios how does the program know that the external hardware is plugged? Simply its detecting a external device notification as I suppose. How does it work.

Update: Also note that once I do that I need to interact with that camera. Let say if its a 2nd generation iPod how will I do that. Please help me.

A: 

As hotpaw2 and Aaron indicated, you can only detect this connection if the hardware is compliant with Apple's Made for iPod program and it publishes a protocol for interaction through the External Accessories framework.

If that hardware meets those specifications, you can listen for the appropriate notifications: EAAccessoryDidConnectNotification and EAAccessoryDidDisconnectNotification.

I highly recommend watching the WWDC 2010 video session 201 - "Developing Applications that work with iPhone OS Accessories" and reading the above-linked documentation. Communication with these devices is reasonably simple to do, but it's up to the hardware vendor to make them easy to interact with. There is no generic protocol for handling data from an accessory that is a camera, so you'll need to work with the vendor to understand the data stream it provides.

Brad Larson