onvif-interface icon indicating copy to clipboard operation
onvif-interface copied to clipboard

could you explain how to get OnvifEvents

Open dotori1995-enu opened this issue 3 years ago • 2 comments

I don’t know what to say for your contribution! i learn about the onvif interface, and maked onvif PTZ function.

but i encounter the new big deal.

        public void pull(string ip, int port)
        {
             ....
             ....

            // 2. CreatePullPointSubscription
            FilterType filter = new FilterType();
            DateTime currentTime;
            XmlElement[] xml = null;
            DateTime? termTime;
            List<MessageHeader> lstHeaders = new List<MessageHeader>() { };

            EndpointReferenceType ert = eptc.CreatePullPointSubscription(
                filter,
                "PT15S",
                new CreatePullPointSubscriptionSubscriptionPolicy(),
                ref xml,
                out currentTime,
                out termTime
                );
            listBox1.Items.Add(ert.Address.Value);

            //PROBLEM HERE "ReferenceParameters" IS NULL
            if ((ert.ReferenceParameters != null) && (ert.ReferenceParameters.Any != null))
            {
                foreach (System.Xml.XmlElement oXml in ert.ReferenceParameters.Any)
                {
                    string strName = oXml.LocalName;
                    string strNS = oXml.NamespaceURI;
                    string strValue = oXml.InnerXml;

                    lstHeaders.Add(MessageHeader.CreateHeader(strName, strNS, strValue, true));
                }
            }

i always get that "ReferenceParameters" is null.

image

could you explain what happen in this code?


OS: window10 develop framework: dotnet framwork 4.8 IDE: visual studio 2022

Thanks for reading

dotori1995-enu avatar Nov 08 '22 17:11 dotori1995-enu

Hi! Glad you've found some of this to be helpful. I haven't worked with this in 5+ years at this point and, unfortunately, don't have the ability to really investigate this. Probably unrelated to your issue, but maybe try 192.168.0.10 in the Camera IP field rather than 192, 168, 0, 10.

thephez avatar Nov 09 '22 13:11 thephez

Thank you for reply. that problem is almost solved! it's all thanks to you.

dotori1995-enu avatar Nov 17 '22 07:11 dotori1995-enu