Pelco Developer Network (PDN)

Check connection to SM


I am wondering if there is a variable/function/method available in the Pelco SDK that can return the connection status after logging in to a device such as a System Manager? The reason for this is because I wish to be notified if my application is disconnected from the System Manager at any point of time after a successful connection.

Also I have tried using the Events Sample application but it does not seem to work. After selecting "Online" option, the program displayed "Subscribing online event successful" but nothing appears after that. Even after I disconnected my network to the SM, it does not show any events regarding the disconnection.

I really appreciate your help in this.Thank you.

Best Regards,

The Pelco SDK device cache does automatically update periodically to try and update a device cache. You can test this to see what happens when connection cannot be made to a VMS system during that refresh interval - it may fail silently with an error message in a log (which I believe to be the case).

Detecting when a device is no longer available or offline is a major challenge and issue that can be resolved in a number of ways. For a system manager on a VMS, you are in a special situation where not much that the SDK can offer will tell you much -- because the device that would give you any sort of notification can't be reached. If it can't be reached, it can't give you any notification. For that reason you'll need to code a check within your application using a method of your choosing. You might try to use an inexpensive system request (do not do a GetDevices request too frequently) periodically to see if the connection is still there. You might choose to use PING and see if you can reach the VMS manager that way. That is really up to you.

In your final point Online events have had a point of contention lately. I've tested it recently with a DS to discover that the DeviceRegistry service running with DS Pelco API does not support eventing. Typically with Endura that was our suggestion, to use GENA protocol to subscribe to the DeviceRegistry service on the Endura SM to determine when a device is registered or unregistered with the Endura SM. That is what the Pelco SDK is attempting to do. You can use Wireshark and see the SUBSCRIBE event to the Endura SM - as long as you aren't connecting over encrypted network like a VPN. Once that subscription is established then changes in state or events will be sent with a NOTIFY message on the network (also can be seen in Wireshark) when an event triggers.

As a final example, if you Use "Online" to an Endura SM, what should happen is a SUBSCRIBE to the Endura SM's Device Registry service. If a device is registered or unregistered with the SM you should receive a NOTIFY message eventually on this change -- it can and will usually take a few minutes and a bit of time. If the connection to the Endura SM Is broken, you will never receive this NOTIFY message ... (since there's no connection!) so the NOTIFY event will never arrive or trigger and will not result in a message. That's why you have to code around this to take this kind of situation into account.

I hope that all makes sense and is helpful to you.