Welcome to MSDN Blogs Sign in | Join | Help

Diaries from my Roku SoundBridge M1000 in .Net - Cross thread confessions

I just simply love my SoundBridge 1000. Recently the folks at Roku Labs introduced the Roku Control Protocol which gives you remote control of your SoundBridge. That is to say you can now think about creating your own way to control the device from a PC or other smaller devices (smartphone or PPC).

 

This turned into a personal development project for me. I want to control my device from a PC (WMPlayer 10 would be next logical thing to do). I find the small text interface on the device fine but far too small when you have a large music library. I also wanted my Windows Media Center as the *source* (nice and easy to use interface to browse my library) but have the SoundBrdige device be the *target* output which is connected to my stereo. The idea is I plan to have a touch screen in the kitchen (open concept kitchen/family room) where I can view my music library easily but not fuss with having a PC connected to my stereo. From there I can do all sorts of interesting things to remote my SoundBridge, have it act as an alarm clock or play some random music when I get home or perhaps when I turn on the main floor lights.  So this is what I’ve been working on of late, exploring the .Net 2.0 framework (specifically .Net sockets), smart client development and the new Class Designer tool.

 

The way the folks at Roku implemented the “api” is through a telnet interface running a shell (MMC) in the session. Cool – a set of web services would have been nice – but hey this is a start. So, the design of my app is very straight forward. Create a “message” pump into the SoundBridge, execute commands and wait asynchronously for data coming back.

 

If I want to look at all artists, then I can send down the appropriate MMC commands, wait for the data to come back and populate a tree control. I know my SoundBridge connects to Windows Media Connect and implements a UPnP Media Renderer so you might ask yourself why connect to the SoundBridge? Why not connect to the WMC and get the media library info from there? All good questions – I figure I need more material for my blog!!! In all seriousness I really wanted to play around with asynch sockets and besides I still need to connect to the SoundBridge over the provided interface if I want to be able to control it.

 

I can tell you this much – The Visual Studio 2005 debugger is a lot less forgiving than in 2003. I had some code that I used/modified to connect my socket in an asynchronous fashion. The code, I thought was fine, worked great under VS2003 but failed with a cross thread exception in VS2005 (in debug mode). All seemed fine but clearly I was trying to write to the UI on the wrong thread which generated the error but was not caught in VS2003. I could compile and run the code in both cases but I still had a bug and it was caught in VS2005. I confess – VS2005 can help avoid embarrassing errors!

 

Next up, UPNP device discovery with UPNPLib and .Net Interop.

 

For more information on how to build a Network Device Compatible with Windows Media Connect check out the link.

 

Published Wednesday, October 05, 2005 6:29 PM by jcarron

Comments

# Jerome Carron s Weblog Diaries from my Roku SoundBridge M1000 in Net | Outdoor Ceiling Fans

New Comments to this post are disabled
 
Page view tracker