/// <summary> /// Shortcut method to create a <see cref="CoapMessage"/> with its optinos pre-populated to match the Uri. /// </summary> /// <param name="input"></param> /// <returns></returns> public static CoapMessage CreateFromUri(string input) { var message = new CoapMessage(); message.FromUri(input); return(message); }
/// <summary> /// Send out get request to an URI. This method is used in one of the test case /// <seealso cref=""/> /// <see cref=""/> /// </summary> /// <param name="uri">destination URI</param> /// <permission cref="">This method can be called by: Every User</permission> /// <exception cref="StatusReadDeniedException"></exception> public async Task <int> GetAsync(string uri, ICoapEndpoint endpoint = null) { var message = new CoapMessage { Id = messageId++, Code = CoapMessageCode.Get, Type = CoapMessageType.Confirmable }; message.FromUri(uri); messageReponses.TryAdd(message.Id, new TaskCompletionSource <CoapMessage>()); return(await SendAsync(message, endpoint)); }