4

This might be a duplicate question, but all previous are asked more than one year ago and does not have helpful answer.

External Accessory Framework bluetooth pair. connectedAccessories every time count 0 iOS External Accessory Framework: how to get a protocol string for certain MFI device https://apple.stackexchange.com/questions/45398/is-it-possible-to-get-the-api-details-and-protocol-details-from-an-mfi-certified

I want to use external accessory framework to connect my iOS app with mfi devices. I run EADemo app but it requires Supported external accessory protocols strings. I don't know from where to get this string and what this strings should be. Please help what string should I use to atleast check the sample app. Currently I have iPhones, iPods, bluetooth speakers(bose), and headset.

Please help, I am stuck here.

Thanks in advance!

Any suggestions would be highly appreciated.

Edit 1: After reading the apple documentation https://developer.apple.com/library/content/featuredarticles/ExternalAccessoryPT/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009498-SW1

it says if trying to communicate with specific accessory, it is required to know the protocol string from manufacturers in order to communicate with it. but what does this line return:

NSArray *accessories = [[EAAccessoryManager sharedAccessoryManager]
                                   connectedAccessories];

I have connected 2-3 speakers via bluetooth from my phone, so should the above line give me details of connected accessory even if I didn't declare any protocol strings in info.plist as apple says for communication its important to know the protocol but can we see the devices in some list. I am getting 0 elements.

From apple docs:

"This class contains an array of already connected accessory objects that you can enumerate to see if there is one your app supports." 

please suggest.

can anyone tell any example accessory name which I should use to check the externalframework working(means giving the accessory as an element)

Gypsa
  • 11,230
  • 6
  • 44
  • 82
  • You can use the `EAAccessoryManager` and enumerate the `protocolStrings` of each devices if you know the special protocols it has. For simply Speakers, it should itself register to a specific and known Bluetooth Profile (HID, etc.), and you shouldn't need one. – Larme Aug 01 '17 at 10:04
  • @Larne it means for speaker I need not any string, but still the array count is 0. – Gypsa Aug 02 '17 at 01:33
  • NSArray *accessories = [[EAAccessoryManager sharedAccessoryManager] connectedAccessories]; for (EAAccessory *obj in accessories) { NSLog(@"Found accessory named: %@", obj.name); } – Gypsa Aug 02 '17 at 02:06
  • @Larme I edited the question with more details, please have a look and suggest. – Gypsa Aug 02 '17 at 06:03

0 Answers0