示例#1
0
        public byte[] BuildProbeMatches(string[] scopes, bool onvif20, string[] xAddrs, string relateTo)
        {
            WSD.ProbeMatchesType probeMatches = new WSD.ProbeMatchesType();

            probeMatches.ProbeMatch = new WSD.ProbeMatchType[1];
            WSD.ProbeMatchType probeMatch = new WSD.ProbeMatchType();

            // Scopes
            probeMatch.Scopes = BuildScopes(scopes, null);

            // Types
            XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();

            probeMatch.Types = BuildTypes(onvif20, ref namespaces);

            // EndpointReference
            probeMatch.EndpointReference = BuildEndpointReference();

            // XAddrs
            probeMatch.XAddrs = BuildXAddrs(xAddrs);

            // MetadataVersion
            probeMatch.MetadataVersion = 0;

            probeMatches.ProbeMatch[0] = probeMatch;

            DiscoveryHeaderBuilder header = new DiscoveryHeaderBuilder();

            header.OrigingMessageId = relateTo;

            byte[] msg = SoapBuilder.BuildMessage(probeMatches, Encoding.UTF8, header, namespaces);

            return(msg);
        }
示例#2
0
        public static string GetDeviceId(WSD.ProbeMatchesType matches)
        {
            string id = string.Empty;

            if ((matches != null) &&
                (matches.ProbeMatch != null) &&
                (matches.ProbeMatch.Length > 0) &&
                (matches.ProbeMatch[0].EndpointReference != null) &&
                (matches.ProbeMatch[0].EndpointReference.Address != null))
            {
                id = matches.ProbeMatch[0].EndpointReference.Address.Value;
            }
            return(id);
        }
示例#3
0
        public WSD.ProbeMatchesType BuildProbeMatches(WSD.ProbeType probe)
        {
            WSD.ProbeMatchType match = new WSD.ProbeMatchType();
            match.EndpointReference               = new WSD.EndpointReferenceType();
            match.EndpointReference.Address       = new WSD.AttributedURI();
            match.EndpointReference.Address.Value = _uuid;
            match.Types       = "dn:NetworkVideoTransmitter";
            match.Scopes      = new WSD.ScopesType();
            match.Scopes.Text = _scopes;
            match.XAddrs      = ServiceAddress;

            WSD.ProbeMatchesType matches = new WSD.ProbeMatchesType();
            matches.ProbeMatch = new WSD.ProbeMatchType[] { match };
            return(matches);
        }
示例#4
0
        public byte[] BuildProbeMatches(string[] scopes, bool onvif20, string[] xAddrs, string relateTo)
        {
            WSD.ProbeMatchesType probeMatches = new WSD.ProbeMatchesType();

            probeMatches.ProbeMatch = new WSD.ProbeMatchType[1];
            WSD.ProbeMatchType probeMatch = new WSD.ProbeMatchType();

            probeMatches.Xmlns = new XmlSerializerNamespaces();
            probeMatches.Xmlns.Add("dis", "http://schemas.xmlsoap.org/ws/2005/04/discovery");
            probeMatch.Xmlns = new XmlSerializerNamespaces();
            probeMatch.Xmlns.Add("", "http://www.onvif.org/ver10/device/wsdl");

            // Scopes
            probeMatch.Scopes = BuildScopes(scopes, null);

            // Types
            XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();

            namespaces.Add("dis", "http://schemas.xmlsoap.org/ws/2005/04/discovery");
            probeMatch.Types = BuildTypes(onvif20, ref namespaces);

            // EndpointReference
            probeMatch.EndpointReference = BuildEndpointReference();

            // XAddrs
            probeMatch.XAddrs = BuildXAddrs(xAddrs);

            // MetadataVersion
            probeMatch.MetadataVersion = 0;

            probeMatches.ProbeMatch[0] = probeMatch;

            DiscoveryHeaderBuilder header = new DiscoveryHeaderBuilder();

            header.OrigingMessageId = relateTo;

            byte[] msg = SoapBuilder.BuildMessage(probeMatches, Encoding.UTF8, header, namespaces);

            return(msg);
        }