private WSD.ScopesType BuildScopes(string[] scopeStrings, string matchBy) { WSD.ScopesType scopes = new WSD.ScopesType(); scopes.MatchBy = matchBy; scopes.Text = new string[] { (scopeStrings != null ? string.Join(" ", scopeStrings) : string.Empty) }; return(scopes); }
private static bool CheckDeviceType( byte[] message, string typesPath, WSD.ScopesType scopes, out string reason) { //AnnaT, 2011.11.18 : for 1.0 style bool device10 = CheckDeviceType(message, typesPath, GetOnvif10Type()); if (device10) { reason = string.Empty; } else { reason = string.Format("Device type is not {0} with namespace {1}", ONVIF_DISCOVER_TYPES, ONVIF_NETWORK_WSDL_URL); } return(device10); // for latest core spec //if (!CheckDeviceType(message, typesPath, GetOnvif20Type())) //{ // reason = string.Format("Device type is not {0} with namespace {1}", ONVIF_20_DEVICE_TYPE, ONVIF_20_DEVICE_NS); // return false; //} //bool hasNvtScope = ((scopes != null) && (scopes.Text != null) // && (!string.IsNullOrEmpty(GetMissingScope(scopes.Text, new string[] { NVT_SCOPE })))); //if (hasNvtScope == CheckDeviceType(message, typesPath, GetOnvif10Type())) //{ // reason = string.Empty; // return true; //} //else //{ // if (hasNvtScope) // { // reason = string.Format( // "Device has scope {0} but device type is not {1} with namespace {2}", // NVT_SCOPE, ONVIF_20_DEVICE_TYPE, ONVIF_20_DEVICE_NS); // } // else // { // reason = string.Format( // "Device type is not {0} with namespace {1} but device scope {2} is missing", // ONVIF_DISCOVER_TYPES, ONVIF_NETWORK_WSDL_URL, NVT_SCOPE); // } // return false; //} }