Exemplo n.º 1
0
        internal string GetUri()
        {
            string Host = null;
            int?   Port = null;
            string Path = null;

            if (!(this.options is null))
            {
                foreach (CoapOption Option in this.options)
                {
                    switch (Option.OptionNumber)
                    {
                    case 3:
                        Host = ((CoapOptionUriHost)Option).Value;
                        break;

                    case 7:
                        Port = (int)((CoapOptionUriPort)Option).Value;
                        break;

                    case 11:
                        if (Path is null)
                        {
                            Path = "/";
                        }
                        else
                        {
                            Path += "/";
                        }

                        Path += ((CoapOptionUriPath)Option).Value;
                        break;
                    }
                }
            }

            return(CoapEndpoint.GetUri(Host, Port, Path, null));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Generates an URI for the message.
 /// </summary>
 /// <returns>URI string.</returns>
 public string GetUri()
 {
     return(CoapEndpoint.GetUri(this.host, this.port, this.path, this.uriQuery));
 }