views:

118

answers:

4

We bought a Grace wifi radio. Grace has a cool iPhone app that connects to the radio and lets you control it.

My question is.. how the heck does this work? How can the iPhone connect to the radio and then control it??

A: 

Are you asking coding specifics or just an overall concept of what's going on? The actual networking stack behind these operations can be quite complex.

Your Grace wifi radio will have created a server which the iPhone has connected to on your wifi network, from this point onwards it's a simple client-server relationship, with the iPhone sending data to the radio each time it sends a command. Because of this, if your iPhone is not on the same wifi network it will not be able to control/find the radio.

Jay
@Jay, General concept is all I was after..
Marcus
A: 

Most likely, the WiFi radio listens over a fixed UDP port. The iPhone in turn sets up a UDP connection by broadcasting the network (on IP 255.255.255.255) on that port. The radio will respond and a connection will be established.

This is complete speculation; I have no idea how it actually works. No doubt there is plenty of documentation on this.

Paul Lammertsma
I think this would be reinventing zeroconf (which is a cleverly designed protocol, easy to implement in very minimal code since embedded devices are among its main targets, and with a lot of collective industry experience behind it). Ah well, docs are very scarce, from what crumbs they give it seems they may actually have chosen UPnP -- see http://www.zeroconf.org/ZeroconfAndUPnP.html for a comparison of UPnP and Zeroconf (biased but I like it;-).
Alex Martelli
You're probably right. Unrelated: It's difficult to take a organization that has a name like the "Internet Engineering Task Force" seriously when their website looks like it stemmed from the eighties.
Paul Lammertsma
A: 

Grace's website has a FAQ on their iPhone remote. Looks like it uses WiFi.

Todd
Either that's the weirdest FAQ I've ever seen, or you've put the wrong link in there matey :)
Jay
+1  A: 

I can't find detailed technical information on Grace's side, but, if I were asked to design something like this, I'd have the radio advertise a service on its wifi LAN via zeroconf (also known by Apple's trademarked name, bonjour -- an app on the iphone (or any other node on that wifi LAN) can then easily find the radios on the same LAN and chat with them through whatever protocol Grace has defined for the purpose.

Edit: from the scarce crumbs of docs on Grace's site it seem they may have chosen UPnP instead of Zeroconf -- ah well, see here for a (possibly biased, but solid) analysis of why they should have chosen Zeroconf instead!-)

Alex Martelli