Pelco Developer Network (PDN)

Controlling Relay

Controlling PelcoCamera Relay in .NET Application

I want to control relay of camera. You can see my program as a event of button. I received “Done” message on MessageBox but the relay did not work.

Is there any problem in my event?

private void m_Relay_Click(object sender, EventArgs e)

RelayArrayConfiguration.RelayConfig relayConfig = new RelayArrayConfiguration.RelayConfig();

RelayArrayConfiguration.RelayArrayConfiguration relayArrayConfig = new RelayArrayConfiguration.RelayArrayConfiguration();
relayArrayConfig.Url = "http://[DeviceIP]:80/control/RelayArrayConfiguration-1";

relayArrayConfig.TriggerRelay(Convert.ToInt16(textBox1.Text), relayConfig.period, relayConfig);
catch (Exception ex)


Best regards

Your code looks fairly correct. The relayId is typically going to be "0", and the mode should be 0, 1, 2, 3, or 4 (what you have as "period") according to the WSDL file.

We do have a very old sample that has C# code that may help to demonstrate how to do some of this. The sample will probably not compile and run because it is so old and does rely on some old SDK DLLs that we no longer provide ... but the code section under the Relay Array should largely still work. The sample is here under Device I/O: Pelco API and SDK Code Samples. Please take a look at that and try some of the code. As I said, the sample will very likely not build and run properly because of dependencies, but code snippets may work for you.

Another suggestion that I have would be to use Wireshark to see what the request packet to the camera looks like, confirm that it looks correct, and see what the response is from the camera. In your post you indicated that the MessageBox Shows, but we don't know what happened with the request on the network to the camera.