Beispiel #1
0
 /// <summary>
 /// Constructs a new observe relation.
 /// </summary>
 /// <param name="config">the config</param>
 /// <param name="endpoint">the observing endpoint</param>
 /// <param name="resource">the observed resource</param>
 /// <param name="exchange">the exchange that tries to establish the observe relation</param>
 public ObserveRelation(ICoapConfig config, ObservingEndpoint endpoint, IResource resource, Exchange exchange)
 {
     if (config == null)
     {
         throw ThrowHelper.ArgumentNull("config");
     }
     if (endpoint == null)
     {
         throw ThrowHelper.ArgumentNull("endpoint");
     }
     if (resource == null)
     {
         throw ThrowHelper.ArgumentNull("resource");
     }
     if (exchange == null)
     {
         throw ThrowHelper.ArgumentNull("exchange");
     }
     _config   = config;
     _endpoint = endpoint;
     _resource = resource;
     _exchange = exchange;
     _key      = String.Format("{0}#{1}", Source, exchange.Request.TokenString);
 }
        public ObserveRelation GetRelation(System.Net.EndPoint source, Byte[] token)
        {
            ObservingEndpoint remote = GetObservingEndpoint(source);

            return(remote == null ? null : remote.GetObserveRelation(token));
        }