Pelco Developer Network (PDN)

Discover a Pelco DX 48000 in C++ Application

1. I have a Pelco DX4800 Hybrid Video Recorder.
2. I have added it to my network and have gave it an address of 192.168.80.217 and it is using port 9001.
3. I can view video via my web browser by pointing it to http://192.168.80.217/ Please see the attached file for proof of this.
4. I have created a Visual Studio 2012 C++ console application and I am using the Pelco SDK 3.4. From the PelcoSDK 3.4 Programming Guide C5617M-H (2014-04).pdf I have tried several ways to add my recorder to a collection.

I have first tried the following:

#include "stdafx.h"
#include "windowsx.h"
#include "objbase.h"
 
#include "PelcoSDK/PelcoSDK.h"
#include "PelcoSDK/SystemCollection.h"
#include "PelcoSDK/Exception.h"
#include "PelcoSDK/Constants.h"
#include "PelcoSDK/Administrator.h"
 
int _tmain(int argc, _TCHAR* argv[])
{
   try
   {
      HRESULT hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
 
      if (SUCCEEDED(hr))
      {
        // Startup the PelcoSDK
	PelcoSDK::Startup();
 
        // Create a system object
	PelcoSDK::System system("admin:admin@pelcosystem://192.168.80.217:9001?alias=My48000Pelco");
	// Create a device collection object and populate it with the devices from the system object
	PelcoSDK::DeviceCollection deviceCollection(system.GetDeviceCollection());
	// 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());
	   // Display the device name
	   printf("\tDevice Name: %s\n", device.GetModelName());
	}
	// Display the number of devices
	printf("=========================================\n");
	printf("Total Devices: %d", deviceCollection.GetCount());		
      }
   }
   catch (PelcoSDK::Exception ex)
   {
	printf("An error occurred\nError: %s", ex.Message().c_str());
   }
   return 0;
}

And I get an exception "Invalid credentials" thrown from the line:

PelcoSDK::System system("admin:admin@pelcosystem://192.168.80.217:9001?alias=My48000Pelco");

When I used wireshark to view the network traffic between my PC and my Pelco DX4800 I see the following conversation at the above line of code:

Then I changed the following so that I am adding a pelco edge device:

PelcoSDK::System system("admin:admin@pelcoedgedevices://192.168.80.217:9001?alias=My48000Pelco");

This does not throw an exception but when I step through the code it says the Total Devices is 0.

Next I tried the following code to add my Pelco Device:

PelcoSDK::System system("admin:admin@pelcoedgedevices://?alias=EdgeDeviceSystem");
// Create a device collection for the system
PelcoSDK::DeviceCollection dc = system.GetDeviceCollection();
// Add a device. Credentials are specified because the device requires authentication.
PelcoSDK::DeviceCollection devicesAdded = dc.Add("admin:admin@pelcoedgedevices://192.168.80.217:9001");

The dc.Add throws the exception: "Device Not Found"

And when I view the wireshark conversation between my PC and my Pelco Device I see the following:

GET /Device.xml HTTP/1.1
Host: 192.168.80.217
Connection: Close

What is the proper way to use the SDK to add my Pelco Unit in a C++ application??
My first step is to add and connect to a unit and then retrieve live video but first I must get the above working.

If you have a non-HD 4800 make sure it is running firmware 1.02.01.0866 or later. For HD check that the firmware is version 2.00.2.0682 or later. Reference http://pdn.pelco.com/content/dx4700-dx4800 and http://pdn.pelco.com/content/dx4700hd-dx4800hd.

The Wireshark trace did not appear in your post and the file is not attached.

Aside from that, it is unclear why the login credentials do not work. But on to the next tests:

The line:
PelcoSDK::System system("admin:admin@pelcoedgedevices://192.168.80.217:9001?alias=My48000Pelco");

is incorrect syntax for creating an edge system. Do not include the IP address and port.

Your next sequence is correct to create the edge system:
PelcoSDK::System system("admin:admin@pelcoedgedevices://?alias=EdgeDeviceSystem");
. . .
PelcoSDK::DeviceCollection devicesAdded = dc.Add("admin:admin@pelcoedgedevices://192.168.80.217:9001");

Why it cannot contact the device is unclear.

Can you delete the local device cache file and try the latter edge sequence again? The cache file is located (on Win 7) at C:\Program Data\Pelco\SDK.

Use pelcosystem instead of pelcoedgedevices, and try leaving off the port:
admin:admin@pelcosystem://192.168.80.217

If needed, try port 60001 instead of 9001.

Hope this helps.

Adding image to show successful viewing of video from DX4800 via web browser.

Video in web browser

I updated your comment to display the image. The sequence is:

  1. Upload your image as part of the post or comment.
  2. Right-click the image file in the list below the edit box. Select "Copy Link" or equivalent in your browser.
  3. Create an image in your post using the tool icons above the edit box.
  4. In the image URL field paste the link that you just copied. Supply alternate text (required) and optional width/height.
  5. Save the new image values.

That sequence is not as intuitive as it should be.