We’ve already run into a couple things we need to be mindful of when using HTML5 and 4-series processors (see HTML5 XPanel for details about licensing and authentication). In this post, my goal is to break away from 3-series sandboxes and SIMPL Windows, so that means we’re moving into the realm of C# and Visual Studio 2019.
Goodbye SIMPL Windows!
SIMPL is an interesting language. It lends itself well to the business logic needed for touchpanels and room automation. Probably it’s biggest asset is it’s mostly deterministic (SIMPL+ complicates that), so you can track logic waves to make sure things happen in the correct sequence, everytime. It works well for what it was designed to do.
Now that we’re leveraging web technologies, we start to run into walls where SIMPL just gets in the way. I have never tried to parse JSON or XML using SIMPL and I never will. Trying to build a one-size-fits-all program that maintains consistency across an organization is fraught with headaches. Exchanging data with REST APIs can probably be handled easily enough, but a lot of that also exists as a library in other languages (that also handles all the corner-cases I don’t want to consider). SIMPL had a good run, but I think it’s time to put it out to pasture.

OK, I might be exaggerating these points to make the case for switching over to C# from here on out, but it is going to be easier for what we’re doing. SIMPL is still a great tool for certain jobs. I’ll probably still use it 10 years from now (because some PRO2’s just won’t die). It can be very quick to piece together a new program if you have all the right modules handy in your library.
Hello VS 2019
If you’re not familiar with Crestron programming in VS 2019, I recommend reading VC-4: Breaking out of the Sandbox first. It’s quick and it will walk you through the process of adding the necessary NuGet packages to your project.
Why should we prefer using VS 2019 over a tool like SIMPL Windows? Here are a few reasons:
- VS 2019 is a modern tool that encourages modern development practices like unit tests and version control
- Microsoft builds software better than Crestron, SIMPL Windows has limped along with few new features in the past 5 years
- There is a much larger pool of learning resources available to C# programmers compared to platform-specific languages like SIMPL and SIMPL+
Once you feel comfortable getting a project started in VS 2019, we can move on to rewriting our test program.
Our Test Program
We’re going to redo the SIMPL# Pro program we created in Contract Editor. In the Solution Explorer, remove the contracts folder from our project:

Next, remove all traces of our Contract Editor programming in ControlSystem.cs:
using System;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.CrestronThread;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.UI;
namespace HTML5Demo
{
public class ControlSystem : CrestronControlSystem
{
private BasicTriListWithSmartObject _tp;
public ControlSystem()
: base()
{
try
{
Thread.MaxNumberOfUserThreads = 20;
}
catch (Exception e)
{
ErrorLog.Error("Error in ControlSystem: {0}", e.Message);
}
}
public override void InitializeSystem()
{
try
{
_tp = new Ts770(0x03, this);
_tp.OnlineStatusChange += tp_OnlineStatusChange;
if (_tp.Register() != eDeviceRegistrationUnRegistrationResponse.Success)
{
ErrorLog.Error("Unable to register TS-770: {0}", _tp.RegistrationFailureReason);
}
}
catch (Exception e)
{
ErrorLog.Error("Error in InitializeSystem: {0}", e.Message);
}
}
private void tp_OnlineStatusChange(GenericBase dev, OnlineOfflineEventArgs args)
{
}
}
}
Remember, we’re just going to maintain enough state to keep the touchpanel in sync when it boots up. Lets add a variable to keep track of the active source:
public class ControlSystem : CrestronControlSystem
{
private BasicTriListWithSmartObject _tp;
private ushort _src;
public ControlSystem()
: base()
{
When the touchpanel comes online, we should update it with the active source:
private void tp_OnlineStatusChange(GenericBase dev, OnlineOfflineEventArgs args)
{
if (args.DeviceOnLine)
{
var tp = (BasicTriList)dev;
tp.StringInput[1].StringValue = "SIMPL# Pro Test";
tp.UShortInput[1].UShortValue = _src;
}
}
We need to cast dev to BasicTriList so we can access the UShortInput collection that sends analog values to the touchpanel. We also send static text to the panel for the room name.
And lastly, we need to listen for source changes from the touchpanel:
public override void InitializeSystem()
{
try
{
_tp = new Ts770(0x03, this);
_tp.OnlineStatusChange += tp_OnlineStatusChange;
_tp.SigChange += tp_SigChange;
if (_tp.Register() != eDeviceRegistrationUnRegistrationResponse.Success)
{
ErrorLog.Error("Unable to register TS-770: {0}", _tp.RegistrationFailureReason);
}
}
catch (Exception e)
{
ErrorLog.Error("Error in InitializeSystem: {0}", e.Message);
}
}
private void tp_SigChange(BasicTriList dev, SigEventArgs args)
{
switch (args.Sig.Type)
{
case eSigType.UShort:
switch (args.Sig.Number)
{
case 1:
_src = args.Sig.UShortValue;
break;
}
break;
}
}
Whenever the panel comes online, it will return to the last source that was selected, making sure it stays in sync with our program. I don’t know about you, but I think this was faster to write than waiting for SIMPL Windows to open.
VC-4
So what if we don’t have access to a 4-series processor anymore (such is my case), how are we going to test our programs written for 4-series? The good news is that VC-4 is a 4-series processor, just with a couple twists we can work around.

I’m going to use a spare Intel NUC to create my own 4-series processor running VC-4. I’ll walk you through the steps below in case you would like to do the same.
Install Rocky Linux
Rocky Linux is the continuation of CentOS which aims to be package compatible with Red Hat Enterprise Linux. Red Hat recently announced that CentOS would become a testing ground for RHEL, making it similar to Fedora. We don’t want breaking package changes on our system, we want something rock solid! So we’ll use Rocky Linux.
Boot the installation disc and follow the prompts to setup a typical server (or with GUI if you prefer).
Once installation completes, make sure you can connect to your server via SSH.
Setup VC-4
Download the VC-4 setup script from Crestron. We’ll have to modify the installVC4.sh script to ignore the operating system and treat it like RHEL:
#!/bin/bash
scriptPath=`pwd`
#os=`cat /proc/version | grep "bos.redhat.com" | cut -f1 -d" "`
#if [ -z $os ]
#then
# os=`cat /proc/version | grep "bsys.centos.org" | cut -f1 -d" "`
# if [ -z $os ]
# then
# echo "RPM Not Compatible In This Operating System!!!"
# exit
# else
# os="CENTOS"
# echo "Operating System : CentOS"
# OpenSsl="openssl-devel-1.1.1c-15.el8.i686"
# LibAtomic="libatomic-8.3.1-5.el8.0.2.i686"
# LibCurl="libcurl-7.61.1-12.el8.i686"
# NetSnmp="net-snmp-agent-libs-1:5.8-14.el8_2.1.i686"
# RedisCLI="redis-5.0.3-2.module_el8.2.0+318+3d7e67ea.x86_64"
# NetSnmplib="net-snmp-libs-1:5.8-14.el8_2.1.i686"
#
# fi
dnf config-manager --add-repo ./crestron.repo
dnf config-manager --add-repo ./crestron1.repo
#else
os="RHEL"
echo "Operating System : Red Hat"
OpenSsl="openssl-devel.i686"
LibAtomic="libatomic.i686"
LibCurl="libcurl.i686"
NetSnmp="net-snmp-agent-libs.i686"
RedisCLI="redis"
NetSnmplib="net-snmp-libs.i686"
#fi
echo " " >> /tmp/.vc4InstallationLog.txt
Run the installer script. Once it finishes installing all the dependencies, it will ask a few questions about your setup. The only default setting I needed to change was the Redis listening port (the default is 6379.
Once installation is complete, reboot your server (to make sure all services startup correctly at boot). Then you can browse to https://ipaddress/VirtualControl/config/settings/ from another machine to make sure all services are running:

Connect a touchpanel
Lets load our SIMPL# Pro program to VC-4. From the Actions menu, select Add Program. Browse to the HTML5Demo.cpz file. Give the program a name (and optionally) a description:

There aren’t any extra files we’re sending, so you can click past that window. Next we need to add a new Room:

Because our VC-4 server could be running programs for multiple rooms, it needs a way to identify which room equipment is trying to connect to. Luckily, IP Tables now include a field for ROOM ID, so we can update that on our touchpanel to connect to the correct program. Update the IP Table on our touchpanel:

It will take a moment, but the touchpanel should show online in the VC-4 portal:

Summary
In this post, we abandoned SIMPL Windows and will only do further development using VS 2019. This post was likely a lot of refresher, but I wanted to make sure to set the stage for the next few programs that we’re going to write.
Unfortunately, without an XIO license, we can’t use WebXPanel with VC-4, there’s no way to enable a trial period (like there is with a hardware controller). We’ll explore a way around this problem later on when we switch to using websockets.
Thanks for reading!
Can You Share Some Debug Experience In 4 Series Use Mono Debug? When I Was Attache Process,It Can’t Work,And Show Some Errors
LikeLike
Hi Jack, have you followed the steps outlined on https://support.crestron.com/app/answers/detail/a_id/1000637 ? I don’t currently have a 4-series to test with other than VC-4.
LikeLike