Exemple #1
0
        public static async Task <T> RequestAsync <T>(this ICoapClient client, CoapRequest request, CancellationToken cancellationToken)
        {
            var response = await client.RequestAsync(request, cancellationToken);

            var message = Encoding.UTF8.GetString(response.Payload);

            return(JsonSerializer.Deserialize <T>(message));
        }
 public CoapObserveResponse(CoapResponse response, ICoapClient client)
 {
     Response = response ?? throw new System.ArgumentNullException(nameof(response));
     _client  = client ?? throw new System.ArgumentNullException(nameof(client));
 }
Exemple #3
0
 public CoapClientInstance(ICoapClient coapClient)
 {
     _coapClient = coapClient ?? throw new global::System.ArgumentNullException(nameof(coapClient));
 }
Exemple #4
0
 public Gateway(ICoapClient coapClient, GatewaySettings settings)
 {
     _coapClient = coapClient ?? throw new ArgumentNullException(nameof(coapClient));
     _settings   = settings ?? throw new ArgumentNullException(nameof(settings));
 }