Controlling the Startech VS421HDPIP with C#

As part of a project I have been working on to spec and install a video conferencing solution I purchased a couple of Startech VS421HDPIP units to switch between camera inputs. I chose this unit for a couple of reasons; it has enough inputs for the project, it’s capable of doing picture in picture, it can be controlled via telnet or RS232, our supplier could get it for half the RRP and it’s made by Startech, who’s kit has never left us in an awkward situation.

When I first hooked it up it just worked and the presets that were built-in were decent. Unfortunately it didn’t have presets to support the use cases I required, but I expected that from reading the manual prior to purchasing them. The presets can be changed from the web interface, which is the only downside to this unit… its utter pants. Fortunately it supports some pretty advanced commands via telnet so all is not lost. After playing with the telnet prompt for a while I figured that I could probably write some form of application to change the video output layout from a PC, which would certainly make it more user-friendly. The VC solution is going to be installed in a remote office and anything to make operation easier for the end users is a big plus. This will also allow me to have basically unlimited “presets” to cover more use cases without reconfiguration. Bonus.

Driver

I decided that the application should probably allow control of the PTZ cameras too to encompass the entire VC solution in one control panel, so a simple “driver” style API would be the best bet for controlling each component. The driver for the Startech VS421HDPIP only took two hours to write, including an application to test the class, and is incredibly simple to use. It is available to download at the end of this post. Here’s an example of how to use it.

//create a new instance of the VS421HDPIP class.
VS421HDPIP Conn = new VS421HDPIP();

//set the unit IP address and port
Conn.Ip = IPAddress.Parse(“192.168.1.6”;
Conn.Port = 23;

//open the connection to the unit.
Conn.Open();

//execute commands. See list of commands in the accompanying blog post.
Conn.PowerOn();  //Power on the unit from standby
Conn.Recall(VS421HDPIP.WindowState.Fav1);  //Recall the Fav.1 Preset
Conn.SetImagePosition(VS421HDPIP.InputChannel.Input2, 1420, 790); //Sets the possition of channel 2.

//always close the connection when done. The unit only allows one session at a time and not closing a session will result in you having to reboot the unit or waiting for the session timeout on the unit before opening a new connection.
Conn.Close();

Unfortunately the telnet prompt doesn’t let you retrieve information. Maybe this is something Startech will add to future models but it is what it is.

Commands

The commands I implemented are basically identical to the commands listed in the manual for the VS421HDPIP. I won’t go over available parameters for each here. The parameters are similar to those listed in the manual as well so I’m sure they’d be easy to figure out with intellisense.

  • PowerOn() – Power on the unit from standby.
  • PowerOff() – Place the unit in standby.
  • SetOutResolution(Resolution res) – Sets the output resolution.
  • OsdDisable() – Disable the On Screen Display.
  • OsdEnable() – Enable the On Screen Display.
  • OsdHOffset(int offset) – Sets the horizontal offset of the OSD.
  • OsdVOffset(int offset) – Sets the verticle offset of the OSD.
  • OsdTimeout(int timeout) – Sets the timeout of the OSD.
  • OsdGain(int gain) – Sets the gain of the OSD.
  • SetBrightness(InputChannel chan, int level) – Sets the brightness level of an input.
  • SetContrast(InputChannel chan, int level) – Sets the contrast level of an input.
  • SetSaturation(InputChannel chan, int level) – Sets the saturation level of an input.
  • SetHue(InputChannel chan, int level) – Set the hue level of an input.
  • Mute() – Mutes the audio output of the unit.
  • Unmute() – Unmutes the audio output of the unit.
  • SetImageSize(InputChannel chan, int h, int v) – Sets the size of a channel.
  • SetImagePosition(InputChannel chan, int h, int v) – Sets the position of a channel.
  • ChannelImageOn(InputChannel chan) – Turns a channel on.
  • ChannelImageOff(InputChannel chan) – Turns a channel off.
  • ChannelPriority(InputChannel chan, int priority) – Sets a channel’s priority.
  • SetChannelLabel(InputChannel chan, string label) – Sets a channel’s label.
  • StoreCurrentConfiguration(Favorite loc) – Stores current settings to a preset.
  • MirrorOn() – Makes the unit mirror it’s output (rear projection).
  • MirrorOff() – Disables the output mirror feature.
  • SetOutputRotation(Rotation value) – Rotate unit output (ceiling hung projector).
  • SetFadeDuration(Fadetime time) – Sets fadetime between windows.
  • SendTelnetCommand(string command) – Send a telnet command to the unit.

Download

I have provided the driver I wrote in case it is useful to anybody. I do so with absolutely no warranty or support and you use it at your own risk.

Compiled DLL
Visual Studio Project Files

Writing a Book: Characters

A few months ago I started writing my first ever book. So far the experience has been both enjoyable and exciting, but one element of book writing is harder for me than the rest: Keeping track of characters. I have problems remembering stuff and fictional stuff is even harder to remember, which is why I’m a terrible liar.

To help keep track of characters as the book progresses I came up with a “template” character profile. The template contains the information on a single character, which I copy to a separate note in the MacOS notes app for each character and password protect to save them from prying eyes. So far this system has worked well for me, but I imagine it would fall on its face if I wasn’t continuously updating each note as the book progresses.

I thought I would share the template I use to profile each character in case anybody else finds it useful. So here it is.

  • Name – An obvious one really…
  • Age – Again pretty obvious
  • Description – A description of a character is helpful, for example, homeless man or police officer.
  • Aliases – Characters aren’t always known by their full name. Bill instead of William for example.
  • Physical Appearance – I find it helpful to help visualisation of the characters I’m writing about to jot down what they look like. Hair style and colour, height, eye colour, build, etc.
  • Skills – Handy for reminding me of which character might be able to pick a lock, or cook beans.
  • Relationships – The relationships a character has to other characters is a valuable piece of information to know, even if the relationship isn’t mentioned once in the book. Knowing that two brothers had the same upbringing might help build in common traits.
  • Book Appearances – A list of chapters that the character appears in within the book is helpful for referencing back to previous chapters.
  • Book Mentions – I list of chapters that a character is mentioned in but doesn’t appear in.

As always, I’m always happy to take advice on ways to improve my work, so if any authors out there have any tips on managing characters consistently throughout a book they’d be greatly appreciated.

ShoreTel LLDP Followup

A while ago I wrote a post about the experience I had setting up LLDP on Cisco switches with ShoreTel phones. Since then I have learned a trick or two and though I’d give a little update.

In the post I mentioned changing the configuration files for the phones on the ShoreTel server in order to correctly set the language and country, thus making the dial tone etc sound correct to end users. Unfortunately, this approach is broken. While it works to start with, we found that ShoreTel overwrites the configuration files periodically and removes the custom settings enter, which is a pain un the UK when the default country for ShoreTel is USA.

To get around this, there are some other configuration files which I was made aware of by our ShoreTel partner. Fortunately though ShoreTel provide some custom configuration files for each phone which are included in the main configuration file. The table below shows which custom configuration file you need for each model of phone.

Capture.PNG

So within the c:\inetpub\ftproot\sevgcustom.txt file for the IP 230g phones we use, all we have to do is add the following to the file.

# Please consult Shoreline support before editing or deleting this file

Include “Country_7.txt”
Include “Language_4.txt”

And done. If you reboot a phone, you will see it downloads the sevgcustom.txt file from the server and the language and country settings are all correct.

Don’t forget to change the configuration files for any other model phones you have!

Seriously? Brexit?

I’m getting sick and tired about hearing about Brexit now. It’s all I ever seem to see in the news app on my iPhone, and all I seem to see on the news on TV. Why anybody though Brexit was a good idea is beyond me.

For starters, most of the muppets who voted to leave the European Union last year during the referendum don’t even know themselves why they wanted to leave. Some of the interviews on the news showing people giving bollocks excuses about immigration etc as the reason they voted leave, and then being told on live TV that they were wrong in their rationale was cringe worthy.

Then there were the politicians in the leave camp, lying through their teeth and scare mongering to try to rack up the leave votes. I’m still oblivious as to how they have managed to get away with lying to the public. Surely it’s classed as rigging a vote. Personally I’d put them in prison.

And now where do we stand? On the fence of course. Nobody knows exactly what will happen. The government seems to think they can negotiate an exit from the EU and keep access to all of the perks the EU brings to the table, while eliminating the disadvantages. Sure they can’t think that will work?

In all seriousness, the referendum shouldn’t have happened the way it did. The vote count should have had limits imposed, such as 60% either was, and the government should have laid the exact terms of Britain’s exit from the EU out on the table before the referendum happened. At least then they the public could have made informed votes based on truth and foresight.

But no. We ended up with the shit fest we are in now. Looks like Cameron managed to bail at just the right time.

 

via Daily Prompt: Seriousness

Dealing With Anxiety: Writing

In my quest to deal with anxiety I am always looking for distractions, complex problems to solve or escapes to take my mind out of reality for a while. I find having something to think about while walking or shopping helps me considerably.

After speaking to a friend who recently self published a book, I was motivated again to write a book. Writing a book has been a desire of mine now for years, but not knowing where to start or what to write about I haven’t bothered. 

So yesterday I started. I didn’t have a clue what the book was going to be about or the target audience when I started putting pen to paper. Or fingers to keyboard as it was. Surprisingly, the first chapter just flowed onto the screen and the genre, target audience and first characters were decided. 

I still wasn’t sure about releasing the book though. That is until I asked my wife to read he first chapter, resulting in her crying by the end. I know she is obliged to not hurt my feelings but judging by her impatience to read the next chapter, I think she might be telling the truth when she says it’s good. 

The book, for anybody interested, is fictional and targeted at 12-15 year olds, which is the age of my eldest son.

Now I just need to find the time and motivation to finish the book, and hen decide if I want to self publish or approach a publishing house.