Documente Academic
Documente Profesional
Documente Cultură
4 Programming Guide
C5617M-H
04 / 2014
Contents
Contents
2 C5617M-H
Contents
C5617M-H 3
Contents
4 C5617M-H
Contents
C5617M-H 5
Contents
6 C5617M-H
Introduction to the Pelco SDK
NOTICE
The set of sample programs provided with the Pelco SDK is considered a
reference implementation for educational purposes. In general, Pelco sample
programs are not intended for immediate production use without modification. For
details, see About Sample Code on PDN.
C5617M-H 7
Introduction to the Pelco SDK
Exporter Component Exports video streams and stores on disk; available only
for Pelco Endura video management systems. For Pelco
Aggregation systems, you can use the Clip and Exporter
classes instead.
Metadata Parser Extracts audio and video metadata.
Event Arbiter Library Handles device events such as motion and analytics.
and Event Manager For events that are related to the SDK process or for
determining whether devices are on line or off line, use the
Event and Events classes.
Pan, Tilt, Zoom (PTZ) Controls a camera's viewing position, for example, pan, tilt,
Control Wrapper zoom, iris, and focus.
Legacy Components
We use the term "legacy" to refer to the components whose functionality has been
replaced by Pelco SDK classes. Do not use the following components in new Pelco
applications as they will become obsolete soon.
8 C5617M-H
Introduction to the Pelco SDK
Another way to communicate directly with Pelco devices is through the Pelco API,
bypassing the Pelco SDK altogether. Pelco API is a set of SOAP-based web services
which you access through WSDL files. The Pelco API is a public interface and can
be used in the same way as other web-service interfaces. For integration developers
who have previously created web service-based applications, working with the Pelco
API is straightforward. For details on the Pelco API, refer to Introduction to the Pelco
APIon Pelco Developer Network (PDN).
The following illustration shows additional Object Model classes. For event handling,
you can use the Event class to declare the types of events to handle and the Events
class to subscribe to listeners (shown above). You can use the Exception class to
handle exceptions for error conditions in the Object Model. You can use PString,
PList, and PTime classes for ease in handling lists, strings, and time values.
C5617M-H 9
Introduction to the Pelco SDK
Class Function
Administrator Manages all systems without requiring the user name and
password of any single system. The Administrator class
represents a "superuser" whose credentials supersede the
admin credentials of all individual systems. For details, see
Administrator Class Overview.
Camera Manages an IP camera such as a Sarix ® or Spectra® model. See
Viewing and Recording Video Streams.
Channel Transmits a single channel of video to a multichannel remote
monitor. The Channel class represents video that appears in a
rectangle on the network display. See Using Network Displays.
Clip Creates an excerpt of recorded video by specifying the start and
stop time. Used with the Exporter class to export video to disk.
Device Manages a physical device contained in the video management
system. The Device class can represent a camera, encoder,
decoder, digital video recorder (DVR), or network video recorder
(NVR). See Using System and Device Objects.
Display Displays video streams in a window on a monitor. Multiple
streams appear in separate windows. The Display class
represents a local monitor attached to the computer on which the
SDK is running. See Viewing and Recording Video Streams.
Event Defines the type of events to listen for, such as whether a device
is online or if its properties change, or whether a Stream fails.
See Using the Event Objects.
EventListener Listens for events and calls the event handler when an event
is fired. The GlobalEventListener class listens for global events
across the entire system collection, such as the SDK state. The
SystemEventListener class listens for events on a specific system
and its associated devices. See Using the Event Objects.
Events Subscribes and unsubscribes to events. See Using the Event
Objects.
Exception Handles exceptions on Try and Catch execution. The Exception
class can return error codes and messages.
Exporter Exports recorded video and saves it to PEF format. Available for
Pelco Aggregation systems only.
10 C5617M-H
Introduction to the Pelco SDK
Class Function
NetworkDisplay Displays video on a remote monitor, where each video channel
appears in a rectangle on the monitor. The NetworkDisplay class
allows an operator to manage monitors residing elsewhere on
the network from a local computer running the SDK. See Using
Network Displays.
Property Defines and manages arbitrary name/value pairs used in your
application.
PString Defines and manages character strings.
PTime Retrieves and sets time by day, hour, minute, month, year, and
so on.
Stream Plays live or recorded video. If recorded, makes available the
typical video controls such as pause and rewind. See Viewing
and Recording Video Streams.
Stream Changes how the Stream class behaves, for example, its frame
Configuration rate, format (MJPEG or MPEG-4/H.264), protocol (RTP, RTSP,
or HTTP), delivery mode (unicast or multicast) or whether it
contains audio. See Working with Stream Configurations.
System Creates and manages systems and devices. The System class
represents a system manager (SM) or a Pelco Edge system,
which is a collection of cameras or other devices without an
SM to manage it. It can also represent a system that allows
applications to send calls directly to a Pelco Aggregation System.
See Using System and Device Objects.
Multiple Enables iterating over a collection. The collection can consist of
Collection one of these classes: Channel, Device, Property, and System.
classes See Collection Objects.
C5617M-H 11
Using Systems and Devices
Currently, the System class can represent the following Pelco video management
system products:
• Endura, the Pelco video management system that is managed by a system
manager (SM) appliance such as an SM5200 or SM5000.
• Pelco Aggregation Software, which allows Endura customers to monitor multiple
Endura installation sites through a common user interface.
• Pelco Edge system, which is a Pelco SDK "virtual" system that enables SDK
applications to connect to cameras without using a system manager.
• Digital Sentry products: Network Video Recorder and Analog Encoder.
• DX 47/4800 Series.
To initialize an instance of a System, you specify its System provider and Scheme.
12 C5617M-H
Using Systems and Devices
TIP
The above table shows that Pelco Aggregation can be implemented using
either the pelcosystem or pelcoaggregationdirect provider. To enable
the Pelco SDK device cache mechanism, you must use the pelcosystem
when creating the Pelco Aggregation system. If you don't want to use the
Pelco SDK device cache, create the Pelco Aggregation system with the
pelcoaggregationdirect provider.
System Scheme
C5617M-H 13
Using Systems and Devices
When you initialize a system, you specify the type of system provider in its system
scheme. A system scheme resembles a Web address, more specifically, the top level
of the URI naming structure. The system scheme format is as follows:
[user:pass@]provider_name://[ipaddress:port][?alias=System Name]
where
The following example creates a Pelco System with "admin" as a user name and
password and "PelcoSystem" as an alias.
PelcoSDK::System system("admin:admin@pelcosystem://1.2.3.4:80?
alias=PelcoSystem");
Device Cache
To improve Pelco SDK runtime performance, the SDK stores device information
locally on the computer where it is running. This is called the device cache. Once
the device cache is populated with device information from devices on the network,
subsequent requests for the information go to the local cache instead of over the
network.
NOTE: The system providers pelcosystem and pelcoedgedevices make use of
the device cache. The pelcoaggregationdirect system provider does not. For
more on system providers, see System Providers and Schemes.
The device cache maintains information about devices (cameras, encoders, and
so on) that are connected to the Pelco system. If the Pelco network is configured
with multiple systems, a device can be associated with multiple systems. If the
pelcosystem provider is connected only to a Pelco Aggregation system, only
cameras and encoders are collected.
14 C5617M-H
Using Systems and Devices
Device information is defined by the Device class. It includes the Device type, UUID,
model number, and so on. For a list of all Device properties, refer to the Device Class.
During program execution, the Pelco SDK runs a background process to
query the network and updates the device cache with the latest information
on systems and devices. By default, the background process refreshes the
device cache database every five minutes. You can change the interval with the
System.SetRefreshSeconds() method.
How Device Information Is Collected
How the device cache is populated depends on the system provider:
Pelco System: The SDK queries the devices over the network,
pelcosystem which is called Discovery. Discovery can be
automatic or direct. If the IP address is not provided
when the system is created, the SDK searches
the network for a System Manager (SM) and
automatically adds the devices associated with
that SM to the device cache. This process is called
autodiscovery. Alternatively, when an IP address
is provided, the SDK queries the specified SM
to discover the devices associated with it. This
is called direct discovery. See Creating a Pelco
System.
Pelco Edge System: Devices are added manually by the application.
pelcoedgedevices Without a system manager, the Pelco SDK
cannot discover devices. Instead, you add the
Pelco system and its associated devices to the
device cache directly using Add() method of
SystemCollection and DeviceCollection
classes, respectively. Once cached, the Pelco Edge
Systems are handled the same way as systems
containing a system manager. See Creating a Pelco
Edge System.
Pelco Aggregation Does not use the device cache. See Creating a
Direct System: Pelco Aggregation Direct System.
pelcoaggregationdirect
Retrieving Devices
Your application gets device information from the device cache using the
DeviceCollection class. How you retrieve the information depends on whether
this is a Pelco or Pelco Edge System.
To retrieve the information from the device cache, you perform these steps:
1. If this is a pelcosystem, retrieve the DeviceCollection. It is already
populated with information from the device cache.
2. If this is a pelcoedgedevices, retrieve the DeviceCollection
and populate it with information about devices on the network using the
Device.Collection.Add() method.
3. Loop over the DeviceCollection.
4. Retrieve the current device.
5. Move on to the next device in the collection.
Once you have created a Pelco System or Pelco Edge system, iterate over the
returned DeviceCollection object to locate a specific device. These devices are
stored in the system's DeviceCollection (device cache), in memory, and on disk.
NOTE: For information on iterating over collections, see Iterating Over Collections.
C5617M-H 15
Using Systems and Devices
Code Example
Here's a code example of retrieving a list of a devices connected to the system and
displaying the name of each device.
return 0;
}
16 C5617M-H
Using Systems and Devices
Device Class
The Device class defines the following information for devices. Most properties are
shared across all devices. The Camera and Network Display classes are derived from
Device and contain additional information specific to the device type.
C5617M-H 17
Using Systems and Devices
.NET
Pelco.SDK.Application.Startup();
Pelco.SDK.Application.Shutdown();
C++
PelcoSDK::Startup();
PelcoSDK::Shutdown();
Here is an example that shows how to start up the Pelco SDK runtime from a
C#/.NET application. This application takes advantage of .NET features including
Windows® Forms.
namespace ViewVideo
{
static class Program
{
// .NET
Application.EnableVisualStyles();
// .NET
Application.Run(new LoginForm());
}
catch(Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}
finally
{
// Stop the SDK runtime
Pelco.SDK.Application.Shutdown();
}
}
}
}
18 C5617M-H
Using Systems and Devices
PelcoSDK::System system("admin:admin@pelcosystem://10.220.196.187:60001?
alias=MySystem");
where
admin:admin@ The user name and password for the System. If you
do not supply credentials, the System is readonly
until you log in. See the note below.
pelcosystem:// The system provider, in this case, the Pelco
System, which can represent one of these video
management systems: Endura system, Pelco
Aggregation, Digital Sentry, and DX 47/4800 Series.
Required.
ipaddress:port The IP address and port number of the system.
For Endura systems, if you do not specify the IP
address, the Pelco SDK runtime automatically
queries the network for a system manager and its
associated devices; if an IP address is specified,
Pelco SDK discovers the devices on the specified
SM.
?alias=MySystem A query string to define another name
for the System. Set this to any unique
value for the System. Then, use the
SystemCollection.GetItemByKey method to
retrieve the system at a later time. Optional.
NOTE:
If the user name and password are not provided, you do not have full access
to the system. You can retrieve basic properties of a system such as the
display name, IP address, port, alias, and system refresh time. However, any
attempt to call the following methods throws an exception with an error code of
PelcoSDK::NotAuthenticated:
• GetDeviceCollection()
• GetDevice()
• SetRefreshTime()
• SetAlias()
• Remove()
Once you log in to the system you have full access.
NOTE: If you have multiple systems on different subnets, you must supply the IP
address for the SM. This is because the Pelco SDK cannot detect system managers
outside the subnet on which it is running.
Creating a Pelco system takes the following steps.
1. Construct a system specifying pelcosystem as the provider in the system
scheme. Pelco SDK discovers the devices on the network and creates a
DeviceCollection of existing devices and stores it in the device cache.
2. Iterate over the device collection to retrieve the desired device.
Code Example
C5617M-H 19
Using Systems and Devices
Here's a complete code example that creates a PelcoSystem object, displays the
model name of each device, and gives the number of devices in the device collection.
// Loop over the device collection object and display each device name
printf("\n\n> DEVICES =================================\n");
for (deviceCollection.Reset(); deviceCollection.MoveNext(); )
{
// Retrieve the current device object
PelcoSDK::Device device(deviceCollection.Current());
20 C5617M-H
Using Systems and Devices
PelcoSDK::System system(“admin:admin@pelcoaggregationdirect://
10.220.196.187?alias=PelcoDirect”);
NOTE: Do not specify a port number here. Pelco Aggregation uses SSL and the
default SSL port is supplied by default (443).
Retrieving Device Information Directly
Once the System instance is created, retrieve device information directly from a
specific device using the System.GetDeviceByAttribute method.
The System.GetDeviceByAttribute method takes as parameters an attribute
and its value. Attribute is an enum value, which can be either camera number or
device UUID. Value is a string. The following example retrieves a camera with a
camera number is 2.
PelcoSDK::System s2(SDKVxPelcoDirect);
PelcoSDK::Device dev = s2.GetDeviceByAttribute(PelcoSDK::kCAMERA_NUMBER, "2");
NOTE: If you don't specify a user name and password with the scheme, you will
receive authentication exceptions until you log in to the system.
C5617M-H 21
Using Systems and Devices
//Remove device
22 C5617M-H
Using Systems and Devices
deviceCollection.Remove(device);
}
}
NOTE: The Remove() method also removes any devices associated with the
removed device.
Removing a Pelco Edge System from the System Collection
A Pelco Edge System is listed in the same device cache as all other devices in the
Pelco network (once the devices have been added manually). You can delete a Pelco
Edge system from the device cache using the SystemCollection class.
Here are the steps to remove the Pelco Edge system:
1. Retrieve the system that you want to remove.
2. Remove the system.
Here's a code example of removing a Pelco Edge system.
C5617M-H 23
Using Systems and Devices
Some collections provide additional operations based on the type of object. For
example, a SystemCollection contains methods to add and remove systems from the
collection; this is for use with Pelco Edge systems.
24 C5617M-H
Viewing and Recording Video Streams
The following figure shows that it takes Camera, Display, and Stream classes to
display a video.
IMPORTANT
These Object Model classes replace the Pelco API Viewer functionality and
provide a simpler, cleaner way to process video streams. Pelco API Viewer should
not be used in active development.
The StreamConfiguration class gives you the ability to change stream settings. For
example, changing:
• Delivery mode
• Video format
• Frame rate
Stream Events
You can check for failures on streams with the StreamEvent class. For details on
handling events for the Pelco SDK Object Model classes, see Using Stream Events.
Supported Video Formats
C5617M-H 25
Viewing and Recording Video Streams
26 C5617M-H
Viewing and Recording Video Streams
The Display class represents a viewable area for an application. The Display
object requires only an HWND reference for its initialization so a stream image can
be shown in almost any Windows® window, including the console.
NOTE: You can get and set a camera number for the camera. However,
Endura systems (pelcosystem) allow multiple cameras to have the same camera
number. Therefore, you cannot count on a camera's number being unique. Pelco
Aggregation systems (pelcoaggragationdirect) do not allow multiple cameras to
have the same camera number.
C5617M-H 27
Viewing and Recording Video Streams
1. After initializing a Stream object, call the Stream Play() method to playback
recorded video. In this example, the playback is requested in reverse direction
using a negative speed value. The speed constant kREV_2X specifies reverse
direction at two times standard speed.
If the camera associated with the stream has an associated recorder (NVR/NSM)
with recorded video, the stream starts playing in reverse at two times normal
speed. If the associated recorder does not contain recorded video, there is no
playback stream. This causes an exception of type Pelco.SDK.Exception() to
occur providing the following error code and message:
• Error code: NoRecordingFound
• Error message: "No recording found on NVR or failed to connect"
The error occurs when the Play() method is called. Following the error, the next
call of the Play() method jumps the stream to the dateTime that was previously set
by Seek(dateTime).
2. Playback of a stream can be jumped to a specific date, or time, by calling the
Seek() method with a System.DateTime. The following example creates a
dateTime that is 24-hours in the past and calls Seek on the Stream.
The following example plays the stream forward at 60x the standard speed.
There are predefined speed value constants for typical use described in the
following table. Their use is demonstrated in the above examples.
28 C5617M-H
Viewing and Recording Video Streams
The following code plays the stream in reverse at 16x the standard speed.
There are predefined speed value constants for typical use described in the
following table. Their use is demonstrated in the above examples. Note that a
negative value results in reverse stream direction.
C5617M-H 29
Viewing and Recording Video Streams
Pausing a Stream
Use the Pause() method to pause a stream.
30 C5617M-H
Viewing and Recording Video Streams
_stream.FrameForward();
Taking a Snapshot
This section describes how to capture a snapshot of a single frame of video.
Use the Snapshot() method to take a snapshot of a single frame of video.
NOTE: The Snapshot() method call requires a fully qualified path and file name
for saving the snapshot.
NOTE: The valid levels for volume are "0" to "100"; the higher the number, the
higher the volume.
Value Description
0 Mute
1-100 Low volume (1); high volume (100); any
level in between
The stream state value returned can be "0", "1", "2" or "3." These values are
defined in the following table.
C5617M-H 31
Viewing and Recording Video Streams
The stream state value returned can be "0", "1", "2" or "3." These values are
defined in the following table.
32 C5617M-H
Viewing and Recording Video Streams
//Subscribe
class ITimestampDelegate
{
public:
virtual ~ITimestampDelegate()
{
}
virtual void Notify(const __int64 timestampTicks) = 0;
};
Unregister a Timestamp
In C#, to stop receiving timestamps:
//Unsubscribe
stream.UnsubscribeTimestamp();
C5617M-H 33
Viewing and Recording Video Streams
The SDK uses a set of defaults for the Stream class which should work for most
situations. However, you can use the Stream Configuration class to change these
defaults. To do so, you can request StreamConfiguration information from a Stream
object, create a new StreamConfiguration object, or modify an existing one.
The default values for streams are as follows:
34 C5617M-H
Viewing and Recording Video Streams
// Retrieve a system.
System system = new System("admin:admin@pelcosystem://10.11.12.13");
// If the video format is not already MJPEG, set it to be MJPEG in the Stream
instance.
if (streamVideoFormat.StreamFormatMJPEG != streamConfig.videoFormat)
{
streamConfig.videoFormat = StreamVideoFormat.StreamFormatMJPEG;
stream.StreamConfig = streamConfig;
}
NOTE: There are three possible video format types, one for motion JPEG (MJPEG),
one for MPEG4 or H.264, and a system default. See example below:
C5617M-H 35
Exporting Video with Clip and Exporter
Classes
Exporter Class
The Exporter class represents the export process. Exported video is in PEF format.
By default, it exports video without audio. In fact, currently, PEF is the only format
supported and audio is not supported.
The following methods of the Export class allow you to control the export process.
36 C5617M-H
Exporting Video with Clip and Exporter
Classes
• IExportStatusDelegate
Exporting Video
To export video from a camera, follow these steps:
1. Create a System instance that references an existing Pelco Aggregation system.
2. Query the System for available devices.
3. Select a camera.
4. Create a Clip object from the Camera.
5. Create an Exporter object that references the Clip.
6. Export the Clip.
NOTICE
This example creates a System using the pelcosystem:// provider because
it assumes that it is a normal Pelco Aggregation system. Typically, Pelco
Aggregation systems use the pelcosystem:// provider because it has the Pelco
SDK maintain its device collection.
You might think that you would use the pelcoaggregationdirect provider,
but that's not intended for general use. For details, see System Providers and
Schemes for more on the provider types.
{
// Select a device from the list
PelcoSDK::Device device = collection.GetItem( index );
C5617M-H 37
Exporting Video with Clip and Exporter
Classes
example gets a camera from the system and creates a video clip from the camera,
then exports it with an Exporter object.
if ( found == true )
{
PelcoSDK::Camera camera = system.GetDeviceCollection().GetItem( index );
exporter.Start();
}
38 C5617M-H
Exporting Video on Endura Systems
Getting Started
C5617M-H 39
Exporting Video on Endura Systems
What’s Ahead
This is a high level overview of possible tasks related to export.
1. Set up desired video clips to export.
• Configure desired parameters for each video clip to export.
• If overlays are desired, set up overlays for each video clip.
2. Start the export, and continue to poll its status until it finishes successfully or
encounters an error.
(Optional) The end port to The exporter keeps increasing port numbers
use if initial port is in use. starting with the initial port number until the end
port is reached.
PelcoAPI::EnduraExporter exporter;
exporter.Setup("C:\\Program Files\\Pelco\\API\\Libs\\Debug\\Plugins",
"10.220.196.187", "10.220.196.189", USERNAME, 8000, -1);
40 C5617M-H
Exporting Video on Endura Systems
pEnduraExporterNet.Setup("C:\\Program Files\\Pelco\\API\\Libs\\Debug\
\Plugins",
enum OverlayType
{
OVERLAY_TYPE_TIMESTAMP = 0,
OVERLAY_TYPE_CAMERANAME = 1,
OVERLAY_TYPE_TEXTSTRING = 2,
OVERLAY_TYPE_PICTURE = 3
};
exporter.OverlayData(PelcoAPI::OVERLAY_TYPE_TIMESTAMP,
PelcoAPI::OVERLAY_LOCATION_BOTTOM_LEFT, NULL, FONTNAME, 10,
fontColor, fontBgColor, 0);
pEnduraExporterNet.OverlayData(PelcoAPI.OverlayTypeNet.OVERLAY_TYPE_TIMESTAMP,
PelcoAPI.OverlayLocationNet.OVERLAY_LOCATION_BOTTOM_LEFT, "",
FONTNAME, 10, FONTCOLOR, FONTBGCOLOR, 0, DATEFORMAT,
TIMEFORMAT);
• If performing a stitched video clip export described in Stitching
Multiple Clips Into a Single Video Export, the user must use an
OverlayInfo/OverlayInfoNet instance for each overlay type wanted
before starting the export.
exportInfo[i].overlayInfo = new
PelcoAPI::OverlayInfo[overlayNum];
exportInfo[i].overlayInfo[0].type =
PelcoAPI::OVERLAY_TYPE_TIMESTAMP;
// configure other parameters for the 1st overlay
C5617M-H 41
Exporting Video on Endura Systems
OverlayData Parameters
OverlayData contains the following parameters. (Note that PPX export does not
currently support overlays.)
Now create a new instance of OverlayInfoNet and, based on the type of overlay
you chose, simply start assigning the desired values with it such the font to use,
the color of the font, the location of the overlay, and so on.
The following is a list of other overlay settings (some can apply to certain overlay
types as noted):
enum OverlayLocation
{
OVERLAY_LOCATION_UNKNOWN,
OVERLAY_LOCATION_TOP_LEFT,
OVERLAY_LOCATION_TOP_MIDDLE,
OVERLAY_LOCATION_TOP_RIGHT,
OVERLAY_LOCATION_CENTER,
OVERLAY_LOCATION_BOTTOM_LEFT,
OVERLAY_LOCATION_BOTTOM_MIDDLE,
OVERLAY_LOCATION_BOTTOM_RIGHT,
OVERLAY_LOCATION_COORDINATE
};
42 C5617M-H
Exporting Video on Endura Systems
enum DateFormat
{
DATE_FORMAT_MDYYYY = 0,
DATE_FORMAT_MDYY = 1,
DATE_FORMAT_MMDDYY = 2,
DATE_FORMAT_MMDDYYYY = 3,
DATE_FORMAT_YYMMDD = 4,
DATE_FORMAT_YYYY_MM_DD = 5,
DATE_FORMAT_DD_MM_YY = 6,
DATE_FORMAT_DMYY = 7,
DATE_FORMAT_DDMMYY = 8,
DATE_FORMAT_DMYYYY = 9,
DATE_FORMAT_DDMMYYYY = 10,
DATE_FORMAT_YYMD = 11,
DATE_FORMAT_YYYYMD = 12,
DATE_FORMAT_YYYYMMDD = 13,
DATE_FORMAT_YYYY_M_D = 14,
};
C5617M-H 43
Exporting Video on Endura Systems
enum TimeFormat
{
TIME_FORMAT_HHMMSSTT = 10,
TIME_FORMAT_HMMSSTT = 11,
TIME_FORMAT_HMMSS = 12,
TIME_FORMAT_HHMMSS = 13,
TIME_FORMAT_HMSTT = 14,
TIME_FORMAT_TTHMS = 15,
TIME_FORMAT_TTHHMMSS = 16,
TIME_FORMAT_HMS = 17,
};
44 C5617M-H
Exporting Video on Endura Systems
Exporting Video
This section describes various video export methods and scenarios.
C5617M-H 45
Exporting Video on Endura Systems
The related source code for this entry (for C++) can be found in main.cpp’s main
function, which belongs to the Export C++ sample project. The related source code
for this entry (for C#) can be found in Program.cs’s Main function, which belongs to
the Export C# sample project.
1. Determine the System Manager’s IP address.
Refer to Automatically Determining the System Manager’s IP Address and Port
Number in the Device and Service Discovery section for details.
2. Initialize the Exporter.
Refer to Initializing the Exporter for details.
3. Optional: If you would like to overlay data onto the resulting export, do so now.
Refer to Setting Up Overlay Data on Video to Be Exported
4. Begin the video export by calling the Exporter’s StartExport() method, passing
in the following parameters:
enum VideoCodecType
{
CODEC_ID_NONE = 0,
/* video codecs */
CODEC_ID_MPEG1 = 1,
CODEC_ID_MPEG2 = 2,
CODEC_ID_MJPEG = 8,
CODEC_ID_MPEG4 = 13,
CODEC_ID_H264 = 28
};
46 C5617M-H
Exporting Video on Endura Systems
"uuid:691fd745-006c-4fc9-9822-23c13e977ce4");
Boolean bSuccess =
exporter.StartExport("D:\\Video\\test123.avi",
"uuid:691fd745-006c-4fc9-9262-23c13e977ce4",
PelcoAPI::CODEC_ID_MPEG4,
"2010-01-11T22:10:35", "2010-01-11T22:11:15", false,
"uuid:691fd745-006c-4fc9-9822-23c13e977ce4");
5. Poll the status of the video export repeatedly, for example, once per second, until
it is finished. For more information, refer to Polling a Video Export.
C5617M-H 47
Exporting Video on Endura Systems
EndTime The end time in UTC (GMT), not local time, using
the format yyyy-mm-ddThh:mm:ss
VideoOnly A boolean indicating if the clip should be
exported with video only. If false, audio is also
included.
ClipGroup An integer representing the sequential order in
which to play video clips. Up to four clips can be
in the same clip group which plays in sync within
the export player.
4. Begin the video export by calling the Exporter’s StartExport() method, passing
in the following parameters:
5. Poll the status of the video export repeatedly, for example, once per second, until
it is finished.
For more information, refer to Polling a Video Export.
48 C5617M-H
Exporting Video on Endura Systems
Path to exported video Including file name. The format changes based
on operating system, Windows® or Linux® .
Video format The desired resulting video format for the export.
Refer to the EnduraExporterDefines header
for the latest options.
enum VideoCodecType
{
CODEC_ID_NONE = 0,
/* video codecs */
CODEC_ID_MPEG1 = 1,
CODEC_ID_MPEG2 = 2,
CODEC_ID_MJPEG = 8,
CODEC_ID_MPEG4 = 13,
CODEC_ID_H264 = 28
};
int i = 0;
int clipNum = 2;
int overlayNum = 4;
exportInfo[1].sDeviceID =
"uuid:691fd745-006c-4fc9-9262-23c13e977ce4";
// configure other export settings for the 2nd clip to export
C5617M-H 49
Exporting Video on Endura Systems
if (overlayNum > 0)
{
for (i = 0; i < clipNum; i++)
{
exportInfo[i].overlayInfo = new
PelcoAPI::OverlayInfo[overlayNum];
exportInfo[i].overlayInfo[0].type =
PelcoAPI::OVERLAY_TYPE_TIMESTAMP;
// configure other settings for the 1st overlay
exportInfo[i].overlayInfo[1].type =
PelcoAPI::OVERLAY_TYPE_CAMERANAME;
// configure other settings for the 2nd overlay
exportInfo[i].overlayInfo[2].type =
PelcoAPI::OVERLAY_TYPE_PICTURE;
// configure other settings for the 3rd overlay
exportInfo[i].overlayInfo[3].type =
PelcoAPI::OVERLAY_TYPE_TEXTSTRING;
// configure other settings for the 4th overlay
}
}
5. Poll the status of the video export repeatedly, for example, once per second, until
it is finished.
For more information, refer to Polling a Video Export.
50 C5617M-H
Exporting Video on Endura Systems
{
int temp = exporter.PollStatus();
if (temp != status)
{
status = temp;
TRACE_INFO("Polling status %d\n", status);
}
}
}
Int32 clipCounter = 0;
while (clipCounter < num_clips)
{
Int32 status = 0;
Int32 temp = 0;
while (status < 100 && status != -1)
{
temp = pEnduraExporterNet.PollStatus(60);
if (temp != status)
{
status = temp;
Console.WriteLine("Polling status - {0}\n", status);
}
}
++clipCounter;
}
C5617M-H 51
Exporting Video on Endura Systems
52 C5617M-H
Using Network Displays and Channels
The following figure shows how channels transmit video from a camera to a network
display.
C5617M-H 53
Using Network Displays and Channels
Specifically, these are the steps to perform to set up a Network Display window for
viewing video data and determine which camera to display.
1. Retrieve the Camera from the Device Collection by its UUID.
3. Retrieve a channel from the Network Display's channel collection. Bind the camera
to the channel to view it. With the Camera, Network Display, and Channel Objects
created, all the pieces required to display the Camera on a Network Display
are present. The following example shows how to retrieve a channel and bind a
camera to it.
54 C5617M-H
Using Network Displays and Channels
NOTE: You can get and set a camera number for the camera. However, Endura
systems allow multiple cameras to have the same camera number. Therefore, you
cannot count on a camera's number being unique. However, camera numbers are
unique in Pelco Aggregation systems because multiple cameras are prohibited
from having the same camera number.
TIP
Use Identify() to detect the active network display. Use GetLayout() to
determine how many channels are displaying video.
C5617M-H 55
Managing Systems with the
Administrator Class
3. Handle the exception. This is how the exception would appear in context.
try
{
// Create an Administrator object with the default password 'admin'
Pelco.SDK.Administrator admin = new Pelco.SDK.Administrator("admin");
56 C5617M-H
Managing Systems with the
Administrator Class
Removing a System
Remove a system from the system collection using the RemoveSystem() method.
By removing the system, all the system's devices are removed as well. However,
if the device belongs to another system in the system collection, the device is not
deleted from the other system. In other words, a device is never entirely removed
from the system collection until all systems containing the device are removed.
Removing a system removes its entry from the device cache database, which is a
database that maintains the current status of all systems and devices in the system
collection. For details on the device cache database, refer to Device Cache.
Even though the Administrator class enables you to remove a system, it's expected
to be a rare occurrence. One case might be that you want to remove a Pelco Edge
system to create a new one.
WARNING
Perform this task with great caution. Removing a system removes all its devices.
1. Create an Administrator object with the current password. If the password hasn't
been changed, it is "admin".
NOTE: You can change the default password with the ChangePasswordTo()
method.
2. Retrieve the system you that want to remove. This example removes the first
system in the system collection. Note that removing a system removes all devices
related to the system as well.
NOTE: Removing the system object using the RemoveSystem() method does
not remove the object immediately. It is removed after all references to the object
have been released.
C5617M-H 57
Managing Systems with the
Administrator Class
You would rarely want to remove all systems except for, perhaps, in a test
environment where you want to wipe the database clean before reconfiguring the
systems.
WARNING
Perform this task with great caution. Removing all systems empties the device
cache database.
NOTE: You can change the default password with the ChangePasswordTo()
method.
2. Remove all systems from the system collection, emptying the database.
try
{
// Create an Administrator object with the default password 'admin'
Pelco.SDK.Administrator admin = new Pelco.SDK.Administrator("admin");
catch (Pelco.SDK.Exception)
{
System.Console.WriteLine("Failed to create Administrator object with
default password. The default password has already been changed.");
return;
}
}
58 C5617M-H
Managing Systems with the
Administrator Class
In the following example, one system is removed from the system collection using
the RemoveSystem() method. Note that deleting a system deletes all devices
associated with the system as well.
In the following example, all systems are removed using the RemoveAllSystems()
method.
C5617M-H 59
Using Event Classes
NOTE:
Currently, Event classes handle a small set of events and they are only available from
C++ programs. Future versions of the Pelco SDK will expand event functionality. In
the meantime, continue to use the components, Event Manager and Event Arbiter
Library to handle alarms, diagnostics, video analytics, and motion detection. Refer to
Events and Alarms for details.
Event Types
An Event is a data type that contains information about state changes of systems,
devices, or the SDK itself. Events are fired when certain system actions occur on
your network systems and devices. For example, these common system activities
generate events:
The following code examines the event type (eventType) and sets a string value
(typeStr).
switch (eventType)
60 C5617M-H
Using Event Classes
{
case Event::ET_ONLINE:
typeStr = "Device is on line";
break;
case Event::ET_PROPERTY_CHANGED:
typeStr = "Property changed";
break;
case Event::ET_SDK_STATE:
typeStr = "SDK state";
case Event::ET_STREAM:
typeStr = "SDK state";
break;
}
switch (eventType)
{
case Event::ET_ONLINE:
HandleOnlineEvent(ev);
break;
case Event::ET_PROPERTY_CHANGED:
HandlePropertyEvent(ev);
break;
case Event::ET_SDK_STATE:
HandleSdkStateEvent(ev);
break;
case Event::ET_STREAM:
HandleStreamEvent(ev);
break;
}
SDK States
The Pelco SDK defines a set of SDK states that can occur as a result of specific SDK
actions, such as when the SDK process goes down. Most of these states apply to the
SDK system collection process. When the SDK starts up, if a device cache collection
does not exist, the SDK starts the process of collecting information about available
systems and devices from the network. The collected information is then stored in the
local device cache database. While the SDK is collecting the information, it can fire
events to notify the application.
Possible SDK states are as follows:
The following code shows how the StateChangedEvent() method can be used
where stateToReport is the SDK state that caused the event to be fired.
C5617M-H 61
Using Event Classes
TERMINATING,
COLLECTION_STARTED,
COLLECTION_COMPLETED,
COLLECTION_FAILED,
SYSTEM_REMOVED,
COLLECTION_REMOVED = SYSTEM_REMOVED,
};
62 C5617M-H
Using Event Classes
This example includes code for an event handler, as described in Writing Event
Handlers. It also includes code for the Unsubscribe() method, which you should
use to unsubscribe to the event listener when done.
NOTE: It's important to unsubscribe to events to ensure that there are no active
subscriptions for an EventListener object that does not exist.
~OnlineEventListener()
{
_system.Unsubscribe( _subscription );
}
{
// This is the callback for the online event
// We know this is an online event so we can safely cast it
C5617M-H 63
Using Event Classes
private:
PelcoSDK::System _system;
PelcoSDK::EventSubscription _subscription;
};
try
{
system.Remove();
}
CATCH_PELCO_SDK_EXCEPTION
~OnlineEventListener()
{
_system.Unsubscribe( _subscription );
}
{
// This is the callback for the online event
64 C5617M-H
Using Event Classes
private:
PelcoSDK::System _system;
PelcoSDK::EventSubscription _subscription;
};
C5617M-H 65
Events and Alarms
IMPORTANT
Prior to the introduction of the Pelco SDK Object Model, the Pelco SDK contained
the Event Arbiter Library and Event Manager components for handling events.
These components are described here. As of 3.4, the Pelco SDK added an
additional event handling mechanism that uses Event classes defined in the Object
Model. At this time, the Event classes do not replace the functionality of these
Event Arbiter and Event Manager components. The Event classes are used to
handle events specific to Object Model classes. For details, see Using Event
Classes for details.
Events and alarms are essentially XML formatted messages triggered by Pelco
products when some particular criteria is met. Specifically, Pelco products act as
event providers and send the events and alarms to their subscribers. In most cases,
event providers are web services while subscribers are software clients. For example,
if an IP camera’s MotionDetection service detects movement within a particular region
in the video frame, it can send an event to all of its subscribers such as a VMS.
The Pelco SDK provides you with two components for handling events: the Event
Arbiter Library and the Event Manager.
Event Categories
Events that you can listen for (subscribe to) are organized by categories. To
subscribe, you specify which event category (or categories) that you want to listen for.
66 C5617M-H
Events and Alarms
NOTE: As of Pelco SDK 3.4, a third event mechanism exists: Object Model Events.
For details, refer to Using Event Classes.
This table compares the two event components to help you determine which one to
use for a particular circumstance.
Sample Code
The C# and C++ code used here illustrate how to use events and alarms. You can
find complete C# and C++ sample programs in a folder where you installed the Pelco
SDK: Pelco\API\SampleCode\EventArbiterSample.
NOTE: As indicated, some code samples work only with an Endura VMS. For more
specific information on Endura, refer to the Appendix.
For a list of the latest special issues and problems regarding the:
• Event Arbiter library, visit http://pdn.pelco.com/content/event-arbiter-library-issues
• Event Manager, visit http://pdn.pelco.com/content/event-manager-issues
NOTE: For the latest Pelco documentation, visit http://pdn.pelco.com.
C5617M-H 67
Events and Alarms
WARNING
Any provided sample code is meant to be a reference implementation focused
on educating developers about Pelco devices. Though there are exceptions, in
general Pelco sample code is NOT intended for immediate production use without
modification.
System Manager is available and the You can subscribe to all devices at once
EventArbiter web service is active that provide a particular web service.
All event data is available and parsed.
System Manager is available but the You can subscribe to a specific device's
EventArbiter web service is NOT active web service, but you cannot subscribe to
all devices at once.
Event Manager
The Event Manager is a component for handling events designed to be a simpler
alternative to the Event Arbiter Library. The Event Manager provides another
abstraction on top of the Event Arbiter Library, thereby simplifying event operations
even further. It allows subscriptions to all available web services for all devices on a
given network that fall under a specific category. To subscribe, you specify the event
category (or categories) that you want to handle. The categories are as follows:
• Alarm Array Configuration events
• Diagnostic Reporting events
• Motion Detection events
• Video Analytics events
68 C5617M-H
Events and Alarms
#include "PelcoAPI/Trace.h"
#include "PelcoAPI/EventArbiterDefs.h"
#include "MyEventAgent.h"
//=======================================================
// Constructor
//=======================================================
MyEventAgent::MyEventAgent() : m_nCounter(0)
{
}
//=======================================================
// Destructor
C5617M-H 69
Events and Alarms
//=======================================================
MyEventAgent::~MyEventAgent()
{
}
//=======================================================
// NotifyEvent
//=======================================================
void MyEventAgent::NotifyEvent(const char * szResponse, const Event * pEvent)
{
TRACE_INFO("Notify EVENT %d: \n", ++m_nCounter);
70 C5617M-H
Events and Alarms
class MyEventAgentNet:PelcoAPI.IEventAgentNet
{
Int32 nCounter = 0;
public void NotifyEvent(String sResponse, PelcoAPI.EventNet eventNet)
{
Console.Write("\nNotify EVENT {0}:\n", ++nCounter);
C5617M-H 71
Events and Alarms
72 C5617M-H
Events and Alarms
PelcoAPI::xstring sEvntUrl;
bSuccess = sm.GetDeviceServiceAttribute(loginId,
"UUID:B11DBF247E984B9BB83B7E74497DE6CA",
"urn:schemas-pelco-com:service:MotionDetection:1",
"SYS_UpnpEventSubUrl", &sEvntUrl)
3. Next, declare the Event Arbiter Library instance. Set the following parameters:
Network location and port The client machine where the Event Arbiter
number Library instance resides.
Event Agent Your implemented Event Agent to register.
System Manager’s IP Refer to Automatically Determining the System
address and port number Manager’s IP Address and Port Number for more
details.
C5617M-H 73
Events and Alarms
MyEventAgent agent;
PelcoAPI::IEventManager * pEventManager = new PelcoAPI::EventManager(
"10.220.196.200", "9716", &agent, false, "10.220.196.187", "60001");
enum EventType
{
EVENT_TYPE_UNKNOW = 0x00000000,
EVENT_TYPE_ALARM_ARRAY_CONFIGURATION = 0x000000001,
EVENT_TYPE_RELAY_ARRAY_CONFIGURATION = 0x00000002,
EVENT_TYPE_MOTION_DETECTION = 0x00000004,
EVENT_TYPE_VIDEO_ANALYTICS = 0x00000008,
EVENT_TYPE_DIAGNOSTIC_REPORTING = 0x00000010,
EVENT_TYPE_MASK = 0x0000001F
};
enum REGISTER_EVENTS
{
ALARM_ARRAY_CONFIGURATION = 0x00000001,
RELAY_ARRAY_CONFIGURATION = 0x00000002,
MOTION_DETECTION = 0x00000004,
VIDEO_ANALYTICS = 0x00000008,
DIAGNOSTIC_REPORTING = 0x00000010
}
74 C5617M-H
Events and Alarms
NOTE: Refer to the EventArbiterDefs header file for the latest options. If the
request was successful, the method returns true; false otherwise.
C5617M-H 75
Events and Alarms
3. Set the Event Arbiter Library instance's network location and port number, using
the local host IP address and port number.
pEventArbiter->SetupIPAndPort("10.220.196.200", "9716");
4. Register your Event Agent class with the Event Arbiter Library instance.
For details on creating an Event Agent, refer to Creating an Event Agent.
MyEventAgent agent;
pEventArbiter->RegisterEventAgent(&agent);
3. Next, declare the Event Arbiter Library instance. Set the following parameters:
Network location and port The client machine where the Event Arbiter
number Library instance resides.
Event Agent Your implemented Event Agent to register.
System Manager’s IP Refer to Automatically Determining the System
address and port number Manager’s IP Address and Port Number for more
details.
boolean True to force the EventArbiter library to use the
System Manager, false otherwise.
76 C5617M-H
Events and Alarms
2. Next, declare the Event Arbiter Library instance. Set the following parameters:
Network location and port The client machine where the Event Arbiter
number Library instance resides.
Event Agent Your implemented Event Agent to register.
System Manager's IP Use empty strings for parameters representing
address and port number the System Manager's IP address and port
number.
Boolean Set the last parameter to false to explicitly not
rely on the System Manager‘s EventArbiter
service.
Using the Event Arbiter Library to Subscribe Using the Device’s IP Address
NOTE: This entry is relevant for users who are not relying on either the System
Manager or its EventArbiter service. The related source code for this entry
can be found in EventArbiterSample.cpp’s main function (for C++) or
ManagedEventArbiterSample.cs’s main function (for C#), which belongs to the
Event Arbiter Library sample project.
This topic describes how to use the Event Arbiter Library to subscribe to a specific
device’s particular web service using the device’s IP address. Having an event
subscription simply tells a device that you would like to receive its event notifications.
To request a event subscription, the following must be done:
1. Initialize the Event Arbiter Library.
Refer to Initializing the Event Arbiter Library for details.
2. Call the Event Arbiter wrapper instance's SubscribeToEvents() method
(SubscribeEvents in C#), passing the event subscription URL.
For details, refer to Returning the Event Subscription URL. If the request was
successful, the method returns the event subscription's unique ID which allows
users to unsubscribe the event subscription. If unsuccessful, the method returns
NULL.
NOTE: The Pelco SDK automatically handles subscription renewals.
C5617M-H 77
Events and Alarms
78 C5617M-H
Events and Alarms
C5617M-H 79
Events and Alarms
Int32 nCounter = 0;
public void NotifyEvent(String sResponse, PelcoAPI.EventNet
eventNet)
{
Console.Write("\nNotify EVENT {0}:\n", ++nCounter);
Console.Write("\tUDN: {0}\n", eventNet.m_sUdn);
Console.Write("\tService ID: {0}\n", eventNet.m_sServiceId);
Console.Write("\tUTC Time: {0}\n", eventNet.m_sUtcTime);
Console.Write("\tType: {0}\n", eventNet.m_nType);
Console.Write("\tFriendly Name: {0}\n",
eventNet.m_sDeviceFriendlyName);
if (pEvent->m_nType ==
PelcoAPI::EVENT_TYPE_ALARM_ARRAY_CONFIGURATION)
{
//the camera associated to this event
pEvent->m_strAssociateCameraUdn.c_str();
if (eventNet.m_nType == 1)
{
Console.Write("\tAssociated Camera UDN: {0}\n",
eventNet.m_sAssociateCameraUdn);
for (Int32 i = 0; i < eventNet.m_alarmOrRelayInfo.GetLength(0);
i++)
{
Console.Write("\tAlarm ID: {0}\n",
eventNet.m_alarmOrRelayInfo[i].m_nId);
Console.Write("\t\tSeverity: {0}\n",
eventNet.m_alarmOrRelayInfo[i].m_nSeverity);
Console.Write("\t\tState: {0}\n",
(eventNet.m_alarmOrRelayInfo[i].m_bState ? "On" : "Off"));
}
80 C5617M-H
Events and Alarms
if (pEvent->m_nType ==
PelcoAPI::EVENT_TYPE_RELAY_ARRAY_CONFIGURATION)
{
for (size_t i = 0; i < pEvent->m_alarmOrRelayInfo.size();
i++)
{
pEvent->m_alarmOrRelayInfo[i]->m_nId;
pEvent->m_alarmOrRelayInfo[i]->m_bState;
}
}
else if (eventNet.m_nType == 2)
{
for (Int32 i = 0; i < eventNet.m_alarmOrRelayInfo.GetLength(0);
i++)
{
Console.Write("\tAlarm ID: {0}\n",
eventNet.m_alarmOrRelayInfo[i].m_nId);
Console.Write("\t\tState: {0}\n",
(eventNet.m_alarmOrRelayInfo[i].m_bState ? "On" : "Off"));
}
}
if (pEvent->m_nType ==
PelcoAPI::EVENT_TYPE_MOTION_DETECTION)
{
pEvent->m_bAlarmState;
}
else if (eventNet.m_nType == 8)
{
Console.Write("\tAlarm State: {0}\n", (eventNet.m_bAlarmState ? "On" :
"Off"));
Console.Write("\tSeverity: {0}\n",
eventNet.m_nVideoAnalyticsSeverity);
}
The szResponse parameter contains the raw event data in XML format. This is
useful for debugging, or XML data binding to your classes.
Polling Events
NOTE: The related source code for this entry can be found
in EventArbiterSample.cpp's main function (for C++) or
C5617M-H 81
Events and Alarms
pEventArbiter->RegisterEventAgent(NULL);
2. To poll events one by one using Event Arbiter or Event Manager, call the Event
Arbiter or Event Manager instance's PollEvent() method.
std::string strRawEvent;
PelcoAPI::Event pelcoEvent
// Additional logic...
if (pEventArbiter->PollEvent(strRawEvent, pelcoEvent))
// ...
82 C5617M-H
Viewing Video Streams with Pelco API
Viewer (Legacy)
IMPORTANT
The Pelco API Viewer is a legacy component for displaying streams and
controlling playback. The SDK Object Model provides a simpler approach to
working with video streams. For details, see Viewing and Recording Video
Streams instead.
While the Pelco API Viewer provides a lot of flexibility, it requires more complicated
method calls and more set up before streaming can commence.
Pelco strongly encourages users of the Pelco API Viewer to migrate to the SDK
Object Model as soon as possible. The viewer will be deprecated in the future.
C5617M-H 83
Viewing Video Streams with Pelco API
Viewer (Legacy)
NOTE: To manage the camera authentication and the users, use the Pelco Web
interface.
84 C5617M-H
Viewing Video Streams with Pelco API
Viewer (Legacy)
NOTE: To manage the camera authentication and the users, use the Pelco Web
interface.
4. Save the stream settings.
PelcoAPI::PelcoAPIViewer _pViewer;
C5617M-H 85
Viewing Video Streams with Pelco API
Viewer (Legacy)
The plug-in directory contains components that are key to the SDK’s encoding,
decoding, and transcoding capabilities. Without a proper reference, key features of
the Pelco SDK could not function properly. Please note that the plug-in directory is
dependent on where you installed the Pelco SDK.
NOTE: The related source code for this entry can be found in main.cpp’s main
function, which resides in the PelcoAPIViewer sample project.
_pViewer.SetPluginDir("C:\\Program Files\\Pelco\\API\\Libs\\Debug\\Plugins\\");
NOTE: To manage the camera authentication and the users, use the Pelco Web
interface.
4. Create a new window handle and associate it to the Pelco API Viewer instance.
Please note that logic to create the window handle can be found in the
_DbgCreateParentWindow() method.
86 C5617M-H
Viewing Video Streams with Pelco API
Viewer (Legacy)
For example:
TRACE_INFO("Calling SetDisplayRect\n");
_pViewer.SetDisplayRect(75, 100, 824, 618);
NOTE: Another example usage of this function can be found in the main.cpp
file's main function, which belongs to the PelcoAPIViewer sample project
SampleConsole9.
The following list shows the parameters:
C5617M-H 87
Viewing Video Streams with Pelco API
Viewer (Legacy)
88 C5617M-H
Viewing Video Streams with Pelco API
Viewer (Legacy)
C5617M-H 89
Viewing Video Streams with Pelco API
Viewer (Legacy)
MyAppNamespace::TimeStamp _pDelegate;
const char* pszSesId = NULL;
//... Other logic ...
pszSesId = _pViewer.StartStream("NOW", "INFINITE",
"10.220.196.149", "49154", "1", "rtp://10.220.196.148:7162",
"uuid:d557efb9-3a2d-48a1-b2fa-b48231f62f15", "1", &_pDelegate, False, False,
NULL);
where:
• StartTime is the time you want to start video. For live streams, use the value as
"NOW",
• endTime is the time you want the video to end. For live streams, use the value
“INFINITE”.
NOTE: For NULL/optional values, use “” for strings and NULL for interface
values.
• szServiceId is the camera service ID, etc,
For a playback RTP stream:
MyAppNamespace::TimeStamp _pDelegate;
const char* pszSesId = NULL;
//... Other logic ...
pszSesId = _pViewer.StartStream("2010-08-08T18:02:00", "2010-08-08T18:28:00",
"10.220.196.149", "49154", "1", "rtp://10.220.196.148:7162",
"uuid:d557efb9-3a2d-48a1-b2fa-b48231f62f15", "1", &_pDelegate, False, False,
NULL);
where:
• szServiceId is the camera service ID,
• szTransport and szCamUuid are required for playback.
If successful, these methods return a session ID, pszSesId, of the stream. This is
used throughout this document for tasks related to the Pelco API Viewer.
90 C5617M-H
Viewing Video Streams with Pelco API
Viewer (Legacy)
MyAppNamespace::TimeStamp _pDelegate;
const char* pszSesId = NULL;
//... Other logic for example, setting up windows, and so on ...
//Live example:
pszSesId = _pViewer.StartStream(
"rtsp://10.220.196.169/?deviceid=uuid:d557efb9-3a2d-48a1-b2fa-b48231f62f15",
NULL, NULL,
false, &_pDelegate);
//Playback example:
pszSesId = _pViewer.StartStream(
"rtsp://10.221.224.35/?deviceid=uuid:01b766f9-9d87-4613-
a168-5e5d179d339d&starttime=2011-12-04T10:00:00&endtime=2011-12-04T11:00:00",
NULL, NULL,
false, &_pDelegate);
If successful, the method returns a session ID of the stream. Keep this in mind, as
this is used throughout for tasks related to the Pelco API Viewer.
C5617M-H 91
Viewing Video Streams with Pelco API
Viewer (Legacy)
WARNING
Reverse playback is not possible for live streams.
Currently for RTP, PlayReverse only plays backward, and PlayForward only
plays forward, regardless of whether the speed parameter is negative or positive.
Therefore, call PlayForward for fast forward, and call PlayReverse for fast
reverse.
92 C5617M-H
Viewing Video Streams with Pelco API
Viewer (Legacy)
NOTE: The related source code for this entry can be found in main.cpp’s main
function, which belongs to the PelcoAPIViewer sample project SampleConsole9.
WARNING
DO NOT pause live streams. Pausing a live stream could produce an
unpredictable result.
This entry assumes that you have already completed the steps outlined in the
Opening, Playing, and Displaying an RTSP Stream entry.
To pause currently running video stream, call the Pelco API Viewer instance’s
Pause() method; passing in the target video stream’s session ID.
C5617M-H 93
Viewing Video Streams with Pelco API
Viewer (Legacy)
NOTE: The related source code for this entry can be found in main.cpp’s main
function, which belongs to the PelcoAPIViewer sample project SampleConsole9.
NOTE: This entry assumes that you have already completed the steps outlined in
Opening, Playing, and Displaying a Live or Playback RTP Stream.
To resume a paused playback stream, call the Pelco API Viewer instance’s
Resume() method, passing in the target video stream’s session ID.
94 C5617M-H
Viewing Video Streams with Pelco API
Viewer (Legacy)
C5617M-H 95
Viewing Video Streams with Pelco API
Viewer (Legacy)
To display motion events for the currently playing video stream, call the
DisplayMotionEvents() method, passing in the target video stream’s session
ID and the bEnable set to true.
PelcoAPI::ViewerOverlayInfo overlay;
PelcoAPI::COLOR fontColor = {0xFF, 0xFF, 0xFF, 0xA0};
PelcoAPI::COLOR fontBgColor = {0x00, 0x00, 0x00, 0x00};
overlay.m_dateFormat = PelcoAPI::VIEWER_DATE_FORMAT_MMDDYY;
overlay.m_timeFormat = PelcoAPI::VIEWER_TIME_FORMAT_TTHHMMSS;
overlay.m_fontColor = fontColor;
overlay.m_fontBgColor = fontBgColor;
overlay.m_location = PelcoAPI::VIEWER_OVERLAY_LOCATION_TOP_LEFT;
overlay.m_nFontSize = 12;
overlay.m_fontNameStr = "Arial";
bool bSuccess = _pViewer.DisplayTimestampOverlay(pszSesId, true, &overlay);
96 C5617M-H
Viewing Video Streams with Pelco API
Viewer (Legacy)
NOTE: Live and playback RTSP streams from Sarix ® cameras are unable to display
timestamp information.
Taking a Snapshot of the Current Video Frame for RTP and RTSP Streams
To take a snapshot of the current video frame, call the Pelco API Viewer
instance’s TakeSnapShot() method; passing in the target video stream’s
session ID, and the desired resulting filename and file path.
Pan, Tilt, Zoom (PTZ) Control for Live Video Streaming (RTP)
Cameras with PTZ functionality can also be controlled using the Stream class and
Pelco API Viewer. For more information, refer to Pan, Tilt, Zoom (PTZ) Control.
NOTE: Pan, Tilt, Zoom (PTZ) Control is for controlling active cameras so it applies to
live RTP video streams only.
C5617M-H 97
Pan, Tilt, Zoom (PTZ) Control
Verify that authentication is enabled for the camera, and if so, set the authentication
credentials. For example:
98 C5617M-H
Pan, Tilt, Zoom (PTZ) Control
NOTE: To manage the camera authentication and the users, use the Pelco Web
interface.
After you are finished with the camera operations, stop all PTZ Control Wrapper
actions:
Verify that authentication is enabled for the camera, and if so, set the authentication
credentials. For example:
After you are finished with the camera operations, stop all PTZ Control Wrapper
actions:
Continuous Panning
NOTE: The related source code for this entry can be found in main.cpp’s main
function (for C++) or Program.cs’s Main function (for C#), which belongs to the PTZ
Control Wrapper sample project.
NOTE: PTZ control functionality is also available as part of the PelcoAPIViewer.
For each of the methods described in this topic, there is an equivalent method in the
PelcoAPIViewer API.
C5617M-H 99
Pan, Tilt, Zoom (PTZ) Control
This entry covers the portion of the sample project that deals with moving the camera
left and right.
1. Initialize the PTZ Control Wrapper.
Refer to Initializing the PTZ Control Wrapper for details.
2. Call the PTZ Control Wrapper instance’s ContinuousPan method.
• To pan your IP camera left, pass in a negative rotational x parameter.
• To pan the IP camera right, pass in a positive value for the rotational X
parameter.
For more details on the ContinuousPan method, please refer to the PTZ Control
Wrapper API reference documentation.
//panning left
bool bSuccess = ptzControlWrapper.ContinuousPan(-10000);
//panning right
bool bSuccess = ptzControlWrapper.ContinuousPan(10000);
//panning left
Boolean bSuccess = managedPTZControl.ContinuousPan(-10000);
//panning right
Boolean bSuccess = managedPTZControl.ContinuousPan(10000);
3. When you want to stop the camera from continually moving, use the
StopContinuous() method (refer to Continuous Stop for details), or pass in
zero to the ContinuousPan method as shown in the following example.
Continuous Tilting
NOTE: The related source code for this entry can be found in main.cpp’s main
function (for C++) or Program.cs’s Main function (for C#), which belongs to the PTZ
Control Wrapper C++ sample project.
NOTE: PTZ control functionality is also available as part of the PelcoAPIViewer.
For each of the methods described in this topic, there is an equivalent method in the
PelcoAPIViewer API.
This entry covers the portion of the sample project that deals with moving the camera
up and down.
1. Initialize the PTZ Control Wrapper.
Refer to Initializing the PTZ Control Wrapper for details.
2. Call the PTZ Control Wrapper instance’s ContinuousTilt method.
• To tilt the IP camera down, pass in a negative rotational y value for the second
parameter.
• To tilt the IP camera up, pass in a positive value for the rotational y parameter.
For more details on the ContinuousTilt method, please refer to the PTZ
Control Wrapper API reference documentation.
//tilting down
bool bSuccess = ptzControlWrapper.ContinuousTilt(-9000);
100 C5617M-H
Pan, Tilt, Zoom (PTZ) Control
//tilting up
bool bSuccess = ptzControlWrapper.ContinuousTilt(9000);
//tilting down
Boolean bSuccess = managedPTZControl.ContinuousTilt(-9000);
//tilting up
Boolean bSuccess = managedPTZControl.ContinuousTilt(9000);
3. When you want to stop the camera from continually moving, use the
StopContinuous() method (refer to Continuous Stop for details), or pass zero
to the ContinuousTilt method as shown in the following example.
//tilting down
bool bSuccess = ptzControlWrapper.ContinuousMove(10000, -10000);
//tilting up
bool bSuccess = ptzControlWrapper.ContinuousMove(10000, 10000);
//tilting down
Boolean bSuccess = managedPTZControl.ContinuousMove(10000, -10000);
//tilting up
Boolean bSuccess = managedPTZControl.ContinuousMove(10000, 10000);
C5617M-H 101
Pan, Tilt, Zoom (PTZ) Control
3. When you want to stop the camera from continually moving, use the
StopContinuous() method (refer to Continuous Stop for details), or pass in a 0
value to the ContinuousMove method as shown in the following example.
Zoom API calls over UDP currently work on Sarix® firmware 1.7.41 and higher.
102 C5617M-H
Pan, Tilt, Zoom (PTZ) Control
For more details on the AbsolutePan method, please refer to the PTZ Control
Wrapper API reference documentation.
Generally, the panning range is limited to 0 to 360 degrees (0 to 36,000
centidegrees). This limit might differ, depending on the type of camera used.
C5617M-H 103
Pan, Tilt, Zoom (PTZ) Control
2. Call the PTZ Control Wrapper’s AbsoluteMove method, passing in the desired
position on the rotational X and Y planes.
• Passing a negative value for X moves the camera left of the home position.
• Passing a positive value for X moves the camera right of the home position.
• Passing a negative value for Y moves the camera down from horizontal.
• Passing a positive value for Y moves the camera up from horizontal.
Refer to your camera model’s specifications for tilt position limits. For more details
on the AbsoluteMove method, please refer to the PTZ Control Wrapper API
reference documentation.
int positionX = 0;
int positionY = 0;
bool bSuccess = ptzControlWrapper.GetAbsolutePosition(&positionX, &positionY);
int positionX = 0;
int positionY = 0;
Boolean bSuccess = managedPTZControl.GetAbsolutePosition(ref positionX,
ref positionY);
104 C5617M-H
Pan, Tilt, Zoom (PTZ) Control
int magnification = 0;
bool bSuccess = ptzControlWrapper.GetAbsoluteZoom(magnification);
int magnification = 0;
Boolean bSuccess = managedPTZControl.GetAbsoluteZoom(ref magnification);
C5617M-H 105
Pan, Tilt, Zoom (PTZ) Control
If the request was successful, your camera’s focus should now be changing
(unless you passed in a 0). This does not stop until a SetFocus request is made
with a different value, or if you call the Stop method, which stops movement or
lens related action that the camera is currently doing.
Iris Control
NOTE: The related source code for this entry can be found in main.cpp’s main
function (for C++) or Program.cs’s Main function (for C#), which belongs to the PTZ
Control Wrapper sample project.
NOTE: PTZ control functionality is also available as part of the PelcoAPIViewer.
For each of the methods described in this topic, there is an equivalent method in the
PelcoAPIViewer API.
NOTE: It is best practice to let your IP camera manage its iris automatically.
This section demonstrates how to open and close your camera’s iris.
1. Initialize the PTZ Control Wrapper.
Refer to Initializing the PTZ Control Wrapper for details.
2. Call the SetIris method, passing in the desired iris command.
For a little background, the SetIris method takes only following values:
If the request was successful, your camera’s iris should now be changing (unless
you passed in a 0). This does not stop until the SetIris request is made with
106 C5617M-H
Pan, Tilt, Zoom (PTZ) Control
a different value, or if you call the Stop method, which stops movement or lens
related action that the camera is currently doing.
3. Alternatively the recommended way of controlling the iris is to let your IP camera
manage it automatically. To enable this feature, call the AutoIris method and
pass a boolean value of true. To disable it, just pass a boolean value of false.
Scripting
One of Pelco’s most powerful features enables users to manage and run scripts.
Scripts allow you to extend the behavior of Pelco devices with little effort. Before
learning how to use the SDK’s scripting related features, it is important to know about
the different types of Pelco scripts:
Preset
A preset is a script that allows you to save a camera's stationary position, zoom, and
other settings such as auto iris and autofocus, collectively known as a bookmark.
Users can save multiple presets per camera. For example if you’re monitoring several
specific points using the same camera, you can set one preset for each location that
needs to be monitored; each with its own set of zoom, iris, and focus values.
Presets that you create must be names, such as “PRESETX”, where the keyword
PRESET must be used (uppercase) followed by a positive integer. For example,
PRESET9.
The number of presets that can be saved and activated is dependent on the Pelco
device.
Pattern
A pattern is like a group of presets combined. For example, you might control an IP
PTZ camera guarding a hallway with two entrances and a window. With patterns, you
can set a bookmark for camera behavior that changes the camera’s view from one of
the three points of interest to another every 15 seconds.
Patterns that you create must be names as “PATTERNX”, where the keyword
PATTERN must be used (uppercase) followed by a positive integer. For example,
PATTERN5.
NOTE: There are preconfigured patterns that cannot be created. You cannot create
a Pattern by combining existing Presets.
Like a preset, patterns are typically only relevant for IP cameras. The number of
patterns that can be recorded and activated is dependent on the Pelco device. For
example, the 16X and 18X models of the Spectra IV can store only a single pattern,
while the 22X, 23X and 35X Spectra IV models can store up to eight patterns.
Normal Script
C5617M-H 107
Pan, Tilt, Zoom (PTZ) Control
A general script consists of a group of commands that run over a set period of time. It
is akin to a macro.
Creating a Preset
NOTE: The related source code for this entry can be found in main.cpp’s main
function (for C++) or Program.cs’s Main function (for C#), which belongs to the PTZ
Control Wrapper sample project.
NOTE: PTZ control functionality is also available as part of the PelcoAPIViewer.
For each of the methods described in this topic, there is an equivalent method in the
PelcoAPIViewer API.
These steps show you how to create a preset.
1. Initialize the PTZ Control Wrapper.
Refer to Initializing the PTZ Control Wrapper for details.
2. Now set up your Pelco IP camera with a combination of settings that you want to
save.
For example, the IP camera’s current viewing position, iris setting, focus setting,
zoom, and so on.
3. Then call the SetPreset method, passing in the desired name of the preset.
Depending on whether the preset already exists, it either creates a new one or
modifies an existing one by that name.
Creating a Pattern
NOTE: The related source code for this entry can be found in main.cpp’s main
function (for C++) or Program.cs’s Main function (for C#), which belongs to the PTZ
Control Wrapper sample project.
NOTE: PTZ control functionality is also available as part of the PelcoAPIViewer.
For each of the methods described in this topic, there is an equivalent method in the
PelcoAPIViewer API.
This is just like creating a preset, except you are saving more than one camera state.
1. Initialize the PTZ Control Wrapper.
Refer to Initializing the PTZ Control Wrapper for details.
2. Now set up your Pelco IP camera with a combination of settings that you want to
save.
For example, the IP camera’s current viewing position, iris setting, focus setting,
zoom, and so on.
3. Then call the StartPatternRecording method, passing in the desired name of
the preset.
108 C5617M-H
Pan, Tilt, Zoom (PTZ) Control
Depending on whether the pattern already exists, it either creates a new one or
modifies an existing one by that name.
4. At this point start performing the actions that you’d want your camera to remember
as a pattern.
For example, if you have three points of interest you would first go to the first
point of interest with a certain zoom and focus level. After waiting for some
predetermined time, you then move the camera’s view into the second point of
interest which has a different zoom level and iris setting; and do the same for the
final point of interest.
5. Finally, call the EndPatternRecording method, passing in the same pattern
name as you did before.
C5617M-H 109
Pan, Tilt, Zoom (PTZ) Control
110 C5617M-H
Extracting Audio and Video Metadata
WARNING
Any provided sample code is meant to be a reference implementation focused
on educating developers about Pelco devices. Though there are exceptions, in
general Pelco sample code is NOT intended for immediate production use without
modification.
WARNING
The content below assumes that the default target installation directory was
chosen during installation.
The Meta-data Parser consists of an interface that provides access to the various
objects within the elementary stream.
C5617M-H 111
Extracting Audio and Video Metadata
Motion detection involves computing the difference between two images. If the
difference between the compared images crosses a certain threshold value, motion is
detected and the selected Alert is triggered.
The key to Pelco’s motion detection feature is the Region of Interest (ROI). The ROI
denotes a motion detection region within a video frame. A motion detection region
is essentially a grid of motion detection 16x16 pixel cell blocks. These cells have
sensitivity and movement threshold limits. The sensitivity level dictates the amounts
of movement that are registered within the ROI, while the threshold dictates the
amounts of blocks that are registered within the ROI before the selected alarm is
triggered.
What motion detection metadata is available? Currently in terms of metadata, each
video frame can only hold a single ROI. Consequently, for each frame, the metadata
describes the length and width of the ROI, while also holding a Pelco base64 bit mask
for the state of the ROI.
NOTE: The difference between Pelco base64 and standard base64 implementations
is that the Pelco version always appends an = character at the end of the encoded
value.
Drawing primitives are basic graphical elements. They encompass drawing points,
fills, lines, arcs, and even text. This basically contains information related to the
points, lines, arcs, and so on.
Timestamps
Timestamp metadata represents the exact date and time when the video frame was
captured. The Metadata Parser Library can return this data in a number of ways.
112 C5617M-H
Extracting Audio and Video Metadata
typedef struct tm {
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
}
In addition to returning the data above, the Metadata Parser Library also returns the
daylight savings offset, the current timezone, and values in local time.
Getting Started
Depending on whether you would like to use the release version of the Pelco SDK
libraries or the debug version, change the Working Directory value as appropriate.
Assuming that you did not change the default installation directory for the Pelco SDK,
use C:\\Program Files\Pelco\API\Libs\Debug.
NOTE: If running in Release mode, change this path to C:\Program Files
\Pelco\API\Libs\Release.
What’s Ahead
This is a high level overview of possible tasks related to metadata:
1. Access the metadata from the stream.
2. Render metadata onto a video frame.
PelcoAPI::MetaDataParser parser;
parser.SetData(videoBuffer, length);
C5617M-H 113
Extracting Audio and Video Metadata
NOTE: The related source code for this entry can be found in
SampleMetaDataRenderer.cpp, which belongs to the MetaDataParser C++
sample project. You are expected to implement the actual logic.
This class is used for drawing onto video frames.
1. Implement the following required protected methods:
a) DrawLine to draw a line using two given points: 'v1' and 'v2'
114 C5617M-H
Extracting Audio and Video Metadata
2. Verify whether the parser has found a timestamp by calling the HasTimeStamp
method, which returns true if found, false otherwise.
if(true == parser.HasTimestamp()){
if(true == parser.HasMotionData()){
3. If there is motion detection metadata, call the GetMotionData method and pull
the result into a new MotionData instance.
if(NULL != data){
unsigned int cols = data->Columns();
unsigned int rows = data->Rows();
unsigned char *mask = data->Bitmask();
if(true == parser.HasMotionData()){
C5617M-H 115
Extracting Audio and Video Metadata
SampleMetaDataRenderer renderer;
4. Create a new COLOR struct, setting the desired alpha transparency and colors
to display on the screen. In this example, the colors (red, green, blue) are fully
opaque with zero transparency.
5. Render the motion metadata onto the screen by calling the RenderMotionData
method.
renderer.RenderMotionData();
Drawing Metadata
if(true == parser.HasDrawingData()){
3. If drawing metadata is found, call the GetDrawingData method, pulling the result
into a DrawingData instance.
4. Parse the resulting data by iterating through the returned drawing primitives.
116 C5617M-H
Extracting Audio and Video Metadata
if(true == parser.HasDrawingData()){
3. After you grab the drawing metadata, declare your MetaDataRenderer class.
SampleMetaDataRenderer renderer;
4. Create a new COLOR struct, setting the desired alpha transparency and colors to
show on the screen. In this example, the colors (red, green, and blue) are fully
opaque with zero transparency.
renderer.RenderDrawingData();
C5617M-H 117
Web Service Proxies (Legacy)
WARNING
Any provided sample code is meant to be a reference implementation focused
on educating developers about Pelco devices. Though there are exceptions, in
general Pelco sample code is NOT intended for immediate production use without
modification.
WARNING
The content below assumes that the default target installation directory was
chosen during installation.
General Usage
NOTE: This entry assumes that users have already installed the Pelco SDK.
1. Include the stdsoap2 header and the web service proxy header. For example, if
you want to use the CameraConfiguration web service, you should include the
CameraConfigurationProxy header.
#include "PelcoAPI/stdsoap2.h"
#include "PelcoAPI/CameraConfigurationProxy.h"
CameraConfigurationProxy CameraConfiguration;
4. Set the web service’s control point URL. For details on the proper way to retrieve
the control point URL, refer to Retrieving a Specific Web Service’s Control URL.
CameraConfiguration.soap_endpoint = strEndPointURL.c_str();
118 C5617M-H
Web Service Proxies (Legacy)
_CameraConfiguration__ResetConfigurationResponse * pResetConfigurationResponse
=
soap_new__CameraConfiguration__ResetConfigurationResponse(
&CameraConfiguration, -1);
This holds the web service’s response including related values to your request.
7. Call the CameraConfiguration web service proxy ResetConfiguration
action, passing in both the earlier created ResetConfiguration and
ResetConfigurationResponse parameters. Then determine if the operation
was successful.
CameraConfiguration.ResetConfiguration(pResetConfiguration,
pResetConfigurationResponse);
#include "PelcoAPI/stdsoap2.h"
#include "PelcoAPI/LensControlProxy.h"
#include "GSOAPSample.h"
_LensControl__StopResponse * pStopResponse =
soap_new__LensControl__StopResponse(&LensControl, -1);
if (LensControl.Stop(pStop, pStopResponse) != SOAP_OK)
C5617M-H 119
Discovery (Legacy)
Discovery (Legacy)
Device and Service Discovery Overview
IMPORTANT
The System Manager Wrapper functionality described here has been replaced by
the Object Model introduced in the Pelco SDK 3.0. Prior to the introduction of the
Object Model, device and service discovery tasks were provided by this System
Manager Wrapper. Now discovery occurs when a System instance is created. The
device cache mechanism performs discovery. For details, see Device Cache.
Sample Code
You can find complete C# and C++ programs that show how to use the Pelco
System Wrapper under the directory where the Pelco SDK is installed: \Pelco\API
\SampleCode\SystemManagerWrapperSample.
Where Does the Pelco SDK Fit?
The key to performing device and service discovery related tasks is the System
Manager Wrapper. The System Manager Wrapper is a component of the Pelco SDK.
It provides users with convenience functions for device and service queries.
The majority of the tasks covered in this section can be found in the the System
Manager Wrapper C++ sample project. You should examine the sample project
source while reading this documentation.
NOTE: For more Endura specific information, refer to the Endura appendix.
Getting Started
Change the Working Directory value as appropriate. Assuming that you did not
change the default installation directory for the Pelco SDK, use C:\\Program
Files\Pelco\API\Libs\Debug.
NOTE: If running in Release mode, change this path to C:\Program Files
\Pelco\API\Libs\Release.
Next Steps
The following set of tasks are essential for using the Pelco SDK:
120 C5617M-H
Discovery (Legacy)
• Determine the System Manager’s IP address and port number, either manually, or
automatically through the Pelco SDK as described in Automatically Determining
the System Manager’s IP Address and Port Number.
• Create a class that implements the IDeviceStorageNet interface.
• Query all available Pelco devices on your network.
PelcoAPI::SystemManagerWrapper sm;
int nRet = sm.SetSMAddress((char *) sSMIPAddress);
2. Log in to the System Manager with the proper credentials. Call the System
Manager Wrapper instance’s UserLogin() method, passing in the username
and password.
sysMgr.UserLogout(loginId);
sm.UserLogout(loginId);
C5617M-H 121
Discovery (Legacy)
2. To access the System Manager’s IP address and port number, call the
GetSMAddress() method.
int rPort = 0;
// ... Auto discover SM ...
// Return the SM IP Address
PelcoAPI::xstring sIpAddress;
sm.GetSMAddress(&sIpAddress,&rPort);
TRACE_INFO("The SM IpAdress - %s and Port - %d\n", sIpAddress.data, rPort);
PelcoAPI::xfree(&sIpAddress);
sysMgr.UserLogout(loginId);
122 C5617M-H
Discovery (Legacy)
NOTE: The related source code for this entry can be found in main.cpp’s main
function (for C++) or Program.cs’s Main function (for C#), which belongs to the
System Manager Wrapper sample project.
NOTE: Before proceeding with this entry, it is assumed that you have already
completed the steps outlined in Creating an IDeviceStorage Class.
The first major task that you need to complete is to query all Pelco devices available
on your network. Completing this enables you to access a device’s Unique Device
Name (UDN) and many other device-related attributes that are needed for other
Pelco SDK related tasks.
1. Initialize the System Manager Wrapper. Refer to Initializing the System Manager
Wrapper for details.
2. Make a call to the System Manager Wrapper's GetDevices() method, passing in
the following parameters:
• Your login ID: This ID is returned after a successful login. Refer to Initializing
the System Manager Wrapper for details.
• The sequence number: This is used to filter results, only returning newly added
or changed devices. GetDevices calls return a new integer value once every
few minutes during successive calls. New values are one larger than the one
before, for example, when the 1st call returns1, the subsequent call returns 2.
• The device type you would like to use to filter the results. Known device types
include the following:
• Camera
• Encoder
• Decoder
• Monitor
• a NULL value (to not filter results by type of device)
NOTE: This is not a definitive list of Pelco device types. This list will expand as
Pelco expands its product line.
• A pointer to your IDeviceStorage implementation.
int seqNum = 0;
MyStorage storage; // ... You must define this class ...
int loginId = sm.UserLogin("brian", "pelco");
sm.GetDevices(loginId, &seqNum, "Camera", &storage);
int seqNum = 0;
DeviceInformation devStore = new DeviceInformation(); // You must define this
class
int loginId = sm.UserLogin("brian", "pelco");
3. Perform the needed operations on the returned device data and store them into
the IDeviceStorage class instance. Refer to Creating an IDeviceStorage Class
for further details.
4. To query any changes with available devices from the System Manager, use
the returned sequence number value from your last call to the GetDevices()
method with your next call to the same method.
This call returns Pelco devices that have changed or are new to the network.
Every subsequent call returns only new changes within your network.
int seqNum = 0;
C5617M-H 123
Discovery (Legacy)
int seqNum = 0;
DeviceInformation devStore = new DeviceInformation(); // You must define this
class
int loginId = sm.UserLogin("brian", "pelco");
sm.GetDevices(loginId, ref seqNum, "Camera", &storage); // seqNum changes here
to 1 ...
// ... Misc logic ...
sm.GetDevices(loginId, ref seqNum, "Camera", &storage); // seqNum changes here
to 2 ...
PelcoAPI::xstring sTimezoneInfo;
int loginId = sm.UserLogin("brian", "pelco");
bool bSuccess = sm.GetSystemAttribute(loginId, "SYS_CFG_TzInfo",
&sTimezoneInfo);
124 C5617M-H
Discovery (Legacy)
PelcoAPI::xstring sNtpAddress;
int loginId = sm.UserLogin("brian", "pelco");
bool bSuccess = sm.GetSystemAttribute(loginId, "SYS_CFG_NtpAddr",
&sNtpAddress);
PelcoAPI::xstring sServiceId;
int loginId = sm.UserLogin("brian", "pelco");
bool bSuccess = sm.GetServiceID(loginId,
"uuid:00047D01-4CA5-5370-6563-747261495605",
"VideoOutput", &sServiceId);
C5617M-H 125
Discovery (Legacy)
NOTE: The related source code for this entry can be found in main.cpp’s main
function (for C++) or Program.cs’s Main function (for C#), which belongs to the
System Manager Wrapper sample project.
NOTE: This entry assumes that you have already completed the steps outlined
in Querying Available Devices from the System Manager, which provides you with
UDNs for Pelco devices available on your network.
Obtaining a web service’s control URL is essential for many Pelco-related operations.
1. Initialize the System Manager Wrapper. (Refer to Initializing the System Manager
Wrapper for details.)
2. Call the System Manager Wrapper’s GetDeviceServiceAttribute() method,
passing in the following parameters:
PelcoAPI::xstring sCtrlUrl;
int loginId = sm.UserLogin("brian", "pelco");
bool bSuccess = sm.GetDeviceServiceAttribute(loginId,
"urn:schemas-pelco-com:service:MotionDetection:1",
"uuid:00047D01-4CA5-5370-6563-747261495605", "SYS_UpnpControlUrl",
sCtrlUrl);
126 C5617M-H
Discovery (Legacy)
PelcoAPI::xstring sNvr;
int loginId = sm.UserLogin("brian", "pelco");
bool bSuccess = sm.GetDeviceAttributeValue(loginId,
"uuid:00047D01-4CA5-5370-6563-747261495605", "SYS_NvrAssoc",&sNvr);
C5617M-H 127
Discovery (Legacy)
PelcoAPI::xstring sFriendlyName;
int loginId = sm.UserLogin("brian", "pelco");
bool bSuccess = sm.GetDeviceAttributeValue(loginId,
"uuid:00047D01-4CA5-5370-6563-747261495605",
"SYS_UpnpFriendlyName", &sFriendlyName);
PelcoAPI::xstring sDdfUrl;
int loginId = sm.UserLogin("brian", "pelco");
bool bSuccess = sm.GetDeviceAttributeValue(loginId,
"uuid:00047D01-4CA5-5370-6563-747261495605",
"SYS_UpnpDevDescUrl", &sDdfUrl);
128 C5617M-H
Discovery (Legacy)
C5617M-H 129
Discovery (Legacy)
PelcoAPI::xstring sModelNumber;
int loginId = sm.UserLogin("brian", "pelco");
bool bSuccess = sm.GetDeviceAttributeValue(loginId,
"uuid:00047D01-4CA5-5370-6563-747261495605",
"SYS_UpnpModelNumber", &sModelNumber);
130 C5617M-H
Discovery (Legacy)
int iUpnpRenewal;
int loginId = sm.UserLogin("brian", "pelco");
bool bSuccess = sm.GetSystemAttribute(loginId, "SYS_CFG_UPNP_RENEWAL",
C5617M-H 131
Discovery (Legacy)
&iUpnpRenewal);
int iUpnpRenewal;
int loginId = sm.UserLogin("brian", "pelco");
Boolean bSuccess = sm.GetSystemAttribute(loginId, "SYS_CFG_UPNP_RENEWAL",
ref iUpnpRenewal);
PelcoAPI::xstring sCtrlUrl;
int loginId = sm.UserLogin("brian", "pelco");
bool bSuccess = sm.GetDeviceServiceAttribute(loginId,
"urn:schemas-pelco-com:service:MotionDetection:1",
"uuid:00047D01-4CA5-5370-6563-747261495605", "SYS_UpnpControlUrl",
&sCtrlUrl);
132 C5617M-H
Discovery (Legacy)
#ifndef PELCO_API_IDEVICE_STORAGE_H
#define PELCO_API_IDEVICE_STORAGE_H
#include <string>
namespace PelcoAPI
{
class IDeviceStorage
{
public:
virtual ~IDeviceStorage(){};
#endif
using System;
using System.Collections.Generic;
using System.Text;
namespace SystemManagerWrapperNet
{
class DeviceInformation : PelcoAPI.IDeviceStorageNet
{
public void AddDevice(string sUDN, string sAttributes)
{
// ... User implemented logic here ...
}
public void DeleteDevice(string sUDN)
{
// ... User implemented logic here ...
C5617M-H 133
Discovery (Legacy)
}
}
}
2. Note that the System Manager Wrapper sample project has an implementation of
IDeviceStorage called MyStorage.
MyStorage is a stub class. It does not implement anything that is essential for
production usage, such as parsing the System Manager’s XML response data
(attributes). Nor does it associate the device UDN/attribute XML pairs into any
constructs. Those exercises are left to the user.
134 C5617M-H
Logging
Logging
Logging is specific to Endura, and is configurable.
1. To configure logging, run the LoggingSetup application in the C:\Program
Files\Pelco\API\Logging folder.
2. Select the items that you want to log, as well as the folder where the logs should
be stored and the max logfile size.
3. Click Set to save the settings.
NOTE: Logging should be run by an administrative account, because other users
do not have write permissions to C:\Program Files (x86) or subdirectories by
default.
4. To view the current log, run the LoggingSetup application in the C:\Program
Files\Pelco\API\Logging folder. Click the View Log File button.
NOTE: The maximum log size is 50MB. Any settings over that value are reset
back to the default 50MB restriction. Usually, logging should be off (no items
checked) unless Pelco technical support asks for logging information when tracing
issues.
In the Logging dialog box, the following settings are available:
C5617M-H 135
Product Compatibility
Product Compatibility
The following table shows the compatibility of the Pelco SDK with Pelco products.
NOTE: These products are compatible with Pelco SDK only if the model supports
Pelco API:
• DX 47/4800 Series
• DSSRV
1
Active only if the attached IP camera is PTZ capable.
2
Active only if an active System Manager is available on the network. Endura Express contains a
built-in System Manager, and therefore no additional System Manager is required.
136 C5617M-H
Product Compatibility
C5617M-H 137
About Endura Video Management
System
138 C5617M-H
About Endura Video Management
System
1. The System Manager constantly broadcasts its location on the Endura Network.
Once a device comes on line, it begins to listen for this broadcast. When the new
device finds the SM, it then registers itself to the System Manager.
2. At some point the System Manager will query the device’s available web
services and its attributes, using a variety of sources including the UPnP Device
Description File (DDF). DDFs are files containing device attributes in XML format.
3. After the initial query, the System Manager periodically updates the device’s
status. To be considered onl ine, a device must constantly notify the SM that it is
still alive.
4. At any point a client can make requests to the System Manager regarding devices,
including the SM itself, and their web services.
Endura Events and Alarms
There are two major ways to subscribe to Endura web service events:
• Directly contacting the device on which the target web service resides
• Using the System Manager as an intermediary to handle events
On later versions of Endura network deployments, the first option is the default.
Users can enable the System Manager to act as an intermediary by enabling its
EventArbiter web service (not to be confused with the Event Arbiter Library). The
EventArbiter web service is used for receiving GENA events from devices within
an Endura network. The Event Arbiter provides two ways for subscribing to events:
• Through control URLs
• By subscribing to events with event URIs provided
C5617M-H 139
About Endura Video Management
System
The URI is provided by the user through the System Manager's EventArbiter
service.
What is the advantage of using the System Manager as an intermediary for Endura
events? The System Manager can help manage all event related network traffic,
ensuring that an Endura network never gets overwhelmed by event-driven network
traffic.
Video Exports
Currently the Exporter library requires a System Manager to be present to function.
How does it work? The Exporter client sends its request for video clips to export with
a timestamp range filter to the System Manager; that is, it wants clips that fall within
a starting date time and an ending date time. The System Manager will then query
all available NSMs for clips that meet both the starting timestamp and the ending
timestamp. Specifically, there can be instances where the API must ‘stitch’ the end
result from more than one NSM source of video clips to meet the filter.
Where Does the Pelco API SDK Fit Within Endura?
The Pelco API SDK is meant to make using Endura web services easier by providing
convenience methods and utilities. It protects the user from all of the potentially
overwhelming and complicated details of Endura SOAP web services. Of course
users are still free to directly use Endura web services. However Pelco has found that
many of our customers enjoy the convenience and ease of use that the Pelco API
SDK provides.
140 C5617M-H
General Event Messages
LoggableEventParameters
This contains a list of LoggableEventParameter data types. For further details,
refer to the event message descriptions below.
<complexType name="LoggableEventParameters">
<sequence>
<element minOccurs="0" maxOccurs="unbounded" name="parameter"
type="tns:LoggableEventParameter"/>
</sequence>
</complexType>
LoggableEventParameter
This represents an event-related parameter. For further details, refer to the event
message descriptions below.
<complexType name="LoggableEventParameter">
<sequence>
<element name="paramId" type="xs:int"/>
<element name="name" type="xs:string"/>
<element name="value" type="xs:int"/>
<element name="type" type="xs:int"/>
</sequence>
</complexType>
C5617M-H 141
General Event Messages
142 C5617M-H
Hardware Diagnostics Event
Messages
<complexType name="ConfigurationButton">
<sequence>
<element name="objGuid" type="xs:string"
fixed="394af82c-2b05-4df8-b2a6-2caed9ad4fae"/>
<element name="objId" type="xs:int" fixed="20180"/>
<element name="current" type="xs:int"/>
<element name="previous" type="xs:int"/>
</sequence>
</complexType>
The possible values for the current and previous state of the button include the
following:
<pdDiagnostic>
<objGuid>394af82c-2b05-4df8-b2a6-2caed9ad4fae</objGuid>
<objId>20180</objId>
<current>1</current>
<previous>3</previous>
</pdDiagnostic>
LoggableEvent Object
For more details, refer to LoggableEvent.
<deviceUdn>uuid:AK-2</deviceUdn>
<deviceUrn>urn:schemas-pelco-com:device:Pelco:1</deviceUrn>
<serviceUrn></serviceUrn>
<logId></logId>
<major>7</major>
<minor>0</minor>
<type>4</type>
C5617M-H 143
Hardware Diagnostics Event
Messages
<reason>1</reason>
<parameters></parameters>
DriverFailure (20150)
A DriverFailure PdDiagnostic object is only sent when a device's driver
fails, so a LoggableEvent object is used to set the correct major, minor, type, and
reason. This is typically used for multichannel encoder (MCE) devices.
PdDiagnostic
This is the data that subscribers receive when the event triggers.
<complexType name="DriverFailurePdDiagnostic">
<sequence>
<element name="objGuid" type="xs:string"
fixed="94b6d2d3-c68e-4b13-974a-08f69f50cb67"/>
<element name="objId" type="xs:int" fixed="20150"/>
<element name="name" type="xs:string"/>
</sequence>
</complexType>
<complexType name="DriverFailurePdDiagnostic">
<sequence>
<element name="objGuid" type="xs:string"
fixed="94b6d2d3-c68e-4b13-974a-08f69f50cb67"/>
<element name="objId" type="xs:int" fixed="20150"/>
<element name="name" type="xs:string"/>
</sequence>
</complexType>
LoggableEvent Object
For more details, refer to LoggableEvent.
<deviceUdn>uuid:AK-2</deviceUdn>
<deviceUrn>urn:schemas-pelco-com:device:Pelco:1</deviceUrn>
<serviceUrn></serviceUrn>
<logId></logId>
<major>7</major>
<minor>0</minor>
<type>5</type>
<reason>1</reason>
<parameters></parameters>
Fans (20020)
Any device with any fans having a changed state causes a LoggableEvent to be
fired.
PdDiagnostic
144 C5617M-H
Hardware Diagnostics Event
Messages
<complexType name="FanPdDiagnostic">
<sequence>
<element name="objGuid" type="xs:string"
fixed="31e41907-53be-4f57-8ae2-a56c12d98d0e"/>
<element name="objId" type="xs:int" fixed="20050"/>
<element name="states" type="tns:FanStates"/>
</sequence>
</complexType>
FanStates
This contains list of one or more FanState data types.
<complexType name="FanStates">
<sequence>
<element name="state" maxOccurs="unbounded" minOccurs="1"
type="tns:FanState"/>
</sequence>
</complexType>
FanState
This represents the current and previous condition of a fan.
<complexType name="FanState">
<sequence>
<element name="cur" type="xs:int"/>
<element name="prev" type="xs:int"/>
</sequence>
</complexType>
<pdDiagnostic>
<objGuid>31e41907-53be-4f57-8ae2-a56c12d98d0e</objGuid>
C5617M-H 145
Hardware Diagnostics Event
Messages
<objId>20220</objId>
<states>
<state>
<cur>1</cur>
<prev>0</prev>
</state>
<state>
<cur>0</cur>
<prev>0</prev>
</state>
<state>
<cur>0</cur>
<prev>0</prev>
</state>
</states>
</pdDiagnostic>
LoggableEvent Object
For more details, refer to LoggableEvent.
<deviceUdn>uuid:AK-2</deviceUdn>
<deviceUrn>urn:schemas-pelco-com:device:Pelco:1</deviceUrn>
<serviceUrn></serviceUrn>
<logId></logId>
<major>7</major>
<minor>0</minor>
<type>5</type>
<reason>1</reason>
<parameters></parameters>
HardDrives (20060)
For each CPdDiagHarddrives object, you can send loggable events for hard drives
that have a state change. Set the state of the hard drive to the appropriate major,
minor, type, and reason.
PdDiagnostic
This is the data subscribers receive when the event triggers.
<complexType name="HardDrivesPdDiagnostic">
<sequence>
<element name="objGuid" type="xs:string"
fixed="31e41907-53be-4f57-8ae2-a56c12d98d0e"/>
<element name="objId" type="xs:int" fixed="20060"/>
<element name="states" type="tns:HardDrivesStates"/>
</sequence>
</complexType>
HardDrivesStates
146 C5617M-H
Hardware Diagnostics Event
Messages
<complexType name="HardDrivesStates">
<sequence>
<element name="state" maxOccurs="unbounded" minOccurs="1"
type="tns:HardDrivesState"/>
</sequence>
</complexType>
HardDrivesState
This represents the current and previous condition of a hard drive.
<complexType name="HardDrivesState">
<sequence>
<element name="cur" type="xs:int"/>
<element name="prev" type="xs:int"/>
</sequence>
</complexType>
<pdDiagnostic>
<objGuid>8dda89bd-3c2c-4a35-aad4-1256cb5e1d27</objGuid>
<objId>20060</objId>
<states>
<state>
<cur>1</cur>
<prev>2</prev>
</state>
<state>
C5617M-H 147
Hardware Diagnostics Event
Messages
<cur>1</cur>
<prev>1</prev>
</state>
<state>
<cur>1</cur>
<prev>1</prev>
</state>
</states>
</pdDiagnostic>
LoggableEvent Object
For more details, refer to LoggableEvent.
<deviceUdn>uuid:AK-2</deviceUdn>
<deviceUrn>urn:schemas-pelco-com:device:Pelco:1</deviceUrn>
<serviceUrn></serviceUrn>
<logId></logId>
<major>7</major>
<minor>0</minor>
<type>9</type>
<reason>1</reason>
<parameters>
<param>
<paramId>6</paramId>
<name>HardDriveId</name>
<value>0</value>
<type>1</type>
</param>
</parameters>
ImproperShutdown (20070)
A ImproperShutdownPdDiagnostic object is sent when an improper shutdown occurs,
so a LoggableEvent object can be initialized with the appropriate major, minor, type,
and reason data.
PdDiagnostic
This is the data subscribers receive when the event triggers.
<complexType name="ImproperShutdownPdDiagnostic">
<sequence>
<element name="objGuid" type="xs:string"
fixed="a44945e0-fa54-4fb0-a614-2e71886c508f"/>
<element name="objId" type="xs:int" fixed="20070"/>
<element name="mode" type="xs:int"/>
</sequence>
</complexType>
<pdDiagnostic>
<objGuid>a44945e0-fa54-4fb0-a614-2e71886c508f</objGuid>
<objId>20070</objId>
148 C5617M-H
Hardware Diagnostics Event
Messages
<mode>4</mode>
</pdDiagnostic>
LoggableEvent Object
For more details, refer to LoggableEvent.
<deviceUdn>uuid:AK-2</deviceUdn>
<deviceUrn>urn:schemas-pelco-com:device:Pelco:1</deviceUrn>
<serviceUrn></serviceUrn>
<logId></logId>
<major>7</major>
<minor>0</minor>
<type>4</type>
<reason>4</reason>
<parameters></parameters>
LinkSpeed (20200)
This event triggers when the link speed changes. When this occurs, set the correct
major, minor, type, and reason for LoggableEvent. The current LinkSpeed is sent
as a parameter with the LoggableEvent object.
PdDiagnostic
This is the data subscribers receive when the event triggers.
<complexType name="LinkSpeedPdDiagnostic">
<sequence>
<element name="objGuid" type="xs:string"
fixed="b9359885-711a-4d71-b908-4bdf8753dbe8"/>
<element name="objId" type="xs:int" fixed="20200"/>
<element name="min" type="xs:int"/>
<element name="cur" type="xs:int"/>
</sequence>
</complexType>
<pdDiagnostic>
<objGuid>b9359885-711a-4d71-b908-4bdf8753dbe8</objGuid>
<objId>20200</objId>
<min>100</min>
<cur>10</cur>
</pdDiagnostic>
LoggableEvent Object
For more details, refer to LoggableEvent.
<deviceUdn>uuid:AK-2</deviceUdn>
<deviceUrn>urn:schemas-pelco-com:device:Pelco:1</deviceUrn>
C5617M-H 149
Hardware Diagnostics Event
Messages
<serviceUrn></serviceUrn>
<logId></logId>
<major>7</major>
<minor>0</minor>
<type>6</type>
<reason>0</reason>
<parameters>
<param>
<paramId>5</paramId>
<name>CurrentLinkSpeed</name>
<value>10</value>
<type>1</type>
</param>
</parameters>
PowerSupply (20120)
A PowerSupplyPdDiagnostic object is sent when a power supply encounters
a problem so that a LoggableEvent object can be initialized with the appropriate
major, minor, type, and reason data.
PdDiagnostic
This is the data subscribers receive when the event triggers.
<complexType name="PowerSupplyPdDiagnostic">
<sequence>
<element name="objGuid" type="xs:string"
fixed="26f051aa-009b-4a5d-ab20-09b064a07a52"/>
<element name="objId" type="xs:int" fixed="20120"/>
<element name="inAlarm" type="xs:int"/>
</sequence>
</complexType>
0 Th
is o
pro
ala
1 Pro
pow
ala
<pdDiagnostic>
<objGuid>26f051aa-009b-4a5d-ab20-09b064a07a52</objGuid>
<objId>20120</objId>
<inAlarm></inAlarm>
</pdDiagnostic>
LoggableEvent Object
150 C5617M-H
Hardware Diagnostics Event
Messages
<deviceUdn>uuid:AK-2</deviceUdn>
<deviceUrn>urn:schemas-pelco-com:device:Pelco:1</deviceUrn>
<serviceUrn></serviceUrn>
<logId></logId>
<major>7</major>
<minor>0</minor>
<type>2</type>
<reason>0</reason>
<parameters></parameters>
UPS (20170)
This event triggers if a UPS either fails or runs out of power.
PdDiagnostic
This is the data subscribers receive when the event triggers.
<complexType name="UPSPdDiagnostic">
<sequence>
<element name="objGuid" type="xs:string"
fixed="e746c2c8-0b97-402e-abc3-c784890c8d99"/>
<element name="objId" type="xs:int" fixed="20170"/>
<element name="cur" type="xs:int"/>
<element name="pre" type="xs:int"/>
<element name="rem" type="xs:int"/>
</sequence>
</complexType>
<pdDiagnostic>
<objGuid>e746c2c8-0b97-402e-abc3-c784890c8d99</objGuid>
<objId>20170</objId>
<Cur>4</Cur>
<Pre>1</Pre>
<Rem>0</Rem>
</pdDiagnostic>
LoggableEvent Object
For more details, refer to LoggableEvent.
<deviceUdn>uuid:AK-2</deviceUdn>
<deviceUrn>urn:schemas-pelco-com:device:Pelco:1</deviceUrn>
<serviceUrn></serviceUrn>
<logId></logId>
<major>7</major>
<minor>0</minor>
<type>24</type>
C5617M-H 151
Hardware Diagnostics Event
Messages
<reason>0</reason>
<parameters>
<param>
<paramId>4</paramId>
<name>TimeRemaining</name>
<value>0</value>
<type>1</type>
</param>
</parameters>
152 C5617M-H
Software Diagnostics Event Messages
<complexType name="DataLossPdDiagnostic">
<sequence>
<element name="objGuid" type="xs:string"
fixed="94b6d2d3-c68e-4b13-974a-08f69f50cb67"/>
<element name="objId" type="xs:int" fixed="20040"/>
</sequence>
</complexType>
<complexType name="DataLossPdDiagnostic">
<sequence>
<element name="objGuid" type="xs:string"
fixed="94b6d2d3-c68e-4b13-974a-08f69f50cb67"/>
<element name="objId" type="xs:int" fixed="20040"/>
</sequence>
</complexType>
LoggableEvent object
For more details, refer to LoggableEvent.
<deviceUdn>uuid:AK-2</deviceUdn>
<deviceUrn>urn:schemas-pelco-com:device:Pelco:1</deviceUrn>
<serviceUrn></serviceUrn>
<logId></logId>
<major>7</major>
<minor>0</minor>
<type>8</type>
<reason>0</reason>
<parameters></parameters>
InputStreams 20160
For each stream entry that has its state changed from previous state, the software
sends out a loggable event with appropriate major, minor, type and reason.
<complexType name="InputStreams">
<sequence>
<element name="objGuid" type="xs:string"
fixed="31e41907-53be-4f57-8ae2-a56c12d98d0e"/>
<element name="objId" type="xs:int" fixed="20160"/>
<element name="states" type="tns:InputStreamsEntries"/>
C5617M-H 153
Software Diagnostics Event Messages
</sequence>
</complexType>
<pdDiagnostic>
<objId>20160</objId>
<context>uuid:a58172d6-a22e-45b1-a67a-9a84515c3fa0</context>
<entries>
<entry>
<id>uuid:a58172d6-a22e-45b1-a67a-9a84515c3fa0</id>
<mediaType>0</mediaType>
<hardwareId>1</hardwareId>
<channelId>1</channelId>
<stateCur>4</stateCur>
<statePrev>2</statePrev>
</entry>
</entries>
</pdDiagnostic>
InputStreamsEntries
A list of InputStreamsEntry data types.
<pdDiagnostic>
<objId>20160</objId>
<context>uuid:a58172d6-a22e-45b1-a67a-9a84515c3fa0</context>
<entries>
<entry>
<id>uuid:a58172d6-a22e-45b1-a67a-9a84515c3fa0</id>
<mediaType>0</mediaType>
<hardwareId>1</hardwareId>
<channelId>1</channelId>
<stateCur>4</stateCur>
<statePrev>2</statePrev>
</entry>
</entries>
</pdDiagnostic>
InputStreamsEntry
<complexType name="InputStreamsEntry">
<sequence>
<element name="id" type="xs:string"/>
<element name="mediaType" type="xs:int"/>
<element name="hardwareId" type="xs:string"/>
<element name="stateCur" type="xs:int"/>
<element name="statePrev" type="xs:int"/>
</sequence>
</complexType>
154 C5617M-H
Software Diagnostics Event Messages
PacketLoss 20080
This event is fired when there is data loss during video data writing. Sets the
appropriate major, minor, type, and reason in Loggable Event.
PdDiagnostic
This is the data that subscribers receive when the event triggers.
<complexType name="PacketLossPdDiagnostic">
<sequence>
<element name="objGuid" type="xs:string" fixed="ddfa09d6-64f1-4b39-a7e7-
de0c5f7780cc"/>
<element name="objId" type="xs:int" fixed="20080"/>
<element name="max" type="xs:float"/>
<element name="cur" type="xs:float"/>
</sequence>
</complexType>
LoggableEvent Object
C5617M-H 155
Software Diagnostics Event Messages
<deviceUdn>uuid:AK-2</deviceUdn>
<deviceUrn>urn:schemas-pelco-com:device:Pelco:1</deviceUrn>
<serviceUrn></serviceUrn>
<logId></logId>
<major>7</major>
<minor>0</minor>
<type>11</type>
<reason>0</reason>
<parameters>
<param>
<paramId>3</paramId>
<name>PercentageOfCurrentPacketLoss</name>
<value>5.1235</value>
<type>0</type>
</param>
</parameters>
SEBs 20210
For each PdDiagSebs object, loggable events are sent only when the state of a
particular SEB changes. Set the state of the SEB to the appropriate major, minor,
type, and reason.
PdDiagnostic
This is the data subscribers receive when the event triggers.
<complexType name="SEBsPdDiagnostic">
<sequence>
<element name="objGuid" type="xs:string"
fixed="31e41907-53be-4f57-8ae2-a56c12d98d0e"/>
<element name="objId" type="xs:int" fixed="20210"/>
<element name="entries" type="tns:SEBSEntries"/>
</sequence>
</complexType>
SEBsEntries
A list of SEBsEntry data types.
<complexType name="SEBsEntries">
<sequence>
<element name="entry" maxOccurs="unbounded" minOccurs="1"
type="tns:SEBsEntry"/>
</sequence>
</complexType>
156 C5617M-H
Software Diagnostics Event Messages
SEBsEntry
<complexType name="SEBsEntry">
<sequence>
<element name="stateCur" type="xs:int"/>
<element name="statePrev" type="xs:int"/>
</sequence>
<attribute name="id" type="xs:string" fixed="US"/>
</complexType>
<pdDiagnostic>
<objGuid>2e9f0d2e-adf3-453b-aabc-a0223a604040</objGuid>
<objId>20210</objId>
<entries>
<entry id="hello0">
<stateCur>0</stateCur>
<statePrev>0</statePrev>
</entry>
<entry id="hello1">
<stateCur>0</stateCur>
<statePrev>0</statePrev>
</entry>
<entry id="hello2">
<stateCur>0</stateCur>
<statePrev>0</statePrev>
</entry>
<entry id="hello5"></entry>
</entries>
</pdDiagnostic>
LoggableEvent Object
For more details, refer to LoggableEvent.
<deviceUdn>uuid:AK-2</deviceUdn>
<deviceUrn>urn:schemas-pelco-com:device:Pelco:1</deviceUrn>
<serviceUrn></serviceUrn>
<logId></logId>
<major>7</major>
<minor>0</minor>
<type>9</type>
<reason>2</reason>
<parameters>
<param>
<paramId>7</paramId>
<name>SEBId</name>
<value>hello4</value>
<type>0</type>
</param>
</parameters>
StorageFull 20190
When this event triggers from a device with fully used storage, the appropriate major,
minor, type, and reason is set in the Loggable event.
C5617M-H 157
Software Diagnostics Event Messages
PdDiagnostic
This is the data that subscribers receive when the event triggers.
<complexType name="StorageFullPdDiagnostic">
<sequence>
<element name="objGuid" type="xs:string" fixed="94b6d2d3-
c68e-4b13-974a-08f69f50cb67"/>
<element name="objId" type="xs:int" fixed="20190"/>
<element name="inAlarm" type="xs:int"/>
</sequence>
</complexType>
<pdDiagnostic>
<objGuid>3df223ee-8041-4c1a-be77-2d140e5588aa</objGuid>
<objId>20190</objId>
<inAlarm></inAlarm>
</pdDiagnostic>
LoggableEvent Object
For more details, refer to DataLoss 20040 LoggableEvent above.
<deviceUdn>uuid:AK-2</deviceUdn>
<deviceUrn>urn:schemas-pelco-com:device:Pelco:1</deviceUrn>
<serviceUrn></serviceUrn>
<logId></logId>
<major>7</major>
<minor>0</minor>
<type>13</type>
<reason>0</reason>
StorageTime 20130
This event is fired if the NVR/DVR is unable to achieve the user-configured video
storage time.
PdDiagnostic
This is the data that subscribers receive when the event triggers.
<complexType name="StorageTimePdDiagnostic">
<sequence>
<element name="objGuid" type="xs:string"
fixed="e08fa1d1-9b30-4e62-bc8b-16cca0f57cb0"/>
<element name="objId" type="xs:int" fixed="20130"/>
<element name="min" type="xs:int"/>
<element name="cur" type="xs:int"/>
158 C5617M-H
Software Diagnostics Event Messages
</sequence>
</complexType>
<pdDiagnostic>
<objGuid>e08fa1d1-9b30-4e62-bc8b-16cca0f57cb0</objGuid>
<objId>20130</objId>
<min>5</min>
<cur>4</cur>
</pdDiagnostic>
LoggableEvent Object
For more details, refer to LoggableEvent.
<deviceUdn>uuid:AK-2</deviceUdn>
<deviceUrn>urn:schemas-pelco-com:device:Pelco:1</deviceUrn>
<serviceUrn></serviceUrn>
<logId></logId>
<major>7</major>
<minor>0</minor>
<type>12</type>
<reason>0</reason>
<parameters>
<param>
<paramId>8</paramId>
<name>CurrentStorageTime</name>
<value>4</value>
<type>1</type>
</param>
</parameters>
Temperature 20140
A Temperature PdDiagnostic object is triggered when temperature goes beyond
specific range. The current range is set between 10° to 50° Celsius. This verifies if
the current temperature is below minimum or above maximum threshold, and then
determines whether to send Loggable Events, with reason set to either LOW or
HIGH accordingly.
PdDiagnostic
This is the data that subscribers receive when the event triggers.
<complexType name="TemperaturePdDiagnostic">
<sequence>
<element name="objGuid" type="xs:string"
fixed="26f051aa-009b-4a5d-ab20-09b064a07a52"/>
<element name="objId" type="xs:int" fixed="20140"/>
<element name="min" type="xs:int"/>
C5617M-H 159
Software Diagnostics Event Messages
<pdDiagnostic>
<objGuid>7448f68a-de77-4ea9-b000-65b63bf54bd5</objGuid>
<objId>20140</objId>
<min>10</min>
<max>20</max>
<cur>5</cur>
</pdDiagnostic>
LoggableEvent Object
For more details, refer to LoggableEvent.
<deviceUdn>uuid:AK-2</deviceUdn>
<deviceUrn>urn:schemas-pelco-com:device:Pelco:1</deviceUrn>
<serviceUrn></serviceUrn>
<logId></logId>
<major>7</major>
<minor>0</minor>
<type>3</type>
<reason>0</reason>
<parameters>
<param>
<paramId>1</paramId>
<name>CurrentTemperature</name>
<value>5</value>
<type>1</type>
</param>
</parameters>
160 C5617M-H
Video Streaming and Exporting
Performance
• Video streaming and video exporting are CPU intensive operations, and were
tested using various scenarios.
• Event monitoring and normal operations of the Pelco SDK are not CPU intensive
and were not measured.
• For the results shown in the following tables, each computer used no more than
60% of the available CPU capacity. This allows for other processes executing
concurrently during the test operations.
• Additional processes, especially CPU and GPU intensive processes, can
decrease the performance of the Pelco SDK applications.
NOTE:
• The test video streams were 30 IPS.
• Scene depicted is of medium complexity (the scene contained some motion).
Maximum Number of Concurrent Video Streams (Minimum
Specification Computer)
The maximum number of concurrent video streams supported by a computer with the
minimum specifications are shown in the following table.
Stream
Transport
C5617M-H 161
Video Streaming and Exporting
Performance
Stream
Transport
Stream Type RTP Live RTP Playback RTSP Live RTSP
Playback
MPEG-4, 1SIF 32 32 16 21
(352x240)
MPEG-4, 4SIF 32 22 10 10
(704x480)
H.264, 1SIF 32 20 12 12
(352x240)
H.264, 4SIF 32 20 6 6
(704x480)
H.264, 720P 20 7 3 3
(1280x720)
H.264, 1080P 3 4 3 2
(1920x1080)
Export Type
162 C5617M-H
Video Streaming and Exporting
Performance
Export Type
Stream Type Single Export (overlays) Two-Clip Export
(stitched, overlays)
MPEG-4, 1SIF (352x240) 4 5
MPEG-4, 4SIF (704x480) 3 4
H.264, 1SIF (352x240) 4 2
H.264, 4SIF (704x480) 3 2
H.264, 720P (1280x720) 2 1
H.264, 1080P (1920x1080) 2 1
C5617M-H 163
Glossary
A
ActiveX® : ActiveX® ActiveX® is an integration platform that provides developers,
users, and Web producers a fast and easy way to create integrated programs and
content for Microsoft based Internet and Intranet software. For more information, refer
to http://support.microsoft.com/kb/154544
Alarm :
In video security: An alarm occurs when a camera detects motion or there is a
change in a physical alarm input, such as a door opening or closing.
In card access: This is a condition caused by a system event or action to raise
awareness to security staff.
Alarm relay : The alarm relay is the relay used to output an alarm condition based
on a specific system or event message criteria.
Autofocus : Autofocus is the ability of the lens to remain in focus during zoom-in,
zoom-out, and motion functions.
B
bit : Abbreviation for binary digit; the smallest unit of information a computer can use.
A bit is either one or zero (a high or low voltage state).
bit rate : Bit rate is the number of bits that are transferred between devices in a
specified amount of time, typically one second.
Brightness : In NTSC and PAL video signals, the brightness information at any
particular instant in a picture is conveyed by the corresponding instantaneous direct
current level of active video. Brightness control should be adjusted so that the black
picture content displays as true black on your monitor.
C
Camera group : In an Endura system, a camera group is a collection of cameras
associated with each other as part of the setup process. Camera groups can be
164 C5617M-H
used in filtering cameras displayed in the Nav window, as well as those selected for
schedules, scripts, or permissions.
Coaxitron :
Coaxitron is the Pelco protocol that uses “up-the-coax” technology. Commands to
control pan/tilt devices are transmitted during the vertical blanking interval of the
video signal. Instead of separate wiring for control commands and video, Coaxitron
uses the coaxial cable for both video and control.
Standard: This earlier technology uses 15 bits to send a command.
Extended: This later technology uses 32 bits to send a command.
D
D1 : D1 is a digital video format developed by Society of Motion Picture and
Television Engineers (SMPTE). The D1 format resolution is 720 × 480 for NTSC and
720 × 576 for PAL.
E
Encoder : In an Endura system, the encoder is a high-performance MPEG-4 device
that takes analog video signals through a standard BNC coaxial cable and digitizes,
compresses, signs, and packetizes them for the network. It also provides an interface
for relays, alarms, and audio connections.
C5617M-H 165
Encoding : Encoding is the process of taking an analog signal and converting it to a
digital format (A to D conversion). Compression is applied at this point in the process.
F
Firmware : Firmware is a software process that is embedded in a hardware platform
that instructs the hardware unit how to behave and what action to perform.
Focus : Focus means to adjust a lens to allow objects at various distances from the
camera to be sharply defined.
Frame rate : The frame rate is the number of frames or images that are captured,
stored, projected, or displayed per second.
G
Gamma : Gamma is the correction of the linear response of a camera to compensate
for the nonlinear response of a monitor’s phosphor screen. It is measured with the
exponential value of the curve describing the nonlinearity. A typical monochrome
monitor gamma is 2.2, and a camera needs to be set to the inverse value of 2.2
(which is 0.45) for the overall system to respond linearly (that is, unity).
H
H.264 : Developed by the ITU-T Video Coding Experts Group (VCEG), H.264 is a
low-bit-rate compressed video format standard.
Hue : Hue is one of the characteristics that distinguishes one color from another.
Hue defines color on the basis of its position in the spectrum, that is, whether
red, blue, green or yellow, and so forth. Hue is one of the three characteristics of
television color; the other two are saturation and luminance. In NTSC and PAL video
signals, the hue information at any particular point in the picture is conveyed by the
corresponding instantaneous phase of the active video subcarrier.
I
I-frame : In a compressed digital image, I-frames (intraframes) are the frames that
are compressed independently of the other frames in the sequence.
IP : Internet Protocol. IP is the main method of transmitting data across the Internet.
166 C5617M-H
IP camera : An IP camera is a digital video camera that outputs IP packets over
Ethernet cabling. An IP camera can use TCP protocol, as well as UDP or RTP.
IP header : An IP packet can be divided into two main parts: the payload and the
header. The header is the part of the packet that contains the routing information,
and is is comprised of many parts. The header contains all IP and MAC addressing
information. The header is the only part of the packet that a router examines when
trying to determine where to send a packet.
Iris : The iris is a means of controlling the size of a lens aperture and therefore the
amount of light passing through the lens.
M
marshalling: Marshalling is synonymous with serialization.
Multicast : A single device sends information across a network and that stream
is received by all listening devices on the network. A special IP address range has
been reserved for this purpose: 224.0.0.1-239.255.255.255 with a subnet mask of
255.255.0.0. Each multicast transmitting device sends a data stream to an address
from the above range. Any device on the network can then listen for transmissions
to that IP address and receive the stream. Multicast offers a reduction of bandwidth
consumption over the unicast and broadcast delivery methods. Multicast also offers
control over which devices on a network can receive a multicast stream. In an
Endura system, only Endura devices can receive Endura multicast streams. Multicast
traffic is not routable across the Internet without a specially reserved address or
encapsulation.
Multicast server : A multicast server is any server that takes a unicast transmission
on behalf of a client and converts it to a multicast transmission on the network.
N
Namespace : Namespace is an identifier that denotes a group of names. It is used to
prevent resource identifier conflicts.
C5617M-H 167
P
Phase Alternation by Line (PAL) : PAL is the European (50 Hz) color TV standard.
It is used by most countries outside the US. It specifies 625 lines/screen, and 25
frames per second.
Parity : Parity is a method of checking the accuracy of data to identify whether the
bits being moved arrived successfully. Parity bit checking can be based on odd or
even bits. No parity means that a parity bit is not transmitted or checked.
Power over Ethernet (PoE) : PoE enables both power and video to transmit on a
single cable.
Protocol :
Protocol is a set of rules governing the transmission of data between equipment:
D Pelco protocol that uses seven bytes to send a command.
M Pelco protocol for communicating with M devices (KBD960/KBR960 keyboards,
ALM2064 alarm interface units, and REL2064 relay interface units).
P Pelco protocol that uses a variable number of bytes to send a command. Eight
bytes are used to send commands to dome systems.
R
Relay group : A relay group is a defined set of relays acting in a coordinated pattern.
Remote Procedure Calls (RPCs) : RPC is a protocol that allows software running
on one host to cause other software to be run on another host.
Real Time Streaming Protocol (RTSP) : A protocol for streaming data, which allows
clients to remotely control the server streaming the data.
S
Saturation : Saturation is the intensity of the colors in the active picture: the amount
by which the eye perceives a color as departing from a gray or white scale of the
same brightness. A 100% saturated color does not contain any white; adding white
reduces saturation. In NTSC and PAL video signals, the color saturation at any
particular instant in the picture is conveyed by the corresponding instantaneous
amplitude of the active video subcarrier.
Sequence : To view a group of cameras, one after the other, either manually or
automatically.
168 C5617M-H
Server : A server is a computer and its software that provides some service for other
computers connected to it through a network.
Service : Service is the ability of a device within the Endura system to perform such
functions as pan/tilt/zoom, record video, and playback video. When a device comes
on line, these services are automatically advertised to other devices on the network.
For a user to access these services, the user must be assigned a role with the proper
permissions.
Sharpness : Sharpness refers to a function that allows a user to adjust the image
between a “soft” look and a sharp look.
SIF : Source Input Format. Resolution depends on the source: NTSC SIF equals 352
x 240 pixels. Refer to CIF for PAL resolutions.
T
TCP/IP connection : Transmission Control Protocol/Internet Protocol. TCP/IP is the
standard way of communicating over a network that ensures all devices on a network
can communicate and information is passed without any errors.
U
UDN: Universal Device Number.
UDP : User Data-gram Protocol is a connectionless protocol that, like TCP, runs on
top of IP networks. Unlike TCP/IP, UDP/IP provides very few error recovery services,
offering instead a direct way to send and receive data-grams over an IP network. It is
used primarily for broadcasting messages over a network.
V
Varifocal :
C5617M-H 169
Varifocal refers to a lens with a variable focal length. Varifocal lenses are low cost
zoom lenses that can be adjusted (zoomed) over a range of focal lengths. These
lenses are much lower in cost than normal zoom lenses because they have fewer
elements in them.
Disadvantage: Unlike a zoom lens, a varifocal lens does not maintain focus when
zoomed. It is practical only for use with cameras where the zoom is set once at
installation.
Advantage: The installer can adjust a varifocal lens for optimum field of view without
changing the lens.
W
WSDL : Web Services Description Languages (WSDLs).
170 C5617M-H
Pelco by Schneider Electric
3500 Pelco Way
Clovis, California 93612-5699
USA
USA & Canada Tel (800) 289-9100
International Tel +1 (559) 292-1981
www.pelco.com
Pelco, the Pelco logo, and other trademarks associated with Pelco products referred to in this publication are trademarks of Pelco, Inc. or its
affiliates.
All other product names and services are the property of their respective companies.
Product specifications and availability are subject to change without notice.
C5617M-H