comment 1

VC-4: Part 1

I’d like to write a program that explores VC-4 since it’s the only 4-series platform I’ll have access to for a while. And since VC-4 doesn’t run the logic engine, we get to program the whole thing in SIMPL#! Here’s a rough drawing of how this system will function:

Conceptual drawing of our conference room system

The user will have a touchpanel interface that allows them to control the room system. There is a camera mounted beneath the wall-mounted display and an HDMI connection at the table. The user can choose to either present their laptop directly to the monitor or share it during a video call. The touchpanel can be used to control what source is selected to the monitor, place/receive video calls, and control volume of the display.

We’ll expand this system with better capabilities in the future, and it may take a few posts to flesh this version out fully, but I think this is a good starting point.

Before we get too far ahead of ourselves, let’s get the absolute minimum program compiled and loaded so we can see how we get it running on our VC-4 instance.

Absolute Minimum Program

I like to start out with getting the smallest program I can write compiled and loaded without any errors. So with that, here is our template:

using System;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.CrestronThread;
using Crestron.SimplSharpPro.Diagnostics;
using Crestron.SimplSharpPro.DeviceSupport;

namespace Vc4Test1
{
    public class ControlSystem : CrestronControlSystem
    {
        public ControlSystem()
            : base()
        {
            try
            {
                Thread.MaxNumberOfUserThreads = 20;
            }
            catch (Exception e)
            {
                ErrorLog.Error("Error in ControlSystem constructor: {0}", e.Message);
            }
        }

        public override void InitializeSystem()
        {
            try
            {
            }
            catch (Exception e)
            {
                ErrorLog.Error("Error in InitializeSystem: {0}", e.Message);
            }
        }
    }
}

This program does nothing other than start running. It will be enough to test at least.

First we need to add a new program to VC-4. From the Status page, select Add Program from the Actions menu:

Give the program a name and select the CPZ from the file picker:

On the next slide, we can call out other files to upload along with this program. We don’t have any so just push Add:

Now that we have our program loaded to VC-4, we need to assign it to a room. Click Add Room to create a new room:

The important things to do here are pick the program we just loaded and give the room a unique name:

When you’re done, click Add. The new room will be created, our program will be started, and we’ll see that it’s running on the Status page:

That’s it! Our program is up and running, but of course it doesn’t do anything.

One problem I’ve run into is that if I fix a bug in our Vc4Test1 program, I want to upload the changes to the VC-4 server. But I get this error message:

I would expect a way to upload program fixes without needing to rebuild each room, so I’m probably going about this the wrong way. I guess you could add it with a new name, then switch all rooms using that program to the new one? I just tried doing this, and it doesn’t let me change which program is started with the room. This seems like a huge problem, not just for development, but for maintenance.

Update: It looks like you can use the REST API to update previously loaded programs. But I’m not sure if there’s a way to do this from the Web UI on the server itself.

Update 6/2/20: I don’t know how I missed this before, but there is actually an easy way to update the program. Click the Modify button next to the program in the Program Library:

Now you can Choose a new program and VC-4 will automatically restart all rooms running that program!

Hiding in plain sight I suppose?

1 Comment so far

  1. Pingback: VC-4: Part 2 – Kiel the Coder

Leave a Reply

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

WordPress.com Logo

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

Google photo

You are commenting using your Google 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