public static ConnectivityStatisticsResource Deserialise(Request request) { ConnectivityStatisticsResource result = null; string name = request.UriPaths.Last(); if (!string.IsNullOrEmpty(name) && (request.ContentType == TlvConstant.CONTENT_TYPE_TLV)) { result = new ConnectivityStatisticsResource(); using (TlvReader reader = new TlvReader(request.Payload)) { result.Deserialise(reader); } } return(result); }
protected override void DoPut(CoapExchange exchange) { ConnectivityStatisticsResource connectivityStatisticsResource = ConnectivityStatisticsResource.Deserialise(exchange.Request); if (connectivityStatisticsResource == null) { Response response = Response.CreateResponse(exchange.Request, StatusCode.BadRequest); exchange.Respond(response); } else { connectivityStatisticsResource.Name = this.GetNextChildName(); this.Add(connectivityStatisticsResource); Response response = Response.CreateResponse(exchange.Request, StatusCode.Changed); exchange.Respond(response); OnChildCreated(connectivityStatisticsResource); } }
protected override void DoPost(CoapExchange exchange) { ConnectivityStatisticsResource connectivityStatisticsResource = ConnectivityStatisticsResource.Deserialise(exchange.Request); if (connectivityStatisticsResource == null) { Response response = Response.CreateResponse(exchange.Request, StatusCode.BadRequest); exchange.Respond(response); } else { connectivityStatisticsResource.Name = this.GetNextChildName(); this.Add(connectivityStatisticsResource); Response response = Response.CreateResponse(exchange.Request, StatusCode.Created); response.AddOption(Option.Create(OptionType.LocationPath, string.Concat(connectivityStatisticsResource.Path, connectivityStatisticsResource.Name))); exchange.Respond(response); OnChildCreated(connectivityStatisticsResource); } }
public static ConnectivityStatisticsResource Deserialise(Request request) { ConnectivityStatisticsResource result = null; string name = request.UriPaths.Last(); if (!string.IsNullOrEmpty(name) && (request.ContentType == TlvConstant.CONTENT_TYPE_TLV)) { result = new ConnectivityStatisticsResource(); using (TlvReader reader = new TlvReader(request.Payload)) { result.Deserialise(reader); } } return result; }