Archive for the ‘Software Development’ Category

While working on a project at my new job I ran across a problem where I needed to update a WPF UI (databound collection) from an async call. There are tons of examples on the internet of how to do this, but few of them seem tailored for the MVVM model where your ViewModel doesn’t have knowledge of the view (and thus doesn’t have access to the view’s Dispatcher). For scalar types this isn’t a problem as they are marshaled to the UI thread in WPF, but for collections bound to controls, this becomes asynchronous updating is an issue.

Fortunately, Jeremy Likness came up with an elegant solution. Instead of regurgitating what he did, I’ll just point you to his blog post. While is post is about Silverlight, this is also applicable to WPF.

I thought his solution was simple & elegant (and best of all, it works!)

Dispatching In Silverlight

I figure it’s time to make the announcement here since I keep getting job offers from around the country.

I’ve accepted a job in Johnson City, TN. I am officially off the market.

I think it’s going to be a very cool place to work. Fast paced, challenging, with good people to work with. I’m excited. And really, what more can you ask for?

My thanks to the various companies who reached out to me the past month and a half. Some of you had some very nice offers with some really intriguing job opportunities. Sadly, most of them were not in the Tri-Cities area of TN where I needed to move to :)

But who knows what the future holds? I am selling a house I bought four months ago because I thought I was going to be here in Idaho for another 2-5 years. I am not clairvoyant; situations change. We’ll see what happens.

In the meantime, very much looking forward to moving to VA/TN and seeing how this all plays out. Time to begin again!

Adams Complexity Threshold

…complexity is what guarantees mistakes will happen and won’t be caught.

The same is true for software.

This is the third post in a series of posts about the IPTV project.

In the previous post I talked about the Video Signal Path. In this post I’m going to talk about how we control the DISH Network Satellite receivers remotely without the aid of hand held remote controls. We’ll look at the IR Command Path for the DISH Network Satellite Receivers and the role that the Global Cache CG-100 Network Adapters play in allowing us to control devices.

As stated in the previous post, the DISH Network receivers are stored in a climate controlled server room under lock-and-key. This is great for the receivers, not so great for the jailers trying to change a channel.

Fortunately, this is where the Global Cache GC-100 Network Adapters come to the rescue.

Global Cache GC-100 Network Adapter

The GC-100 is a really cool device. What it allows you to do is send ASCII text commands to it over a network. It then interprets those ASCII commands, transforming them into IR commands that can be understood by the device you’re trying to control.

For this process to work, the GC-100 has to be located next to the device you want to control as it utilizes short, wired IR Emitters. Basically, you string a wired IR Emitter from the GC-100 to the IR input of your device (in this case, the front of the DISH receiver where the IR receptor is located). The IR Emitters have a sticky substance on their face that allows you to fasten the emitter to the front of the IR input on the DISH receiver. However, in reality, we found this sticky substance to be pretty pathetic, so we fastened the emitters to the receivers using black electrician tape.

The GC-100 is then hooked up to the network via CAT-5/CAT-6 and given a network address.

Sending Commands To The GC-100

Having the GC-100 IR emitters hooked up to the DISH receivers and also having it plugged into the network is only half the equation. The next thing you need to be able to do is actually send ASCII commands to it. These ASCII commands are actually text representations of IR signals. But how do we know what commands to send? What do they look like? How do we create them?

Programming The GC-100

Fortunately, the folks at Global Cache created a little tool that makes this whole process much easier. It’s called an IR-Learner.

What the IR-Learner does is allow you to point a remote control at it and capture the ASCII representation of the command. So, for instance, you can take the DISH Network remote control, press the “Power” button, and the IR-Learner will capture the ASCII representation of that “Power” command. From that point you just need to save that text somewhere. In our application, we choose to save this in a database.

Operating The Virtual Remote

So now we have the GC-100 hooked up to the DISH Network receiver, and we have the ASCII commands saved in the database. How do we actually control the DISH Receiver? Remember, the DISH Network receiver is housed in a climate-controlled environment. The jailers do not have direct access to the DISH receivers. What happens when they want to change a channel on the receiver?

We start at the client application, with a view that shows us a virtual DISH Network Remote Control:

The Client

The user can click a button on this virtual remote control. The client then sends a request to the server application via WCF Duplex Channel. The request basically consists of an ID for the internally stored ASCII command that is located in our database.

The Server

When the request reaches the server application, it fetches the ASCII text from the db cache (we’re using NHibernate and an internal cache in the service to save round trips to the db). The server application then formulates the appropriate command to send out over TCP/IP to the GC-100 Network Adapter. You need to specify the IP Address of the GC-100 that you want to talk to, as well as a “module” on the GC-100 that you want to send the command over (a module in the GC-100 corresponds directly to a physical device you are controlling, in this case a specific DISH receiver). For instance, the GC-100-18 has multiple modules so it can control multiple “devices”. We used one GC-100-18 to control four DISH receivers. By specifying the module we specify which of the DISH receivers we want the IR signal to go to.

Conclusion

There are a lot of pieces involved in this part of the puzzle, but the result is a simple interface in the client application that non-technical people can understand and utilize. Almost everyone nowadays has a DISH or DirectTV remote control at home. Jailers can easily make sense of the client interface, press a button on the remote control and thus control the DISH receivers remotely, from the comfort of their command and control stations.

This is the second post in a series of posts about the IPTV project.

In the previous post I introduced the IPTV project that we built at Nez Perce County. Today I’m going to talk about the Video Signal Path. Basically, how we route the video signals to the individual television sets that are scattered throughout the jail.

We begin with four DISH Network receivers located in a climate controlled server room environment. The output from each DISH Network satellite receiver is taken to a port on the Osprey-450e Video Capture Device. The ports on the back of the Osprey accommodate standard RCA video cables. The audio RCA cables are attached to a squid on the Osprey.

The Osprey-450e is located on a Windows XP box that we built. This is where our server-side application (written in C#) resides as well as an installation of open source VideoLAN (VLC) software package. Our C# server application utilizes VLC processes to perform transcoding and streaming of the DISH network signals that are coming in off the Osrprey-450e. What we’re doing here is taking the signals that the Osprey is providing and we’re transcoding them into MPEG-4 format and then multicasting them via UDP over the internal network.

The streams then travel over CAT-6 cable throughout the jail facility. The streams are broadcast as multicast UDP, so any device that is listening on this internal network can receive the signal. The Tornado Set Top Boxes receive these streams via the plugged in network cable and transmit the signal to the television sets via HDMI cables. By issuing commands to the Set Top Boxes, we can instruct the STB on which stream to display to the television.

In the next post we’ll cover how we control the DISH receivers remotely without the use of hand held remote controls.