1

I built a robot that I want to control wirelessly from my iPhone. Bluetooth is out because of Apple's scandalous policies in that regard so I wonder if I equip the robot with a WiFi system if I can send streams of data from an app on the iPhone. Does Apple allow any kind of WiFi access through their APIs other than through a browser? And ideally the app would also be able to read data sent from the robot. Is any of this possible?

dsolimano
  • 8,870
  • 3
  • 48
  • 63
Don
  • 85
  • 1
  • 7

2 Answers2

1

Yes it is possible, assuming the robot can somehow open a socket.

You can create a TCPI/IP socket connection between the robot and the iPhone. Using this connection you are able to send and receive any data you want.

Some questions covering similar problems:

How can I create a small Mac app that receives data over the WiFi network from an iOS app?

Ad Hoc Wifi Connection Between iPhone & Mac - Possible?

(You linked questions mainly using Bonjour, as this is probably not available on the robot, you need another way to discover the IP address)

Community
  • 1
  • 1
pre
  • 3,475
  • 2
  • 28
  • 43
  • Is there another way to discover other wifi devices through the sanctioned Apple iPhone API? Assuming for the moment that there is, are you certain that there is an API for opening a raw TCP-IP socket? That doesn't sound very Apple-like. But assuming it is true, what protocols does Apple provide sanctioned access to other than HTTP? – Don May 17 '12 at 03:01
  • You can use any protocol you want to communicate over TCP/IP sockets. You can create a connection using [CocoaAsyncSocket](https://github.com/robbiehanson/CocoaAsyncSocket) for example. Worked really well for me. – pre May 17 '12 at 05:22
  • Ok, so the other question is still unanswered. Is there a way to discover wifi devices other than with Bonjour? – Don May 26 '12 at 02:37
  • @Don: You'll really need to study the IP stack (including TCP and UDP): UDP is what allows broadcasting of packets, and this is what Bonjour makes use of. So yes, you don't need Bonjour itself. If you can connect to the WiFi, I presume you have a TCP/IP stack as well. If you have Linux on the robot, it's easiest to install Avahi for Bonjour compatibility. Otherwise, just use UDP broadcasts on both the iPhone and the robot to discover the service. In any case, Bonjour is only a service discovery mechanism; even if you use it, you still need to use sockets to actually open a connection. – Ivan Vučica Jun 15 '12 at 12:37
0

Bluetooth is out because of Apple's scandalous policies in that regard

You can use Bonjour for ad-hoc networking over Bluetooth. See this question for details.

Community
  • 1
  • 1
Jim
  • 72,985
  • 14
  • 101
  • 108
  • Bonjour is fine for doing the discovery and making the connection but how does one send or received a serial stream of data over the connection? What is the API for doing that? Is the browser the only app that can use the connection or can any app use it? – Don May 16 '12 at 22:14
  • I don't see why you are bringing the browser into it. The browser has nothing to do with Wi-Fi, Bluetooth or Bonjour. Did you read the things that question links to? There's a description of how to set up a connection in one of them. – Jim May 16 '12 at 22:18
  • I brought up the browser because I thought it was possible that HTTP was the only protocol that Apple allowed one to use when communicating over WiFi. And I also thought it possible that Apple would restrict HTTP communications to the browser app. That was the point of my question. And the question you refer to is about Bluetooth communications, not WiFi, which is what I am inquiring about - so no, I didn't check out the links. – Don May 30 '12 at 21:52