Example #1
0
        /// <summary>
        /// Adds a physical link to the device of this root entry.
        /// </summary>
        /// <param name="endpoint">Local endpoint to be used for this link.</param>
        /// <param name="descriptionLocation">Location to retrieve the description from for this link.</param>
        /// <param name="httpVersion">HTTP version to use to retrieve the description for this link.</param>
        /// <param name="searchPort">Search port to use for search queries at the device for this link.</param>
        /// <returns>Created <see cref="LinkData"/> instance.</returns>
        internal LinkData AddOrUpdateLink(EndpointConfiguration endpoint, string descriptionLocation,
                                          HTTPVersion httpVersion, int searchPort)
        {
            LinkData result;

            if (!_linkConfigurations.TryGetValue(descriptionLocation, out result))
            {
                _linkConfigurations.Add(descriptionLocation, result = new LinkData(endpoint, descriptionLocation, httpVersion, searchPort));
            }
            if (_preferredLink == null || result.IsNearer(_preferredLink))
            {
                _preferredLink = result;
            }
            return(result);
        }
Example #2
0
 /// <summary>
 /// Clears all link configurations. That is necessary when a device has rebooted.
 /// </summary>
 internal void ClearLinks()
 {
     _preferredLink = null;
     _linkConfigurations.Clear();
 }