Pelco Developer Network (PDN)

CameraConfiguration General Usage

Getting Started

Pelco Device Control URL

Be aware that all examples utilize a method of determining the device's control URL that is not suitable for production. This was done to keep our example code simple, and focused on the main task being demonstrated.

C# Notes

The C# code examples below assume that you have either already generated proxy classes from the WSDLs or you have access to generated proxy classes.

If for some reason you want to generate the classes that represent the web services yourself, it is assumed that you will use MS Visual Studio (2005 or up) for WSDL stub/proxy class generation.

Be sure to use our XML related convenience classes found in the program.cs file under the samples directory. For the samples directory location, refer to Installation and Configuration for details.

It is not recommended that you utilize Mono, an open source alternative CLR for .NET.

To download the code samples, refer to Installation and Configuration for details.

General

Retrieving a Camera's Current Configuration

Refer to Pelco Device Control URL below for important details about the code sample.
  1. If you have not already done so, please refer to the "Getting Started" section.
  2. Initialize an instance of the class that acts as a representative of the CameraConfiguration Web Service.
  3. Call the CameraConfiguration's GetConfiguration action.

C# Example

using CSharpIPCam.CameraConfigurationRef;static class Program{	static void Main()	{		try		{						string cameraAddress = "10.80.136.194:49152"; //camera URL or IP address followed by the port number			string cameraNumber = "1"; //Camera number on a multi-channel encoder			CameraConfiguration cameraConfig = new CameraConfiguration();			cameraConfig.Url = "http://" + cameraAddress + "/control/CameraConfiguration-" + cameraNumber;			{				System.Net.ServicePoint vosp = System.Net.ServicePointManager.FindServicePoint(new Uri(cameraConfig.Url));				vosp.Expect100Continue = false;			}						CameraConfig SetCameraConfig = cameraConfig.GetConfiguration(); //Get camera configuration					}		catch (Exception ex)		{			Console.WriteLine( ex.ToString() );		}	}}

Modifying a Camera's Configuration

Refer to Pelco Device Control URL below for important details about the code sample.
  1. If you have not already done so, please refer to the "Getting Started" section.
  2. Initialize an instance of the class that acts as a representative of the CameraConfiguration Web Service.
  3. Retrieve the IP camera's current configuration (see Retrieving Camera's Current Configuration below for details).
    Retrieving the IP camera's current configuration is required, since this needs to be resent along with any new changes to configuration. This ensures any current settings users would like to retain are not reset to factory default values.
  4. Set the retrieved CameraConfig data element's data to your needs.
  5. Make a SetConfiguration request using the CameraConfig instance as the parameter.

C# Example

using CSharpIPCam.CameraConfigurationRef;static class Program{	static void Main()	{		try		{						string cameraAddress = "10.80.136.194:49152"; //camera URL or IP address followed by the port number			string cameraNumber = "1"; //Camera number on a multi-channel encoder			CameraConfiguration cameraConfig = new CameraConfiguration();			cameraConfig.Url = "http://" + cameraAddress + "/control/CameraConfiguration-" + cameraNumber;			{				System.Net.ServicePoint vosp = System.Net.ServicePointManager.FindServicePoint(new Uri(cameraConfig.Url));				vosp.Expect100Continue = false;			}						CameraConfig SetCameraConfig = cameraConfig.GetConfiguration(); //Get camera configuration					}		catch (Exception ex)		{			Console.WriteLine( ex.ToString() );		}	}}

Resetting a Camera's Configuration to Default Factory Settings

Refer to Pelco Device Control URL below for important details about the code sample.

If a camera was improperly configured, that camera may no longer function correctly or at all. At this point, Pelco advises you to reset the camera's configuration to factory defaults to restore normal functionality.

Unfortunately, it is currently not recommended to use the ResetConfiguration action for cameras that support PTZ (Pan, Tilt, Zoom). By default PTZ functionality is disabled after a reset to factory settings. 

If you really do need to reset a PTZ camera, you can re-enable PTZ functionality after the reset.
  1. If you have not already done so, please refer to your programming language's respective "getting started" notes below.
  2. Initialize an instance of the class that acts as a representative of the CameraConfiguration Web Service.
  3. Make a CameraConfiguration request to the ResetConfiguration action.

C# Example

using CSharpIPCam.CameraConfigurationRef;static class Program{	static void Main()	{		try		{						string cameraAddress = "10.80.136.194:49152"; //camera URL or IP address followed by the port number			string cameraNumber = "1"; //Camera number on a multi-channel encoder			CameraConfiguration cameraConfig = new CameraConfiguration();			cameraConfig.Url = "http://" + cameraAddress + "/control/CameraConfiguration-" + cameraNumber;			{				System.Net.ServicePoint vosp = System.Net.ServicePointManager.FindServicePoint(new Uri(cameraConfig.Url));				vosp.Expect100Continue = false;			}						CameraConfig SetCameraConfig = cameraConfig.GetConfiguration(); //Get camera configuration					}		catch (Exception ex)		{			Console.WriteLine( ex.ToString() );		}	}}