SIMPL+ Best Practice

I just finished watching the videos posted of Toine lecturing at Crestron Masters 2017.  Sadly, this was a session I really wanted to sit in, but the space was reserved for veteran programmers (and this was my first time attending Masters).

He has many good points about how SIMPL+ has many bottlenecks to understand and work with, but one of his talks at the end covered GatherAsync.  He prefaced this section by quickly covering what he considers the best practice for writing a CHANGE event in SIMPL+.

Here’s an example showing the design pattern:

    String Temp[MAX_LINE_LENGTH];

    While (1)
        Temp = Gather("\r", From_Device);
        MakeString(To_Device, "RX: %s", Temp);

This pattern works for 2-series and 3-series processors.  Toine even says he can’t think of a better way to process incoming data from a device.

Normally, SIMPL+ operates at the lowest thread priority.  The Gather function, however, runs at a higher priority so it can quickly service data coming in from devices.  I wanted to pull this one idea out of his talk and put it into a blog post so I could easily remind myself that this is Crestron’s best practice.

3 thoughts on “SIMPL+ Best Practice

  1. I recently ran across your post. I agree with most of what you have posted here except with that function “To_Device” is going to keep sending blank strings on each cycle of the loop when there is nothing in the gather.


    1. Thank you for the comment, BP! I believe the way the Gather function works is it will block until it encounters the delimiter string “\r” in From_Device. Then, it passes the whole captured string into the “Temp” variable which I just echo back to the program in To_Device. Until it receives a “\r” character, it should sleep until that condition is met. Real world code would obviously inspect what’s in Temp to see what response came back from the device and handle feedback etc instead of just echoing the string back.


  2. Wow, my first trip to Masters! I wonder if this is still the best way of gathering data from a device on 4-series processors? It’s probably better handled using C# threads.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s