Five Ways to Connect Flash to Embedded Systems: MIM

Getting Flash and an embedded system to talk to each other sounds really interesting right? …if it weren't for all the barriers that prevent it. The solution I have for you today is wrapped up in four little words: man-in-the-middle.

You might have heard the term 'man in the middle' (MIM) in a dark and scary context… like when someone covertly inserts a MIM between communicating systems to siphon off / steal information. Enough with the negative. Let's talk about positive uses!

If you aren't familiar with how it works, a MIM can be loosely described as a globally visible end-point that the computer running your Flash solution _and_ the embedded system can see and touch. With this, the MIM can help traverse barriers that prevent direct communication between Flash and your embedded system.

What kind of barriers? Non routable network segments, firewalls, changing IPs, great distances, serial port requirements, tuna fish sandwiches - you name it. If [ insert obstacle here ] prevents Flash from direct communication with your embedded system, a MIM might be able to help by brokering messages between the two (indirect communication). Is this another tutorial on serial proxies and policy servers? Nope.

On to the goodies!

If you are looking for a drop-in solution, look no further than ioBridge. Their IO-204 Monitor and Control Module is a production ready device that can be easily configured to accomplish a plethora of tasks. The good news here, is that all the bits that drive the module are done for you. The only task on your plate is to spend a little time figuring out how to communicate with their web API from AIR (I'd do it for you but I need some [cough] samples to get the job done).

Oh! Oh! How about using the new and shiny ColdFusion 9 as the MIM? Yes… that could work… AWESOMELY! You could easily use a stateful object to manage digital or analog ins/outs. Depending on your setup, you could use push, pull, or binding to keep things updated on both sides of the barrier. Just be careful, communications with the embedded system may need to be throttled to prevent it from being overwhelmed.

There are so many ways to do this.. just be aware that some are updated more than others. Could you use PHP? Yep. Java? Sure. What about .NET? But of course! If [ insert your tool of choice ] can provide the required visibility, the ability to maintain state of the embedded system, and a way to report it to both parties… you are good to go. Just remember to keep it simple at first, something like a web service with a single method to set / get the state of the embedded system will be plenty for now.

And now, for a bit of realism...

Getting Flash to communicate with your MIM is probably something that you can accomplish in an hour or two. The last mile, communications between the MIM and embedded system, might be another story. Ideally, it would be nice if you could repurpose the same API you are using in Flash (read: the embedded system will need to speak TCP/IP). Mileage at this point will vary greatly on what you are connecting to and from. Be creative, but try to err on the side of simplicity if you can.

Here are some options to chew on.

Next installment: Five Ways to Connect Flash to Embedded Systems: HID