Async/Await & SIMPL+

I had a recent job where I needed to control NewTek Spark IO decoders. These little guys have a REST API that is fairly easy to use, but require HTTP, cookies, JSON parsing, etc. Perfect fit for C# instead of SIMPL! But the HttpClient class uses asynchronous calls, so getting it to play nicely with SIMPL means you have to work around the async methods since SIMPL+ won’t see them.

My first stab at writing code to control these things works, but the module throws an exception if I dispose objects too quickly. And if a device reboots, it’s hard to tell when it comes back until an exception throws. So my code needs some clean up! I’d like to write about that once I’ve had a chance to sit down and refactor it. In the meantime, I thought it would be good to do a small example of getting async/await to work with SIMPL+.

Continue reading “Async/Await & SIMPL+”