iTouch - Sonos uPnP Control Point

Discussion in 'iOS Jailbreak & Cydia' started by LiquidIce, Oct 24, 2007.

  1. LiquidIce

    LiquidIce New Member

    Joined:
    Sep 19, 2007
    Messages:
    3
    Likes Received:
    0
    I have a few sonos units in my house and I want to control them from the itouch. I think the itouch will make a much better controller than the sonos wireless controllers. There are several open source projects using PERL, JAVA, and a COM object that communicate with sonos zoneplayers (see sonos digital expert forums for more info).

    The sonos uses UPNP. As far as I can tell it's UPNP for the discovery and event objects, and then it uses SOAP over HTTP POST to send commands like play, stop, next track, and for pulling the list of shared music from the sonos.

    I found COCOA SOAP libraries and have started tinkering with them in XCODE to see if I can get some basic communication working with the sonos.

    Currently, I have this working 2 different ways:

    1. as a native app I wrote in cocoa
    2. as an AJAX web application

    Both methods were done by using Sonosweb (http://purple.org/sonos/).
    Sonosweb is a perl app that I have running on my linux server. A nativeapp on the iphone connects to the perl server and sends and receives JSON requests to control the sonos. The ajax version is a template I created for sonsoweb that is formatted for the iphone.
    Both methods work pretty good, but it requires you to have a sonos, and a linux server and an itouch. I want to eliminate the need for the linux server. I attempted to run the perl script on the itouch itself, but there are a few modules such as XML Expat that I was unable to compile for arm-darwin.

    The new plan is to start from scratch and put together a simple app that lets you browse the shared content tree and select songs for playback with some basic transport controls all using SOAP and UPNP (no sonosweb required). This will be a native app written in cocoa that is able to discover all zoneplayers, and tap into their content directory and control api.

    Sonos now supports several music subscription services such as Sirius, Napster, Rhapsody, Audible, Yahoo, and others, and in my opinion is the ultimate music server for both local content and subscription content. Their latest firmware update also adds search making it possible to type in any song and search al of the local music and online subscription services for the tracks. This is not an ad for sonos, but I am a big fan of their product and would like to see more ways of controlling it and integrating it with other home automation devices and consumer electronics.

    Please post in this thread if:
    -you have a sonos and an itouch and want to see this happen
    -you know how to communicate with upnp and soap devices in Cocoa.
    -you have figured out a way to cross compile all of the modules needed to make perl run sonosweb on the itouch (XML Expat, etc).

    I am just starting to learn cocoa, so I don't know if I will be able to make this work myself... If there are any developers that are interested in taking on this project for real, but don't have the hardware... get in contact with me and I might be able to get some sonos hardware in your hands to begin developing.

    --
    Additional Reading:

    These are two open source upnp clients written in C:
    http://sourceforge.net/projects/clinkc
    http://pupnp.sourceforge.net/
    Can these be compiled for iphone and used in a gui app?

    -LiquidIce
  2. LiquidIce

    LiquidIce New Member

    Joined:
    Sep 19, 2007
    Messages:
    3
    Likes Received:
    0
    So I downloaded the open source portable upnp sdk from sourceforge ( http://sourceforge.net/projects/pupnp/ ) and went to work trying to compile it for the iphone

    Basically, I just ran configure with:
    Code:
    ./configure --host=arm-apple-darwin
    
    The resulting makefile did not have the correct paths to GCC, so I changed a few paths in the file to point to heavenly, the correct location for the arm-apple-darwin gcc and updated the LDFLAGS and CFLAGS

    It makes it pretty far into the build then dies. It seems like i'm getting stuck at the same part that I got stuck with in perl, the EXPAT library.

    Here is some of the error message:
    Code:
    /usr/local/bin/arm-apple-darwin-nm -p  src/ssdp/.libs/libupnp_la-ssdp_device.o src/ssdp/.libs/libupnp_la-ssdp_ctrlpt.o src/ssdp/.libs/libupnp_la-ssdp_server.o src/soap/.libs/libupnp_la-soap_device.o src/soap/.libs/libupnp_la-soap_ctrlpt.o src/soap/.libs/libupnp_la-soap_common.o src/genlib/miniserver/.libs/libupnp_la-miniserver.o src/genlib/service_table/.libs/libupnp_la-service_table.o src/genlib/util/.libs/libupnp_la-membuffer.o src/genlib/util/.libs/libupnp_la-strintmap.o src/genlib/util/.libs/libupnp_la-upnp_timeout.o src/genlib/util/.libs/libupnp_la-util.o src/genlib/client_table/.libs/libupnp_la-client_table.o src/genlib/net/.libs/libupnp_la-sock.o src/genlib/net/http/.libs/libupnp_la-httpparser.o src/genlib/net/http/.libs/libupnp_la-httpreadwrite.o src/genlib/net/http/.libs/libupnp_la-statcodes.o src/genlib/net/http/.libs/libupnp_la-webserver.o src/genlib/net/http/.libs/libupnp_la-parsetools.o src/genlib/net/uri/.libs/libupnp_la-uri.o src/gena/.libs/libupnp_la-gena_device.o src/gena/.libs/libupnp_la-gena_ctrlpt.o src/gena/.libs/libupnp_la-gena_callback2.o src/api/.libs/libupnp_la-upnpapi.o src/api/.libs/libupnp_la-upnptools.o src/uuid/.libs/libupnp_la-md5.o src/uuid/.libs/libupnp_la-sysdep.o src/uuid/.libs/libupnp_la-uuid.o src/urlconfig/.libs/libupnp_la-urlconfig.o  | sed -n -e 's/^.*[       ]\([BCDEGRST][BCDEGRST]*\)[     ][     ]*_\([_A-Za-z][_A-Za-z0-9]*\)$/\1 _\2 \2/p' | /usr/bin/sed 's/.* //' | sort | uniq > .libs/libupnp.exp
    /usr/local/bin/arm-apple-darwin-nm: no name list
    /usr/bin/grep -E -e "^Upnp.*" ".libs/libupnp.exp" > ".libs/libupnp.expT"
    mv -f ".libs/libupnp.expT" ".libs/libupnp.exp"
    sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < .libs/libupnp.exp > .libs/libupnp-symbols.expsym
    make[3]: *** [libupnp.la] Error 1
    make[2]: *** [all-recursive] Error 1
    make[1]: *** [all-recursive] Error 1
    make: *** [all] Error 2
    
    Anyone have some tips on getting the upnp samples compiled for the iphone, or for that matter compiling any sourcecode that was written for a POSTIX OS? Maybe the toolchain is still too new to deal with things like autoconfigure ? Even if this did work, it's in C and a command line program. I still have no idea how I can get the data from there into a Cocoa application to display a UI to the screen. Can Cocoa code call C functions? I guess I still have a lot to learn...

    I think in the meantime I will try to get it to compile for OSX and see if I can write some code to make it subscribe to the Sonos and send basic transport commands.
  3. musiclists

    musiclists New Member

    Joined:
    Nov 25, 2007
    Messages:
    1
    Likes Received:
    0
    Hi!
    I recently bought a Sonos Zoneplayer, and was about to buy a controller until I thought about the possibility of using iTouch as a control point. Lacking the resources and time to develop this myself. I would definitely love to see this happen!

Share This Page