How to connect to USB device from iOS with Xcode or swift - ios

I'm trying to connect USB camera to iOS in Xcode using Swift or Objective C.
I saw online to try and use IOKit.framework, but I believe it's for MAC, which I'm not using. dos NSSstring converters but I'm unsure that will work either. I'm trying to do it through iOS.
I also have a WIFI adapter that will connect to my NIKON DSLR and shoot photos to a PC over wifi but not sure how to get the iOS device to connect and download these images.
Thanks in advance!

Looks like this isn't possible, at least for what you want.
Communicating with an external accessory requires you to work closely
with the accessory manufacturer to understand the services provided by
that accessory. Manufacturers must build explicit support into their
accessory hardware for communicating with iOS. As part of this
support, an accessory must support at least one command protocol
These USB devices obviously have not been designed with iOS in mind, so there is a very small chance you can get it to work the apple way.
Alternatively, you can look into jailbreaking and that sorta deal with the cameraconnectionkit library. This is way out of my scope though, so good luck!

Related

Does iOS Multipeer connectivity work with non-smartphone devices?

Our guys in the field use equipment that have wifi and Bluetooth connectivity. One of our users has been using a non-iPhone (I guess Android) to transfer files between his phone and the equipment through Bluetooth. However, in switching our users to iPhones to use other enterprise apps we have discovered what some of you already know: iOS's Bluetooth connectivity is severely limited (i.e. no SPP protocol).
The equipment also communicates via wifi, so I was wondering if it's possible to create an app using iOS Multipeer connectivity to solve the Bluetooth problem. All I am finding about this, though, doesn't show anything but phone-to-phone multipeer connections, and not phone-to-machine multipeer connections.
At this point I know nothing about how the field equipment works; that's something I'll have to learn if we decide to pursue this. But assuming that it is capable of discovering wifi networks, would it be able to see the iPhone's network without needing any special software?
Or would I be wasting my time trying to figure this out?
Thanks!
If the equipment is using Bluetooth SPP then unless it is MFi certified you can pretty much forget about connecting to it from iOS. Multipeer connectivity won't do it, that's for sure.
WiFi may be a possibility - you need to get the iPhone and the equipment on the same WiFi network - you can't do this via an app though - you would need to use the WiFi settings in iOS - You will need to learn more about the equipment to see if that is possible.
Short answer: no. Only iOS 7.0+ or MacOS Yosemite+
MultipeerConnectivity is a framework for iOS and Mac OS. To send data using it, you need both devices to have iOS or MacOS with MultipeerConnectivity. You don't have any network-related parameters like "I prefer using bluetooth or wi-fi", it was designed to "just work out of box with simple goal - discover and connect other devices with MultipeerConnectivity.
It means that you can't send data from iPhone with MC to Android or Symbian or old iPhone with iOS <7 etc.
Before iOS7 you could use GameKit, but the logic is the same: both peers need to use GameKit.
If your custom equipment does not have iOS - you need to use lower-level API, and your options include generic Bonjour (NSNetService on iOS device and something Bonjour-compatible on custom device) or CoreBluetooth (obviously bluetooth-only, no wi-fi peer-to-peer) on the lowest level, using sockets and so on.

iPad Camera Connection Kit to Talk to Non-Storage USB Devices?

I am doing some experimenting with robotics and have a USB servo controller that I would like to connect to my iPad. Does anyone know if it's possible to access USB devices such as this on the iPad? And if so, what mechanisms can I use to talk to it? The servo controller's manufacturer has made the controller's protocol open so if I can talk to it, I should be able to use it.
It is most likley you will not be able to control the servo DIRECTLY form the iphone.
A servo is controller by some sort of "servo-controller"
And this server is controlled using an RS232 interface that accepts commands in some sort of characters or bits.
So I found this rs-232 app that looks interesting on app-store but not sure how to use it?
But you can buy cables like this for iphones and ipads Keep in mind that RS232 and TTL use different voltages.
Instead of getting more hardware for the iPhone / iPad, use the built in Bluetooth and the SPP (Serial Port Interface) with some code and this excellent piece of kit (i use it often it great) This just needs some power (it runs on TTL#9600bps not RS232 so check for voltage compatibility) you pair it and get a proper virtual COM port to communicate over Bluetooth without any special programming! You need to check if you iOS allows you to use SPP Bluetooth Profile. A lot of older iOS devices do not allow much over Bluetooth- so you might need a cable.
There is nice project here on how to use serial on iOS
And here is way to use Bluetooth HID included in most iPhones / iPad with a clever device that re transmits it using Bluetooth SPP .. hehehe - Suck on that Steve
And here on spark fun is a ready product. whatever you type on the iPhone (or using a programme that pushes characters to Bluetooth HID) which get converted to TTL...
You can use the ExternalAccessory.framework and its APIs.
There's also a brief guide on External Accessories.

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.

OS X to iOS communication via USB?

Is there currently an Apple-approved (or at least tolerated) strategy to transfer high-bandwidth data over USB from an iOS device to OS X? Is this even allowed as an MFi program developer?
Maybe peertalk is interesting. "PeerTalk is a iOS and OS X Cocoa library for communicating over USB and TCP."
I would take a look at this project from iOSDevCamp 2010 if you want to transfer data over USB:
http://maxweisel.com/blog/2010/08/iosdevcamp2010-hackathon-ios-usb-sync/
Perhaps this doesn't map to what you're actually trying to do, though.
There is no legitimate way to do this using the public iOS SDK at the moment.
It is also impossible to do that within the MFi, unless you want to put a peripheral in between.

Resources