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:
THREADSAFE CHANGE From_Device { 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.