Pelco Developer Network (PDN)

LensControl Troubleshooting

Getting Started

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.

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. Refer to LensControl Issues and LensControl for more details.

What LensControl actions are supported by which camera models using a particular control mode?

Refer to the table "LensControl actions supported by camera model and control mode" in the LensControl Issues section.

How can we control the zoom rate?

Instead of LensControl, use the PositioningControl service to control zoom.

How do you control zoom?

Not all IP Cameras support zoom functionality. Refer to "LensControl actions supported by camera model and control mode" in the LensControl Issues page for more detail.

Moreover, there are multiple services and sometimes several different (redundant) actions that support this functionality.
For now this use case will only cover one method.

  1. If you have not already done so, refer to the 'Getting Started' section.
  2. Initialize an instance of the class that acts as a representative of the LensControl Web Service.
  3. Send a request to the Zoom action along with the zoom value.

If you do not make an explicit request to make the camera stop zooming, the camera will continue to zoom in the direction specific of the previous request. The sample code below includes stop requests.

C# Example

using CSharpIPCam.LenControlRef;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 encoderLensControl lensControl = new LensControl(); lensControl.Url = "http://" + cameraAddress + "/control/LensControl-" + cameraNumber; { System.Net.ServicePoint vosp = System.Net.ServicePointManager.FindServicePoint(new Uri(lensControl.Url)); vosp.Expect100Continue = false; }//ZoomInLensControlInfo(); lensControl.Zoom(2);lensControl.Stop();//ZoomOutLensControlInfo(); lensControl.Zoom(1);lensControl.Stop(); } catch (Exception ex) { Console.WriteLine( ex.ToString() ); } }}

How do you control focus?

  1. If you have not already done so, refer to the 'Getting Started' section.
  2. Initialize an instance of the class that acts as a representative of the LensControl Web Service.
  3. Send a request to the Focus action along with the focus value

If you do not make an explicit request to make the camera stop focusing, the camera will continue to focus in the direction specific of the previous request. The sample code below includes stop requests.

C# Example

using CSharpIPCam.LenControlRef;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 encoderLensControl lensControl = new LensControl(); lensControl.Url = "http://" + cameraAddress + "/control/LensControl-" + cameraNumber; { System.Net.ServicePoint vosp = System.Net.ServicePointManager.FindServicePoint(new Uri(lensControl.Url)); vosp.Expect100Continue = false; }//ZoomInLensControlInfo(); lensControl.Zoom(2);lensControl.Stop();//ZoomOutLensControlInfo(); lensControl.Zoom(1);lensControl.Stop(); } catch (Exception ex) { Console.WriteLine( ex.ToString() ); } }}

How do you control the iris?

  1. If you have not already done so, refer to the 'Getting Started' section.
  2. Initialize an instance of the class that acts as a representative of the LensControl Web Service.
  3. Send a request to the Iris action along with the iris value.

If you do not make an explicit request to make the camera stop moving the iris, the camera will continue to move the iris in the direction specific of the previous request. The sample code below includes stop requests.

C# Example

using CSharpIPCam.LenControlRef;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 encoderLensControl lensControl = new LensControl(); lensControl.Url = "http://" + cameraAddress + "/control/LensControl-" + cameraNumber; { System.Net.ServicePoint vosp = System.Net.ServicePointManager.FindServicePoint(new Uri(lensControl.Url)); vosp.Expect100Continue = false; }//ZoomInLensControlInfo(); lensControl.Zoom(2);lensControl.Stop();//ZoomOutLensControlInfo(); lensControl.Zoom(1);lensControl.Stop(); } catch (Exception ex) { Console.WriteLine( ex.ToString() ); } }}