How to communicate with USB protocol for an MFI accessory - ios

I have bought an iSpread (http://www.photofast.tw/iFlashDrive2013_1.html?pid=132) which allows me to put files on it via USB on my PC. Now those files on the USB I would like to transfer to my iPad. I know that there is an application for that developed by the creators of the iSpread but for an application I'm creating I would need this integrated into my own application.
I have downloaded the EADemo application and installed it on my iPad. There I can see that the accessory is attached and that it uses the tw.photofast.cr protocol.
How do I get a list of the files and transfer them? I assume that since this USB works on my PC that it uses a standard USB protocol. I'm able to send strings and hex data to the accessory using the EADemo application but no bytes are received.
Anyone have experience with this?

You'll need to know the protocol their app uses to communicate with the accessory.
They might give it to you, if you indicate you're willing to sign an NDA and they think they can benefit from the transaction. Some hardware manufacturers offer an SDK in the form of a static library.
If you really wanted to try to reverse engineer it, a good start would be to jailbreak your phone and run their app with gdb attached so you can poke around.

Related

How does this iOS app communicate over the USB port?

This app promises to turn your iOS device into a second monitor and uses the standard USB cable to connect to the computer, as opposed to the network which all other similar apps use.
Back when I heard about it, it wasn't yet available so I thought it was a scam. To my surprise, they released the app and it actually works as described.
How does it work ? As far as I know there are no APIs to drive the USB port in iOS, and the computer connected via USB through the standard charging/syncing cable doesn't count as an MFI accessory.
Note that they provide the server software (the one that installs on the Mac and streams the desktop to the device) on their download page for free, reverse-engineering it could shed some light on this but I unfortunately don't have the skills for that.
Dean told about it on his blog.
Duet uses Peertalk, an open source library allowing to pass TCP connections through the USB connection without being part of the MFI program.
The information, code and tools to accomplish generic USB port communication is available to those who join the Apple MFi program. You have to do the paperwork and get licensed by Apple.
http://developer.apple.com/programs/mfi/
The libraries necessary are included in the app and then the usual streaming libraries and code do the rest.

Serial or HID (usb) Communication in iOS (iPhone/iPad)

I want to get data from glucose meter devices by connecting into iPhone or iPad devices. I have different vendors glucose meters some uses simple HID interface for communicate and other uses serial communication.
These are the two possible ways of communication:
USB to 30-Pin connector.
3.5 jack to 30-Pin Connector.
USB or 3.5 jack will be connected to glucose meter and 30 pin connector will be attached with iDevice.
After having hours of research I did not find much help on internet for iOS specific.
I do find ORSSerialPort but I think it is for OS X apps only.
There is RedPark serial Cable but that is for RS232 to 30-Pin communication and secondly that can be only used in internal projects. I want to sell my application on Apple Store.
Someone also was discussing about using IOKit framework. We can communicate with iDevie but that is private framework.
Someone help me with this issue or let me know if that is even possible in iOS application.
Do Apple have any consideration on this type of working?
An iOS device can talk to external devices by following means of communications only:
Wifi
Bluetooth
GPRS &
GSM
USB (Don't exactly know what it is called)
There is no possible way to have RS232 serial port communication with iOS device.
Now What are the options left then?
Get a communication convertor in between your external device & iOS device. It can be
Serial to ethernet adapter
serial to USB adapter etc.
Embedd a wifi/bluetooth module in the external device (If it is being manufactured by you/your firm)
Have something with USB cable & mfi .(Never worked on this, but have seen stuff working with this). By something I meant, register your external device under MFI license & implement USB between devices (Again lack of clarity about USB stuff). Menwhile, I would appreciate edits on my answer by people who might improve it with USB stuff.
Update:
I visited the site of your vendor "glooko". I could not find any clue about them having any libraries for developers. So according to my opinion, they have kept their library private. They don't want you to develop apps based on their communication protocol. If you still need to develop apps for them, contact them here & let them know about your zeal.. M sure they will give you their private code. Anyhow, you don't need to register for any MFI or anything now. What you need is just the code they are using for communication & about that, nobody other than them can help you. So, all the best .. :)
Update 2:
What I understood from your updated question is, you want to create an iOS application that works with various Glucose meters, from different vendors. In a way you can call it as "universal Glucose meter app"
The short and straight answer for this is .."You Can't" . But wait, apple is not responsible for this. Neither it is impossible.
Let me tell you why. When you want your application to talk with a hardware device, there must be a communication channel between you too. You are well aware of those two options available. now, if your app must run on iDevices, the communication channel cables must be registered for mfi. Here that is also not the issue.
What is the issue then?
Different vendons don't generally follow the same communication protocols between their hardware & softwares. What happens if a german commander commands to indian soldier. Obviously, nobody will understand.
So, to achieve your objective, the only way is, you have to include SDK provided by each supported vendors in your app. Let me know if you are not yet clear..:)
There is a device called Lightning Serial Cable, the link is following.Take a look at their SDK.
http://redpark.com/lightning-serial-cable-l2-db9v/
It seems work with your application. I'm also looking for the solution that iOS device can talk to another device via serial port. In PC world, all PC has USB ports, so there is large amount of USB to serial port devices and vendors, such as FTDI and Prolific. I don't know if similar situation happens in iOS world.
Unless you join the Made For iPhone program you can not directly connect anything to an iOS device unless you use Bluetooth or TCP/IP.

RS232 for iOS device

Is it possible to pair an iDevice to an rs232-bluetooth adapter for the purpose of sending serial commands like it would through an iDevice dock connector to rs232 (just like the Redpark Serial Cable does)? I ask because the company I work for is thinking of having an iDevice control one of our systems for demo. I know it doesn't relate to anything specific but any information would be greatly appreciated.
(See also iPhone to RS-232 via Bluetooth)
Bluetooth modules exists that support MFi (Made For iPhone) such as this one from connectBlue http://www.connectblue.com/products/bluetooth-products/bluetooth-modules/bluetooth-iphone-ios-accessory-module-obs414/ So the standard iPhone Bluetooth stack can make a SPP/RFCOMM connection to that device. That device could be added to a board along with RS232 level-conversion etc... And thus success.
I don't know whether someone sells such a device. The RS232 device that connectBlue sells seems not to support MFi, http://www.connectblue.com/products/bluetooth-products/bluetooth-devices/bluetooth-rugged-serial-port-adapter-rbs433/
Not really. The GameKit is one way to access bluetooth in iOS, but it is very limited in what that API allows you to do.
Depending on what you are building, you might be able to use the Apple Made for iPod program, but it's probably a long shot.
http://developer.apple.com/programs/mfi/
The best way to go is probably to design a device that connects via WiFi. I've gone this route, and it worked out well. If you must interface with something with an RS-232 interface, you might design an intermediary "adapter" that connects via WiFi to the iOS device, and via RS-232 to the other device.
If you don't have a need to distribute your app via the App Store, you can use Redpark's iOS serial cable: http://redpark.com/c2db9.html. (Disclaimer, I've never tried one, but according to someone at Redpark, jailbreaking is not required, you just can't distribute your app on the app store.)
You could design a small dongle that attaches via the dock connector, and broadcasts over bluetooth to your other device.
Or you could use WiFi instead of bluetooth... perhaps communicating over WiFi to something that's physically plugged into whatever you want to control.
I worked on a jailbroken app which used BTStack to communicate with a serial device. You might be able to use this for your demo.
If you're still looking to use bluetooth, this helped me out alot to facilitate the standard serial connection for prototyping without jailbreaking:
http://www.seeedstudio.com/depot/bleshield-based-on-bluegigas-ble112-module-p-1367.html
It works on the Bluetooth 4.0 enabled iOS devices and all of the schematic, boardfiles, firmware sources and the iOS App sources are available here:
https://github.com/michaelkroll/BLE-Shield

IPhone Bluetooth Connectivity to Non IOS Devices

I was wondering, if there is a way to use IPhone as an HID device, with some other device like PS3. I checked out the Bluetooth specification and IOS Devices do support HID Profile. So I thought it would be easy to pair my iPhone using passkey mechanism and should be able to start using my iPhone as keyboard or mouse without much hassle. But I found very soon that this assumption is naive and I need to develop custom solution.
I was initially thinking about using GameKit framework, but I think it only works between two compatible IOS Devices. If I want to extend this capability, then I have to use iPhone External Accessory API .In my analysis, I also found that iPhone will only communicate and pair with devices that are licensed by Apple. (Made for iPhone\iPod program). Does it mean that, if I want to use iPhone with another device, I need to get that device approved by Apple. ( Which will not surprise me one bit). Also if someone could point me to more detailed documentation on this, that will also be helpful.( What is an MFI developer board ??)
I do not want a solution that needs me to jailbreak an iPhone. (or any solution that will disqualify my app by Apple).
So to summarize:
1- Please validate my findings, correct them if they are wrong?
2a- How does External Accessory API Work?
b- Can I use this to connect to third party accessories ? (or is this only for accessory developers).
3- Or is there a better solution without using External Accessory API?
Please provide supportive documentation or link if you can. Thank You.
You are unlikely to get on the External accessory program from apple unless you are a big company ( you can try, but I have read this a number of places) . iPhones use a proprietary Bluetooth interface that and hardware must also implement this interface, so not much chance of getting it to connect to any other hardware directly.
Most apps like this (Remote Mouse) for example, connect to your wifi network, and have another application installed on your computer. The iphone can then talk to this application over the wi-fi network, but not bluetooth. I would suggest that the only way I can see this would be possible to to create the server app that you install on a computer on the wi-fi network that then in turn controls the 3rd party device if there is an API that you can use from the desktop app to control the 3rd party device.
This is just what I have found when I researched about this for making an app for iPhone to control a bluetooth watch. I had to jailbreak in the end to replace the bluetooth stack on the iPhone with one that could connect to any hardware device. Not limited by apple.

Bluetooth programming in iPhone

I am planning to develop an iPhone application to transfer files/data to/from my Windows Desktop using Bluetooth.
Please let me know whether the programming interface(SDK)is available in iPhone SDK for this purpose.
In Windows Mobile, I can transfer the file either using a FTP profile or writing application on top of Serial Port Profile(RFComm).
Can anybody tell me, whether this can be possible with an iPhone by writing appropriate application. If not, please let me know alternative way to transfer files/data over bluetooth from iPhone to a Windows Desktop PC.
No, FTP or SPP bluetooth profile are not open in iPhone...
If you get into the made for ipod program, you might develop a bluetooth dongle for a computer (it can't use the normal one built into the computer as it needs a custom apple chip for encoding). This is the only method that could do something like what you want over bluetooth and get your app into the app store. You can implement a similar functionality more readily over wifi.
Yes you can. Use the Human Interface Device profile, and have your USB device pretend to be a keyboard. You can then have your app receive text input from the "keyboard". simply encode your data as ASCII encoded hex or base 64 and transmit. Whether or not your app would be allowed in the app store is a different matter.
There are 2 requirements to use iOS BT Classic for data transmission over RFCOMM.
1) You need to be enrolled in Apple MFi program.
2) The BT accessory which will be connected to iPhone needs to have a special HW chip called "MFi Coprocessor".
Both requirements need to be satisfied if you are developing FW for the BT accessory.
The latter one is required when you are coding iOS app.
BTW, you will not be able to communicate with Windows machine unless you have a BT dongle with MFi chip inside - see the second requirement.

Resources