Pelco Developer Network (PDN)

MonitorConfiguration Usage

Overview

This section provides instruction for common tasks related to the MonitorConfiguration Web Service, which is used to configure Endura monitor devices such as decoders. The entries below are based on an existing Pelco sample project, called Decoder Sample, which is linked below. Each entry will reference a specific portion of the sample project, Decoder Sample, specifically they will refer to portions of the MainForm class. Entries will not completely match the sample project verbatim, in order to display the key portions for understanding how to complete the task. Moreover, the sample project may demonstrate functionality that falls outside the scope of this tutorial.

Entries

Getting Started

Required Software

The following software is required to build and run the sample project (Decoder Sample) that the sample code below is based upon:

Required Hardware

  • One Pelco IP source per desired view: for example if you want to display a 2 x 2 view, you will need either four IP cameras, one encoder and four analog cameras, and so on.
  • One Pelco device that can handle the desired number of views e.g. decoder or VCD

Configuration

For the sample project to successfully build, you must properly reference the ManagedSystemManagerWrapper in the sample project's References section. The ManagedSystemManagerWrapper dll is typically located in this directory:

(Pelco SDK Installation Folder)\Libs\Release\

The default Pelco SDK installation folder is:

C:\Program Files\Pelco\API

Retrieving the Current Monitor Layout

The following steps demonstrate how to return the current monitor layout being used.

The method for constructing the MonitorConfiguration service URL demonstrated here is not the ideal way, but this was done for brevity and to maintain the example's simplicity.

The sample code below is based on the logic found in the GetLayout() method within the MainForm class of the sample project.

  1. Initialize a MonitorConfiguration service proxy instance.
  2. Call the service proxy's GetLayout method and analyze the integer result. The following potential results are valid:
    • 0 --- (SINGLE) one viewable channel per monitor
    • 1 --- (QUAD) (2x2) four viewable channels per monitor(s) (one of the most common layouts)
    • 2 --- (NANO) (3x3) nine viewable channels per monitor(s)
    • 3 --- (HEX) (4x4) sixteen viewable channels per two monitor; four per monitor
    • 4 --- (ONEBYFIVE) (1+5) 1 (2/3 by 2/3) channel on the top left and 5 (1/3 by 1/3) channels
    • 5 --- (ONEBYTWELVE) (1+12) 1 (1/2 by 1/2) channel in the center and 12 (1/4 by 1/4) channels
    • 6 --- (TWOBYEIGHT) (2+8) 2 (1/2 by 1/2) channel on top and 8 (1/4 by 1/4) channels
    • 7 --- (FOURBYTHREE) (3x2) 4 horizontal channels and 3 vertical channels (for 16:9)
    • 8 --- (THREEBYTWO) (4x3) 3 horizontal channels and 2 vertical channels (for 16:9)

private int GetLayout(DeviceItem monitor){	string monitorBaseUrl = "http://" + monitor.DeviceIp + ":" + monitor.DevicePort;	MonitorConfiguration mc = new MonitorConfiguration();	mc.Url = monitorBaseUrl + "/control/MonitorConfiguration-" + monitor.DeviceServiceId;	return mc.GetLayout();}

Retrieving Supported Monitor Layouts

There are situations where you will need to determine what monitor layouts are supported by your Pelco device. This entry will demonstrate how to achieve this task.

The method for constructing the MonitorConfiguration service URL demonstrated here is not the ideal way, but this was done for brevity and to maintain the example's simplicity.

The sample code below is based on the logic found in the PopulateLayouts() method within the MainForm class of the sample project.

  1. Initialize a MonitorConfiguration service proxy instance.
  2. Call the service proxy's GetMonitorConfiguration method
  3. Access the supported monitor layouts from the MonitorConfig instance.

private int GetLayout(DeviceItem monitor){	string monitorBaseUrl = "http://" + monitor.DeviceIp + ":" + monitor.DevicePort;	MonitorConfiguration mc = new MonitorConfiguration();	mc.Url = monitorBaseUrl + "/control/MonitorConfiguration-" + monitor.DeviceServiceId;	return mc.GetLayout();}

Retrieving the Current Active Video Channel

The code below demonstrates how to determine the current active video channel.

The method for constructing the MonitorConfiguration service URL demonstrated here is not the ideal way, but this was done for brevity and to maintain the example's simplicity.

The sample code below is based on the logic found in the GetChannel() method within the MainForm class of the sample project.

  1. Initialize a MonitorConfiguration service proxy instance.
  2. Call the service proxy's GetActiveChannel method and analyze the integer result. The range of the result will vary depending on your Pelco device, starting from 1 to the maximum number of video channels supported.

private int GetLayout(DeviceItem monitor){	string monitorBaseUrl = "http://" + monitor.DeviceIp + ":" + monitor.DevicePort;	MonitorConfiguration mc = new MonitorConfiguration();	mc.Url = monitorBaseUrl + "/control/MonitorConfiguration-" + monitor.DeviceServiceId;	return mc.GetLayout();}

Retrieving the Current Monitor Configuration

These steps demonstrate how to request the current monitor configuration, as well as showing common attributes related to the monitor configuration. This is the basis of many entries related to MonitorConfiguration tasks.

The method for constructing the MonitorConfiguration service URL demonstrated here is not the ideal way, but this was done for brevity and to maintain the example's simplicity.

The sample code below is based on the logic found in several methods requesting a current MonitorConfig instance within the MainForm class of the sample project.

  1. Initialize a MonitorConfiguration service proxy instance.
  2. Call the service proxy's GetMonitorConfiguration method and analyze the resulting MonitorConfig instance as detailed in the MonitorConfiguration Web Service.

private int GetLayout(DeviceItem monitor){	string monitorBaseUrl = "http://" + monitor.DeviceIp + ":" + monitor.DevicePort;	MonitorConfiguration mc = new MonitorConfiguration();	mc.Url = monitorBaseUrl + "/control/MonitorConfiguration-" + monitor.DeviceServiceId;	return mc.GetLayout();}

Updating the Monitor Configuration

The steps below illustrate how to make changes to the current monitor configuration. This is the basis of many entries related to MonitorConfiguration tasks.

The method for constructing the MonitorConfiguration service URL demonstrated here is not the ideal way, but this was done for brevity and to maintain the example's simplicity.

The sample code below is based on the logic found in several methods posting changes to the current MonitorConfig instance within the MainForm class of the sample project.

  1. Initialize a MonitorConfiguration service proxy instance.
  2. Call the service proxy's GetMonitorConfiguration method and analyze the resulting MonitorConfig instance as detailed in the MonitorConfiguration Web Service.
  3. Make your changes.
  4. Call the service proxy's SetMonitorConfiguration method, passing in the MonitorConfig instance that you modified.

private int GetLayout(DeviceItem monitor){	string monitorBaseUrl = "http://" + monitor.DeviceIp + ":" + monitor.DevicePort;	MonitorConfiguration mc = new MonitorConfiguration();	mc.Url = monitorBaseUrl + "/control/MonitorConfiguration-" + monitor.DeviceServiceId;	return mc.GetLayout();}

Setting the Current Monitor Layout

This entry demonstrates how to select the current monitor layout.

The method for constructing the MonitorConfiguration service URL demonstrated here is not the ideal way, but this was done for brevity and to maintain the example's simplicity.

The sample code below is based on the logic found in the SetLayout() method within the MainForm class of the sample project.

  1. Initialize a MonitorConfiguration service proxy instance.
  2. Call the service proxy's SetLayout method and pass in the desired layout value. The following values are valid (but your available selection depends on which layouts are supported by your device):
    • 0 --- (SINGLE) one viewable channel per monitor
    • 1 --- (QUAD) (2x2) four viewable channels per monitor(s) (one of the most common layouts)
    • 2 --- (NANO) (3x3) nine viewable channels per monitor(s)
    • 3 --- (HEX) (4x4) sixteen viewable channels per two monitor; four per monitor
    • 4 --- (ONEBYFIVE) (1+5) 1 (2/3 by 2/3) channel on the top left and 5 (1/3 by 1/3) channels
    • 5 --- (ONEBYTWELVE) (1+12) 1 (1/2 by 1/2) channel in the center and 12 (1/4 by 1/4) channels
    • 6 --- (TWOBYEIGHT) (2+8) 2 (1/2 by 1/2) channel on top and 8 (1/4 by 1/4) channels
    • 7 --- (FOURBYTHREE) (3x2) 4 horizontal channels and 3 vertical channels (for 16:9)
    • 8 --- (THREEBYTWO) (4x3) 3 horizontal channels and 2 vertical channels (for 16:9)

private int GetLayout(DeviceItem monitor){	string monitorBaseUrl = "http://" + monitor.DeviceIp + ":" + monitor.DevicePort;	MonitorConfiguration mc = new MonitorConfiguration();	mc.Url = monitorBaseUrl + "/control/MonitorConfiguration-" + monitor.DeviceServiceId;	return mc.GetLayout();}

Setting Text and Border Colors

To denote the color either an active channel within a monitor layout, text color, and so on; do the following steps:

The method for constructing the MonitorConfiguration service URL demonstrated here is not the ideal way, but this was done for brevity and to maintain the example's simplicity.

The sample code below is based on the logic found in the SetActiveBorderColor(), SetBorderColor(), and ToInt32() methods within the MainForm class of the sample project.

  1. Initialize a MonitorConfiguration service proxy instance.
  2. Call the service proxy's GetMonitorConfiguration method and analyze the resulting MonitorConfig instance as detailed in the MonitorConfiguration Web Service.
  3. Make your changes. Color values are just standard RGB color codes. You can use the ToInt32 and FromInt32 helper methods to convert System.Drawing.Color instances to and from Int32 RGB values.
  4. Call the service proxy's SetMonitorConfiguration method, passing in the MonitorConfig instance that you modified.

private int GetLayout(DeviceItem monitor){	string monitorBaseUrl = "http://" + monitor.DeviceIp + ":" + monitor.DevicePort;	MonitorConfiguration mc = new MonitorConfiguration();	mc.Url = monitorBaseUrl + "/control/MonitorConfiguration-" + monitor.DeviceServiceId;	return mc.GetLayout();}

Setting the Current Active Video Channel

The steps below show how to set a particular video channel as active.

The method for constructing the MonitorConfiguration service URL demonstrated here is not the ideal way, but this was done for brevity and to maintain the example's simplicity.

The sample code below is based on the logic found in the SetChannel() method within the MainForm class of the sample project.

  1. Initialize a MonitorConfiguration service proxy instance.
  2. Call the service proxy's SetActiveChannel method and pass in the desired channel number to make active.

private int GetLayout(DeviceItem monitor){	string monitorBaseUrl = "http://" + monitor.DeviceIp + ":" + monitor.DevicePort;	MonitorConfiguration mc = new MonitorConfiguration();	mc.Url = monitorBaseUrl + "/control/MonitorConfiguration-" + monitor.DeviceServiceId;	return mc.GetLayout();}