public static LWM2MAccessControlResource Deserialise(Request request) { LWM2MAccessControlResource result = null; string name = request.UriPaths.Last(); if (!string.IsNullOrEmpty(name) && (request.ContentType == TlvConstant.CONTENT_TYPE_TLV)) { result = new LWM2MAccessControlResource(name); using (TlvReader reader = new TlvReader(request.Payload)) { result.Deserialise(reader); } } return(result); }
protected override void DoPut(CoapExchange exchange) { LWM2MAccessControlResource lWM2MAccessControlResource = LWM2MAccessControlResource.Deserialise(exchange.Request); if (lWM2MAccessControlResource == null) { Response response = Response.CreateResponse(exchange.Request, StatusCode.BadRequest); exchange.Respond(response); } else { this.Add(lWM2MAccessControlResource); Response response = Response.CreateResponse(exchange.Request, StatusCode.Changed); exchange.Respond(response); } }
public static LWM2MAccessControlResource Deserialise(Request request) { LWM2MAccessControlResource result = null; string name = request.UriPaths.Last(); if (!string.IsNullOrEmpty(name) && (request.ContentType == TlvConstant.CONTENT_TYPE_TLV)) { result = new LWM2MAccessControlResource(name); using (TlvReader reader = new TlvReader(request.Payload)) { result.Deserialise(reader); } } return result; }