Pelco Developer Network (PDN)

StreamConfiguration Usage

Some answers involving code samples have a set of assumptions for proper operation by programming language.

The main focus of the code samples is for better ease of understanding.

Please also note that due to the general and flexible nature of the StreamConfiguration configuration service, it is recommended that users first consult with camera / product specific documentation such as Sarix.

 

Getting Started

Pelco Device Port Number

Pelco device port numbers numbers will rarely change. However a device port number may change when a device restarts. While the port number still is unlikely to change when the device restarts, it is still good to account for it. For details on determining a device's current port number, please refer to Frequently Asked Questions in the Sales and Support area of pelco.com.

Pelco Device Control URL


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

To properly determine a device's control URL, please refer to Frequently Asked Questions in the Sales and Support area of pelco.com.

C# Notes

For the C# code examples assume that you have either already generated proxy classes from the WSDLs or you have access to generated proxy classes. You can find Pelco web service proxy classes in the 'samples' directory. For more details, please refer to Installation and Configuration for details.

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. To implement any examples related to eventing, you must be on the Windows platform and you must register Pelco ActiveX controls. For more details, please refer to Installation and Configuration.

Mono


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

PelcoBinding Class

The PelcoBinding class contains useful methods and classes related to SOAP, accounting for how Pelco products deal with the protocol.

PelcoBinding Class

using System;
using System.Text;
using System.Xml;
using System.ServiceModel.Channels;
using System.IO;

namespace SarixSamples
{
    class PelcoBinding
    {
        public static System.ServiceModel.Channels.Binding CreateCustomBinding()
        {
            var transport = new HttpTransportBindingElement();
            // disable http keepalive
            transport.KeepAliveEnabled = false;
            var encoding = new PelcoTextMessageBindingElement();

            return new CustomBinding(encoding, transport);
        }

        class XmlWriterNoDefaultNs : XmlTextWriter
        {
            public XmlWriterNoDefaultNs(StreamWriter sw) : base(sw) { }

            public override void WriteStartElement(string prefix, string localName, string ns)
            {
                if (ns.StartsWith("urn:schemas-pelco-com:service"))
                {
                    prefix = "u";
                }

                base.WriteStartElement(prefix, localName, ns);
            }
        }

        // see http://msdn2.microsoft.com/en-us/library/ms751486.aspx
        class PelcoTextMessageEncoder : MessageEncoder
        {
            public override string ContentType
            {
                get { return "text/xml; charset=utf-8"; }
            }

            public override string MediaType
            {
                get { return "text/xml"; }
            }

            public override bool IsContentTypeSupported(string contentType)
            {
                return base.IsContentTypeSupported(contentType.Replace("\"", ""));
            }

            public override MessageVersion MessageVersion
            {
                get { return MessageVersion.Soap11; }
            }

            public override Message ReadMessage(ArraySegment buffer, BufferManager bufferManager, string contentType)
            {
                byte[] msgContents = new byte[buffer.Count];
                Array.Copy(buffer.Array, buffer.Offset, msgContents, 0, msgContents.Length);
                bufferManager.ReturnBuffer(buffer.Array);

                return ReadMessage(new MemoryStream(msgContents), int.MaxValue);
            }

            public override Message ReadMessage(System.IO.Stream stream, int maxSizeOfHeaders, string contentType)
            {
                return Message.CreateMessage(XmlReader.Create(stream), maxSizeOfHeaders, MessageVersion);
            }

            public override ArraySegment WriteMessage(Message message, int maxMessageSize, BufferManager bufferManager, int messageOffset)
            {
                MemoryStream stream = new MemoryStream();
                XmlWriter writer = new XmlWriterNoDefaultNs(new StreamWriter(stream, new UTF8Encoding(false)));
                message.WriteMessage(writer);
                writer.Flush(); // make sure out MemoryStream is updated

                byte[] messageBytes = stream.GetBuffer();
                int messageLength = (int)stream.Position;
                writer.Close();
                stream.Close();
                int totalLength = messageLength + messageOffset;
                byte[] totalBytes = bufferManager.TakeBuffer(totalLength);
                Array.Copy(messageBytes, 0, totalBytes, messageOffset, messageLength);
                ArraySegment byteArray = new ArraySegment(totalBytes, messageOffset, messageLength);

                return byteArray;
            }

            public override void WriteMessage(Message message, System.IO.Stream stream)
            {
                XmlWriter writer = new XmlWriterNoDefaultNs(new StreamWriter(stream, new UTF8Encoding(false)));
                message.WriteMessage(writer);
                writer.Close();
            }
        }

        class PelcoTextMessageEncoderFactory : MessageEncoderFactory
        {
            private MessageEncoder encoder = new PelcoTextMessageEncoder();

            public override MessageEncoder Encoder
            {
                get { return encoder; }
            }

            public override MessageVersion MessageVersion
            {
                get { return MessageVersion.Soap11; }
            }
        }

        class PelcoTextMessageBindingElement : MessageEncodingBindingElement
        {
            public override MessageEncoderFactory CreateMessageEncoderFactory()
            {
                return new PelcoTextMessageEncoderFactory();
            }

            public override IChannelFactory BuildChannelFactory(BindingContext context)
            {
                // this isn't in the example but seems to be necessary
                context.BindingParameters.Add(this);
                return context.BuildInnerChannelFactory();
            }

            public override MessageVersion MessageVersion
            {
                get { return MessageVersion.Soap11; }
                set { if (value != MessageVersion.Soap11)throw new NotImplementedException();}
            }

            public override BindingElement Clone()
            {
                return new PelcoTextMessageBindingElement();
            }
        }
    }
}

 

Retrieving a camera's stream's current configuration

For most settings


Configuration types and values will differ depending on the camera model. For more details, please refer to the StreamConfiguration service.

The current line of ID and IX series of Sarix cameras still uses the CameraConfiguration service for certain settings. For details, lease refer to the Contrast, Saturation, and Brightness entry within the StreamConfiguration Issues section.


Please refer to the Pelco Device Control URL and Pelco Device Port Number entries, in the Getting Started section, for important details about the code sample.

It is very useful to query the current state and configuration of a specific Sarix stream. To do this, simply:

  1. If you have not already done so, please refer to the Getting Started section.
  2. Account for the HTTP 100-continue header. Failure to do so will result in an error since Sarix IP cameras will not respond with a "100 (Continue)".
  3. Create a new instance of the class that acts as a representative of the StreamConfiguration web service.
    • For .NET, use the PelcoBinding class (detailed in the Appendix and also located within the sample C# project) to return a custom binding instance for use as a parameter.
  4. Call the StreamConfiguration service's GetAllSettings action and pass a string to represent the video parameter. The example below demonstrates how to parse the result.

C# Example

using System;
using System.ServiceModel;
using StreamConfigurationRef; //the service reference to use

static class Program
{
    static void Main()
    {
        //Not the recommended method of determing a control URL; used here only for simplicity.
        string cameraAddress = "http://10.220.196.178/control/StreamConfiguration-1"; //camera URL or IP address followed by the port number

        try
        {
            System.Net.ServicePointManager.Expect100Continue = false;
            StreamConfigurationPortTypeClient client = new StreamConfigurationPortTypeClient(PelcoBinding.CreateCustomBinding(), new EndpointAddress(cameraAddress));
            string type = "video";
            QueryResult result = client.GetAllSettings(type); //Get stream configuration

            Console.WriteLine("====Current Settings====");
            Console.WriteLine();

            foreach (Setting tmpSetting in result[0].settings)
            {
                PrintSetting(tmpSetting);
            }

            foreach (Setting tmpSetting in result[1].settings)
            {
                PrintSetting(tmpSetting);
            }

            Console.WriteLine();
            Console.WriteLine();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.ToString());
        }
    }

    static void PrintSetting(Setting tmpSetting)
    {
        Console.Write(tmpSetting.name); // ex output: 'encoding'

        switch (tmpSetting.Item.GetType().Name)
        {
            case "Resolution":
                Resolution res = (Resolution)tmpSetting.Item;
                Console.WriteLine(string.Format("[{0} x {1}]", res.width, res.height)); //ex output: '704 x 480'
                break;

            default:
                Console.WriteLine("[" + tmpSetting.Item.ToString() + "]");
                break;
        }

        Console.WriteLine();
    }
}

 

For querying contrast, saturation, and brightness settings ONLY

  1. If you have not already done so, please refer to the Getting Started section.
  2. Account for the HTTP 100-continue header. Failure to do so will result in an error since Sarix IP cameras will not respond with a "100 (Continue)".
  3. Initialize an instance of the class that acts as a representative of the CameraConfiguration web service.
  4. Retrieve the IP camera's current configuration
  5. Parse returned data.
using System;
using System.ServiceModel;
using CameraConfigurationRef; //the service reference to use

static class Program
{
    static void Main()
    {
        //Not the recommended method of determing a control URL; used here only for simplicity.
        string cameraAddress = "http://10.220.196.178/control/CameraConfiguration-1"; //camera URL or IP address followed by the port number 
        System.Net.ServicePointManager.Expect100Continue = false;
        CameraConfigurationPortTypeClient client = new CameraConfigurationPortTypeClient(new BasicHttpBinding(),new EndpointAddress(cameraAddress));
        CameraConfig camConfig = client.GetConfiguration();
        Console.WriteLine("audio enabled[" + camConfig.audioEnable + "]");
        Console.WriteLine();
        Console.WriteLine(String.Format("brightness auto[{0}] value[{1}]", camConfig.videoproperties.brightness.mode, camConfig.videoproperties.brightness.value));
        Console.WriteLine();
        Console.WriteLine(String.Format("contrast auto[{0}] value[{1}]", camConfig.videoproperties.contrast.mode,camConfig.videoproperties.contrast.value));
        Console.WriteLine();
        Console.WriteLine(String.Format("saturation auto[{0}] value[{1}]",camConfig.videoproperties.saturation.mode, camConfig.videoproperties.saturation.value));
    }
}

 

Determining possible valid stream configuration values


Users will not be able to query possible valid values for some configuration attributes:

  • contrast
  • saturation
  • brightness
  • hue (Sarix cameras currently do not support configuring hue. For details please contact us.)

Please refer to the Contrast, Saturation, and Brightness entry within the StreamConfiguration Issues section for more details.

These steps do not account for given configuration values. For details please refer to Frequently Asked Questions in the Sales and Support area of pelco.com.

Furthermore there is a C# .NET sample project available here as another set of examples.

Please refer to the Pelco Device Control URL and Pelco Device Port Number entries, in the Getting Started section, for important details about the code sample.

To help prevent mis-configuration, the StreamConfiguration service allows clients to query possible, valid configuration values with the GetAllCurrentConfiguration action.

To query valid possible configuration setting values, simply:

 

  1. If you have not already done so, please refer to the Getting Started section.
  2. Account for the HTTP 100-continue header. Failure to do so will result in an error since Sarix IP cameras will not respond with a "100 (Continue)".
  3. Create a new instance of the class that acts as a representative of the StreamConfiguration web service.
  4. Create a new instance of an empty StreamIDSettings array.
  5. Call the StreamConfiguration service's GetAllCurrentConfiguration action and pass the following parameters:
    • A string value denoting the type of stream. The default value is "video".
  6. Parse the results. Refer to the examples below and the StreamConfiguration web service reference (specifically ConfigurationInfo)for details.

C# Example

using System;
using System.ServiceModel;
using StreamConfigurationRef; //the service reference to use

static class Program
{
    static void Main()
    {
        //Not the recommended method of determing a control URL; used here only for simplicity.
        string cameraAddress = "http://10.220.196.178/control/StreamConfiguration-1"; //camera URL or IP address followed by the port number 
        try
        {
            System.Net.ServicePointManager.Expect100Continue = false;
            StreamConfigurationPortTypeClient client = new StreamConfigurationPortTypeClient(PelcoBinding.CreateCustomBinding(), new EndpointAddress(cameraAddress));
            StreamIDSettings[] streamIDSettingsList = new StreamIDSettings[1];
            //streamIDSettingsList[0] = streamIDSettings;
            ConfigurationInfo result = client.GetAllCurrentConfiguration("video"); 
            Console.WriteLine("====Valid Possible Values Per Setting====");
            Console.WriteLine();

            foreach (StreamConfigurationInfo item in result.streamInfo)
            {
                StreamID tmpStreamId = item.stream;
                Console.WriteLine(string.Format("Stream[{0}] Type[{1}]", tmpStreamId.id, tmpStreamId.type));
                Console.WriteLine();

                QueryResult queryResult = item.result;
                Setting[] tmpSettings = queryResult.setting;
                SettingOptions[] tmpSettingOptions = queryResult.settingOptions;

                foreach (SettingOptions tmpSettingOp in tmpSettingOptions)
                {
                    PrintPossibleValues(tmpSettingOp);
                }

                Console.WriteLine();
                Console.WriteLine();
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.ToString());
        }
    }

    static void PrintPossibleValues(SettingOptions tmpSettingOp)
    {
        Console.Write("\"" + tmpSettingOp.name + "\"");
        Console.Write(": " + tmpSettingOp.Item.GetType().Name);
        Console.WriteLine();

        switch (tmpSettingOp.Item.GetType().Name)
        {
            case "FreeFormString":
                FreeFormString tmpString = (FreeFormString)tmpSettingOp.Item;
                Console.WriteLine(string.Format("\t maxlength[{0}]", tmpString.maxLength));
                Console.WriteLine();
                break;

            case "IntRange":
                IntRange tmpIntRange = (IntRange)tmpSettingOp.Item;
                Console.WriteLine(string.Format("\t minValue[{0}] maxValue[{1}] defaultValue[{2}]", tmpIntRange.minValue, tmpIntRange.maxValue, tmpIntRange.defaultSpecified));
                Console.WriteLine(tmpIntRange.@default);
                break;

            case "StringEnumeration":
                StringEnumeration tmpStrEnum = (StringEnumeration)tmpSettingOp.Item;

                foreach (String strEnumVal in tmpStrEnum.value)
                {
                    Console.WriteLine("\t[" + strEnumVal + "]");
                }

                break;

            case "DecimalEnumeration":
                DecimalEnumeration tmpDecEnum = (DecimalEnumeration)tmpSettingOp.Item;

                foreach (decimal decEnumVal in tmpDecEnum.value)
                {
                    Console.WriteLine("\t[" + decEnumVal + "]");
                }

                break;

            case "BooleanOption":
                BooleanOption tmpBoolOp = (BooleanOption)tmpSettingOp.Item;
                Console.WriteLine(tmpBoolOp.defaultSpecified);
                Console.WriteLine(tmpBoolOp.@default);
                break;

            case "ResolutionEnumeration":
                ResolutionEnumeration tmpResEnum = (ResolutionEnumeration)tmpSettingOp.Item;

                foreach (Resolution resEnumVal in tmpResEnum.value)
                {
                    Console.WriteLine(string.Format("\t[{0} x {1}]", resEnumVal.width, resEnumVal.height)); //ex output: '704 x 480'
                }

                break;

            default:
                Console.WriteLine(" ... not a valid value type ...");
                break;
        }
    }
}

 

Determining possible valid stream configuration values given desired configuration values

 

Please refer to the Pelco Device Control URL and Pelco Device Port Number entries, in the Getting Started section, for important details about the code sample.

The QueryAllOptions action does not take into account the current camera settings, unless users pass in the current configuration values as a filter. Users can use GetAllCurrentConfiguration action to retrieve the current configuration.

As with the previous entry, users will not be able to query possible valid values for some configuration attributes:

  • contrast
  • saturation
  • brightness
  • hue (Sarix cameras currently do not support configuring hue. For details please contact us.)

Please refer to the Contrast, Saturation, and Brightness entry within the StreamConfiguration Issues section for more details.


What is the difference between this entry and the previous entry, that discusses use of GetAllCurrentConfiguration action, regarding valid possible configuration values? The main difference is that the previous entry does not assume any contraints on any configuration. Specifically this entry will show the steps needed to show how to return valid configuration values when users require specific configuration value such as 30 fps.

For example, if a user chooses JPEG as the stream type, valid frame rate values returned would only be 5 and 10. Conversely if the users choose H264 as the stream type, valid frame rate values returned would be 5, 10, and 30.

Essentially these methods filter valid configuration settings.

To help prevent mis-configuration, the StreamConfiguration service allows clients to query possible, valid configuration values with the QueryOptions action. The QueryOptions action also can show valid combinations of settings. For example, if a user sets 'encoding' to 'MPEG4' as a filter (meaning that he was use this config setting), then the QueryOptions action will return an even more restricted set of possible config values. In this case, '1280x720' is no longer a valid option for the resolution configuration setting. For more information, please refer to Frequently Asked Questions in the Sales and Support area of pelco.com.

 

To query valid possible configuration setting values, simply:

 

  1. If you have not already done so, please refer to the Getting Started section.
  2. Account for the HTTP 100-continue header. Failure to do so will result in an error since Sarix IP cameras will not respond with a "100 (Continue)".
  3. Create a new instance of the class that acts as a representative of the StreamConfiguration web service.
  4. Create a new instance of an empty StreamIDSettings array, and populate it with Setting instances to act as filters. In this case the only filter is resolution.
  5. Call the StreamConfiguration service's QueryAllOptions action and pass the following parameters:
    • A string value denoting the type of stream. The default value is "video"
    • The newly created empty StreamIDSettings array
  6. Parse the results. Refer to the examples below and the StreamConfiguration web service reference (specifically ConfigurationInfo)for details.

C# Example

using System;
using System.ServiceModel;
using StreamConfigurationRef; //the service reference to use

static class Program
{
    static void Main()
    {
        //Not the recommended method of determing a control URL; used here only for simplicity.
        string cameraAddress = "http://10.220.196.178/control/StreamConfiguration-1"; //camera URL or IP address followed by the port number 
        try
        {
            System.Net.ServicePointManager.Expect100Continue = false;
            StreamConfigurationPortTypeClient client = new StreamConfigurationPortTypeClient(PelcoBinding.CreateCustomBinding(),new EndpointAddress(cameraAddress + "/control/StreamConfiguration-1"));
            SarixSamples.StreamConfigurationRef.StreamID streamID = new SarixSamples.StreamConfigurationRef.StreamID();
            streamID.id = 0;
            streamID.type = "video";

            Resolution resVal = new Resolution();
            resVal.height = 1080;
            resVal.width = 1920;

            Setting res = new Setting();
            res.name = "resolution";
            res.Item = resVal;
            Setting[] settingsCriteria = { res };

            StreamIDSettings streamIDSettings = new StreamIDSettings();
            streamIDSettings.stream = streamID;
            streamIDSettings.settings = settingsCriteria;

            StreamIDSettings[] streamIDSettingsArray = { streamIDSettings };
            ConfigurationInfo configInfo = client.QueryAllOptions("video", streamIDSettingsArray);
            StreamConfigurationInfo[] streamConfigInfos = configInfo.streamInfo;

            foreach (StreamConfigurationInfo streamConfigInfo in streamConfigInfos)
            {
                PrintQueryResult(streamConfigInfo.result);
            }
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.ToString());
        }
    }

    private void PrintQueryResult(QueryResult queryResult)
    {
        Setting[] tmpSettings = queryResult.setting;
        Console.WriteLine("=====Given Settings====");

        foreach (Setting tmpSetting in tmpSettings)
        {
            Console.WriteLine(String.Format("{0}[{1}]", tmpSetting.name, tmpSetting.Item));
        }

        Console.WriteLine();
        SettingOptions[] tmpSettingOptions = queryResult.settingOptions;
        Console.WriteLine("=====Possible Valid Values====");

        foreach (SettingOptions tmpSettingOp in tmpSettingOptions)
        {
            PrintPossibleValues(tmpSettingOp);
        }

        Console.WriteLine();
        Console.WriteLine();
    }
}

 

Configuring a Sarix IP camera's stream


You should use this service in conjunction with the QueryAllOptions and GetAllCurrentConfiguration action. Specifically, users will need to use the current configuration as a starting point using the GetAllCurrentConfiguration action. Please refer to refer to Frequently Asked Questions in the Sales and Support area of pelco.com.

 


This is an advanced camera function. Changing a stream's configuration may result in a difficult to resolve problem that may require resetting a camera's configuration. Please refer to the How do you reset a camera's configuration to default factory settings? entry for details.

 

 

Please refer to the Pelco Device Control URL and Pelco Device Port Number entries, in the Getting Started section, for important details about the code sample.

One of the main features of Sarix's StreamConfiguration service (and any future product supporting this service) is that it will list all possible settings including possible valid values for these settings. This will also take into account possible values for one setting in relation to other settings that are interdependant. For example if the resolution and framerate settings are set above a certain threshhold, then the sign setting will only allow a false value.


For many situations, using the StreamConfiguration service for determining valid configuration settings and applying them is more than likely an iterative process. e.g.

  1. User queries possible valid settings.
  2. User makes a configuration change.
  3. User queries possible valid settings for other settings to change.
  4. User makes a configuration change.
  5. User queries possible valid settings for other settings to change.
  6. User makes a configuration change.
  7. ...The cycle repeats until the user has no more settings to change...

To configure a stream, do the following:

 

  1. Create a new instance of the class that acts as a representative of the StreamConfiguration web service
  2. Retrieve the desired stream's current configuration. Please refer to Determining possible valid stream configuration values given desired configuration values 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 that you would like to maintain are not reset to factory default values.
  1. Make a SaveAllSettings request using the StreamID instance and StreamSetting instance as parameters. The StreamSetting instance should be the result of iteratively calling the QueryAllOptions action as described in the Determining possible valid stream configuration values given desired configuration values entry.

Users must submit all configuration settings, even settings that do not change in value. Failure to do so will result in the Sarix IP camera rejecting the SaveAllSettings request. Furthermore, if the Sarix IP camera determines that the combination of setting values is invalid, it will also reject the SaveSettings request.

C# Example

using System;
using System.ServiceModel;
using StreamConfigurationRef; //the service reference to use

static class Program
{
    static void Main()
    {
        //Not the recommended method of determing a control URL; used here only for simplicity.
        string cameraAddress = "http://10.220.196.178/control/StreamConfiguration-1"; //camera URL or IP address followed by the port number

        try
        {
            System.Net.ServicePointManager.Expect100Continue = false;

            StreamConfigurationPortTypeClient client = 
                new StreamConfigurationPortTypeClient(new BasicHttpBinding(), 
                new EndpointAddress(cameraAddress + "/control/StreamConfiguration-1"));

            SarixSamples.StreamConfigurationRef.StreamID streamId = 
                new SarixSamples.StreamConfigurationRef.StreamID() { id = 0, type = "video" };

            Setting encoding = new Setting();
            encoding.name = "encoding";
            encoding.Item = "H264";

            Setting bitRate = new Setting();
            bitRate.name = "bitrate";
            bitRate.Item = 2500000;

            QueryResult result = client.GetAllCurrentConfiguration(streamId); //Get stream configuration

            Setting[] settingsCriteria = result.setting;

            //Replacing old settings with new ones
            for (int i = 0; i < settingsCriteria.Length; i++)
            {
                Setting tmpSetting = settingsCriteria[i];

                if (tmpSetting.name.Equals("encoding"))
                {
                    settingsCriteria[i] = encoding;
                }
                else if (tmpSetting.name.Equals("bitrate"))
                {
                    settingsCriteria[i] = bitRate;
                }
            }

            StreamIDSettings streamIDsetting = new StreamIDSettings();
            streamIDsetting.settings = settingsCriteria;
            streamIDsetting.stream = streamId;

            StreamIDSettings[] streamIDsettings = { streamIDsetting };

            client.SaveAllSettings("video", streamIDsettings);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.ToString());
        }
    }

    static String getDescriptiveName(QueryResult result)
    {
        Setting[] settings = result.setting;

        foreach (Setting tmpSetting in settings)
        {
            if (tmpSetting.name == "descriptiveName")
            {
                return (String)tmpSetting.Item;
            }
        }

        return null;
    }

    //This method makes all the configuration changes
    static protected Setting[] getSettings(String profileName)
    {
        Setting descriptiveName, bitRate, gop, gopStructure, frameRate, resolution, signSetting, dscp, rateControl, profile, encoding;

        if (profileName == "default settings stream")
        {
            bitRate = new Setting() { name = "bitrate", Item = 3693826 };
            encoding = new Setting() { name = "encoding", Item = "H264" };
            gop = new Setting() { name = "gop", Item = 30 };
            gopStructure = new Setting() { name = "gopStructure", Item = "IP" };
            frameRate = new Setting() { name = "framerate", Item = 15M };
            descriptiveName = new Setting() { name = "descriptiveName", Item = "test1" };
            dscp = new Setting() { name = "dscp", Item = 33 };
            signSetting = new Setting() { name = "sign", Item = true };
            rateControl = new Setting() { name = "rateControl", Item = "CBR" };
            profile = new Setting() { name = "profile", Item = "High" };

            Resolution res = new Resolution() { height = 720, width = 1280 };
            resolution = new Setting() { name = "resolution", Item = res };
        }
        else
        {
            bitRate = new Setting() { name = "bitrate", Item = 3693826 };
            encoding = new Setting() { name = "encoding", Item = "H264" };
            gop = new Setting() { name = "gop", Item = 30 };
            gopStructure = new Setting() { name = "gopStructure", Item = "IP" };
            frameRate = new Setting() { name = "framerate", Item = 30M };
            descriptiveName = new Setting() { name = "descriptiveName", Item = "default settings" };
            dscp = new Setting() { name = "dscp", Item = 33 };
            signSetting = new Setting() { name = "sign", Item = false };
            rateControl = new Setting() { name = "rateControl", Item = "CBR" };
            profile = new Setting() { name = "profile", Item = "High" };

            Resolution res = new Resolution() { height = 720, width = 1280 };
            resolution = new Setting() { name = "resolution", Item = res };
        }

        Setting[] settings = { descriptiveName, encoding, frameRate, resolution, signSetting, bitRate, gop,
            dscp, rateControl, profile, gopStructure};

        return settings;
    }
}

 

For configuring contrast, saturation, and brightness settings ONLY


The current line of ID and IX series of Sarix cameras still uses the CameraConfiguration service for certain settings. For details, lease refer to the Contrast, Saturation, and Brightness entry within the StreamConfiguration Issues section.

It is not recommended to use the CameraConfiguration service for any settings other than contrast, saturation, and brightness.

 

  1. If you have not already done so, please refer to the Getting Started section.
  2. Account for the HTTP 100-continue header. Failure to do so will result in an error since Sarix IP cameras will not respond with a "100 (Continue)".
  3. Initialize an instance of the class that acts as a representative of the CameraConfiguration web service.
  4. Retrieve the IP camera's current configuration
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 that you would like to maintain are not reset to factory default values.
  1. Change the contrast, saturation, and brightness settings.
  2. Make a SetConfiguration request using the CameraConfig instance as the parameter.

C# Example

using System;
using System.ServiceModel;
using CameraConfigurationRef; //the service reference to use

static class Program
{
    static void Main()
    {
        //Not the recommended method of determing a control URL; used here only for simplicity.
        string cameraAddress = "http://10.220.196.178/control/CameraConfiguration-1"; //camera URL or IP address followed by the port number
        System.Net.ServicePointManager.Expect100Continue = false;

        CameraConfigurationPortTypeClient client = 
            new CameraConfigurationPortTypeClient(new BasicHttpBinding(),
            new EndpointAddress(cameraAddress));

        CameraConfig camConfig = client.GetConfiguration();

        MVElement brightness = new MVElement() { mode = 0, value = 50 };
        MVElement hue = new MVElement() { mode = 0, value = 50 };

        VideoProperties vidProps = camConfig.videoproperties;
        vidProps.brightness = brightness;
        vidProps.hue = hue;
        client.SetConfiguration(camConfig);
    }
}

 

Enabling audio and the AudioOutput service

 

 Please refer to the Pelco Device Control URL and Pelco Device Port Number entries, in the Getting Started section, for important details about the code sample.

 

  1. If you have not already done so, please refer to the Getting Started section.
  2. Account for the HTTP 100-continue header. Failure to do so will result in an error since Sarix IP cameras will not respond with a "100 (Continue)".
  3. Initialize an instance of the class that acts as a representative of the CameraConfiguration web service.
  4. Retrieve the IP camera's current configuration
 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 that you would like to maintain are not reset to factory default values.
  1. Set the audioEnable attribute to true (1) within the CameraConfig data type.
  2. Make a SetConfiguration request using the CameraConfig instance as the parameter.

C# Example

using System;
using System.ServiceModel;
using CameraConfigurationRef; //the service reference to use

static class Program
{
    static void Main()
    {
        //Not the recommended method of determing a control URL; used here only for simplicity.
        string cameraAddress = "http://10.220.196.178/control/CameraConfiguration-1"; //camera URL or IP address followed by the port number
        System.Net.ServicePointManager.Expect100Continue = false;
        CameraConfigurationPortTypeClient client = new CameraConfigurationPortTypeClient(new BasicHttpBinding(),new EndpointAddress(cameraAddress));
        CameraConfig camConfig = client.GetConfiguration();
        camConfig.audioEnable = 1;
        client.SetConfiguration(camConfig);
    }
}